3.5 Charger State Machine (CSM)

The CSM is responsible for guiding the system through the various states needed to safely charge the battery. Multiple state machines are included, one for each battery chemistry option. The state machines are enabled through #define statements in the MultiChemCharger_Main.h file. Each state in these machines is designed to control the hardware to provide the appropriate current and voltage for the battery as needed, as well as pass control to the next state. The power supply hardware components (the type, topology, associated registers and controls) are abstracted from the main.c routines through generic function calls to the routines found in the MultiChemCharger_Hardware.c file. Each unique hardware implementation will need the routines adjusted as needed to implement the abstracted hardware functions.