/*--- State machine functions. ---*/
UI_16 standby(void);
UI_16 starting(void);
UI_16 running(void);
/*--- State Machine. ---*/
enum {STANDBY = 0, STARTING, RUNNING};
/*********************************************************************
* Function Name : main
* Description : Program entry point.
Initialise array of constant function pointers.
Initialise state machine to standby.
Execute state machine.
*********************************************************************/
SI_16 main(void)
{
UI_16 (*const Motor_State[])(void) = {standby, starting, running};
UI_16 State = STANDBY;
for(;;){
State = Motor_State[State](); /* call state function */
}
}
/*--- End of file. ---*/