...
State machine is:
Open
Close ground
Close hv
Closed
Must check relay state after each close and open, BPS fault if relays didn’t follow instructions
Wait 100 ms to check relay state, wait 200 ms between closing gnd and closing hv
prv_open(): opens gnd then hv, can do them both nearly the same time without checking state in between, but check state afterwards
relay_control_init(): inits pins
relay_process_event(): opens relays upon relay open event, advances state machine after checks
Note: relay sense pins are hidden behind a GPIO expander and will have to be queried through I2C
Killswitch
Killswitch is basically just a debounced GPIO pin
prv_killswitch_cb(): BPS fault
killswitch_init(): inits pins. Hidden behind gpio expander, will have to go through that driver.
Cell_sense
prv_fault_check(): check fresh data for faults
prv_periodic…(): periodically reads AFEs for data
cell_sense_init(): begins periodic checks, inits SPI
...
Current sense
exposes init(), and read()
...
MCP23008
May need addition of interrupt configuration