I think we can break down the badge firmware into the following RTOS Tasks, I've tried to give a quick summary of what I think each task might cover
TiLDA
Main application logic and director thread, takes input from everywhere and triggers everything else (might not be needed)
GUI/Display
Responsible for managing the frame buffer, drawing the widgets, flipping it based on IMU and calling EPD to ask for a full or partial update
IMU
Setup IMU on power up, manage IMU interrupts and updating global available orientation data. Configure IMU in and out of sleep states
Radio
Handle all radio traffic and protocol exchanges, update state as required, (may trigger screen update)
Buttons
React to user interaction, from joystick, A&B, left & right context, light buttons. (may trigger screen update, start IR, change RGB State, )
RGB
manage PWM out put to RGB LED's including torch mode
PMIC
Look after PMIC lines states, charging, monitor battery level and OTG voltage generation (if not don't by USB host drivers)
Flash
deal with reading and writing to flash chip, work with config area, file system
USB
handle USB serial and MSD tasks
IR
send and receive IR data
Sound
Sound play back from buffer or sound track
Sleep
This is likely to be done via the IDLE hook, managed going into and out of the various levels of sleep states Sleep mode, Wait mode, Backup mode. Including saving config and state information, hibernation file before entering backup mode
Possible FreeRTOS compatible HAL drivers needed to support our firmware
some of these we might be ok just to use the Arduino API versions
I think we can break down the badge firmware into the following RTOS Tasks, I've tried to give a quick summary of what I think each task might cover
Possible FreeRTOS compatible HAL drivers needed to support our firmware some of these we might be ok just to use the Arduino API versions