/*--- State Machine ---*/
enum STATE{IDLE_S = 0, MASSAGE_S, LUMBAR_S, BOLSTER_S, ERROR_S};
/*--- State machine functions. ---*/
enum STATE idle(void);
enum STATE massage(void);
enum STATE lumbar(void);
enum STATE bolster(void);
enum STATE error_state(void);
/*--- Program entry point ---*/
void main(void)
{
enum STATE (*const Pump_State[])(void) = {idle, massage, lumbar, bolster, error_state};
enum STATE State = IDLE_S;
for(;;)
{
State = Pump_State[State](); /* execute state machine */
}
}
/*--- End of File ---*/