# GAT Nametag SC8 CH32V003 Firmware

sub mcu firmware for the GAT Nametag originally shown at Supercon 8.

responsible for doing things the main micro can't due to layout or other reasons, such as user button I/O, accelerometer interrupt, and hardware enable for the RGBLED controller.

the sub MCU is on the bottom board. to use a debugger to debug or program, connect to the SWO pin. with the nametag upright, this pin is the top left pad near the side button.

there is no workable bootloader yet present so a WCH-LinkE is required to update firmware. I hope to have time to work on i2c slave bootloader at or after Supercon 8.


## building

This is a MounRiver Studio project. Build in MRS.


## bugs, quirks, omissions

- this really isn't an appropriate MCU for this. it can't wakeup on i2c from a low power / oscillator off state, so no matter what this thing pisses away at least 1mA.
	- for i2c to work at the speeds we're running, 8MHz clock is minimum. ~1-2mA.
    - this MCU was chosen due to it being available and using the same toolchain as the main MCU.
    - if proper sleep mode is implemented then power could be saved, with this MCU being the first to wake up then telling master to wake up. but it doesn't help active mode consumption.
    - this MCU model is a "popular" thing right now, being called the 10 cent MCU even though it's never available for that price. but people love popularity and cheap shit so meh.

- i2c slave code was mostly lifted from ch32v003fun I think, but adapted for my use

- things mostly just worked OK on this board.