# GAT Nametag SC8 CH592 Firmware

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


## building

This is a MounRiver Studio project. Build in MRS.


## bugs, quirks, omissions

- this micro has VERY SLOW flash. therefore, most user code is executed from RAM. additionally, the flash is protected and not really documented. will take time to reverse engineer it from the provided .a file to possibly determine if wait states can be adjusted.

- i2c master is bitbanged and may still have bugs.

- i2c slave is bitbanged and hasn't been tested at all.
 
- "idle mode" isn't really a power saving mode. no time to implement. need to do the following to implement this properly:
    - implement a low power mode in the sub MCU as well, tell it to go to sleep
    - get low power mode implemented and tested with gpio wakeup on this MCU
    - put rgbled controller into low power mode
    - configure accelerometer for wakeup with interrupt pin output
    - get the interrupt chain working from accel -> sub mcu -> main mcu
    - properly reinitialize and wake up once interrupt received and data matches expectations
     
- cpu usage calculation is pretty busted and is only meant to gauge how much free time may exist for doing more processing before the framerate drops.