homework 7
Dependencies: mbed-rtos mbed C12832_lcd LM75B
Diff: main.cpp
- Revision:
- 113:8111b9cd15ce
- Parent:
- 112:465958b0e94e
- Child:
- 114:fbe9ef1630c1
diff -r 465958b0e94e -r 8111b9cd15ce main.cpp --- a/main.cpp Thu Sep 12 21:25:28 2013 +0000 +++ b/main.cpp Thu Sep 12 21:29:49 2013 +0000 @@ -254,7 +254,6 @@ } // thread loop. } // threadButtonStateManager. /*----------------------------------------------//----------------------------*/ -// the incoming messages are mutually-exclusive. // total time controller. void threadTotalTimeControl(void const *args) { @@ -268,9 +267,6 @@ while(1) // thread loop. { - - - // if FSM tells this to clear // the total time. queueEvent = queueClearTotalTime.get(1); @@ -289,9 +285,7 @@ dSuppress = (int) queueEvent.value.p; } - - - + queueEvent = queueModTotalTime.get(1); // get message. if (queueEvent.status == osEventMessage) { @@ -316,34 +310,27 @@ } // thread loop. } // threadTotalTimeControl. /*----------------------------------------------//----------------------------*/ - void threadCookStateFSM(void const *args) // cook-cycle FSM. { - int dFSMstate = FSM_IDLE; // state of this FSM. - int dFSMstateLast = FSM_IDLE; // previous FSM state. - int dButtonState; // received button state. - int dRemainingTime = 0; // received remaining time. + int dFSMstate = FSM_IDLE; // state of this FSM. + int dFSMstateLast = FSM_IDLE; // previous FSM state. + int dButtonState = 0; // received button state. + int dRemainingTime = 0; // received remaining time. - int dButtonStart = 0; - int dButtonStop = 0; - int dDoorOpen = 0; - int dBeepSeconds = 0; - + int dButtonStart = 0; // received button state. + int dButtonStop = 0; // received button state. + int dDoorOpen = 0; // received door state. + osEvent queueEvent; // from button state manager. + beepTimer.start(); // run the beep timer. - - dBeepSeconds = BEEPTIME; - - - - + // constantly read live temperature. queueTemperatureControl.put((int *) TEMP_READ,1); while(1) // thread loop. { - // pc.printf("\n\r state: %d",dFSMstate); - + switch (dFSMstate) // cook-mode state machine. { //---