/* * the program start */ void main(void) { unsigned char state = STATE_STARTUP; /* state machine */ while(1) { /* Loop forever */ switch( state ) { case STATE_STARTUP: startup(); state = STATE_INIT; break; case STATE_INIT: state = STATE_OPERATE; break; case STATE_SETUP: setup(); state = STATE_INIT; break; case STATE_OPERATE: if( buttonSetup == BUTTON_ON ) { state = STATE_SETUP; } else { automode(); manualmode(); } break; } // end switch }; // end while }
void mode2() { automode(); }