...
prv_fault_check(): checks new data for faults
prv_periodic_read_current(): read current at least 100 times a second
Every 20 readings, update the data in CurrentStorage.
current_sense_init(): inits periodic read
Note: eventually this module will also be responsible for transmitting data to the RPI for state of charge calculations.
Note: to convert from the ADS1259 reading to a current reading, multiply the ADS1259 reading by 100
Data type notes
RelayStorage
...
Holds the last 20 current readings, all updated at the same time periodically. Stored as int16_t because current can be negative.
AfeStorage
Holds the voltages of 6 modules x3 AFEs
Holds the temps of 30 thermistors (exact number TBD) x3 AFEs
...
Also holds DebounceStorage, required for killswitch.
IMPORTANT: Also holds state_of_charge as a uint32_t or something from raspi
Raspi
toggle the 5V_EN pin when we want to turn the raspi on
send data to the raspi through UART
Receive data from raspi through UART
Drivers
ADT7470
fan controller, exposes init() and update_speed(). The ‘stuck’ interrupt is in a GPIO pin, can be registered by the module.
...