homework 7
Dependencies: mbed-rtos mbed C12832_lcd LM75B
Diff: main.cpp
- Revision:
- 81:12bc26973cb8
- Parent:
- 80:e3e1a2161435
- Child:
- 82:73fa3fe8a217
--- a/main.cpp Thu Sep 12 04:38:37 2013 +0000 +++ b/main.cpp Thu Sep 12 04:46:18 2013 +0000 @@ -236,7 +236,6 @@ dMessage = MSG_INC_TIME; // set message. queueModTotalTime.put((int *) dMessage,1);// pretend it's a pointer. gtButtons.cLeftButton = 0; // clear the button state. -// pc.printf("\n\r time increment button."); } if (gtButtons.cRightButton) // total time decrement button. @@ -244,7 +243,6 @@ dMessage = MSG_DEC_TIME; // set message. queueModTotalTime.put((int *) dMessage,1);// pretend it's a pointer. gtButtons.cRightButton = 0; // clear the button state. - // pc.printf("\n\r time decrement button."); } //--- // COOK-STATE FSM. @@ -303,36 +301,14 @@ if (dTotalTime < 0) dTotalTime = 0; dRC = queueSetRemainingTime.put((int *) dTotalTime,1); - pc.printf("\n\r just queueSetRemainingTime.put %d, dRC = %d",dTotalTime,dRC); giRemainingTime.dTotalTime = dTotalTime; - - } - - - - gdLCDtotalCookTimeSec = dTotalTime; // transmit to LCD. - - // pretend it's a pointer. -// queueUpdateTotalTime.put((int *) dTotalTime); - - - + Thread::wait(THREAD_3_WAITmS); // multitasking. } // thread loop. } // threadTotalTimeControl. /*----------------------------------------------//----------------------------*/ -/* - #define FSM_IDLE 0x00 // cook-state state-machine. - #define FSM_COOK 0x01 // cook-state state-machine. - #define FSM_PAUSE 0x02 // cook-state state-machine. - #define FSM_DONE 0x04 // cook-state state-machine. - - #define MSG_START 0x04 - #define MSG_STOP 0x08 - #define MSG_OPEN 0x10 - #define MSG_CLOSED 0x20 -*/ + void threadCookStateFSM(void const *args) // cook-cycle FSM. { static int dFSMstate = FSM_IDLE; // state of this FSM. @@ -343,42 +319,14 @@ static int dButtonStart = 0; static int dButtonStop = 0; static int dDoorOpen = 0; - static char cAttached = 0; // track ticker attachment. - - + + osEvent queueEvent; // from button state manager. - osEvent queueEvent; // queue event. -/* - struct tRemainingTime // remaining time related. - { - char cControl; // countdown control. - int dTotalTime; // initialize to this. - int dRemainingTime; // the countdown value. - } - -giRemainingTime. - - #define RT_PRELOAD 0x01 // remaining-time preload. - #define RT_DECREMENT 0x02 // remaining-time decrement. - #define RT_PAUSE 0x03 // remaining-time don't change. - #define RT_CLEAR 0x04 // remaining-time set to zero. - -*/ - while(1) // thread loop. { - - - - - - - - -//pc.printf("\n\rFSM state, stateLast: %d %d- start, open, remaining, total %d %d %d %d",dFSMstate,dFSMstateLast,dButtonStart,dDoorOpen,dRemainingTime,giRemainingTime.dTotalTime); - + switch (dFSMstate) // cook-mode state machine. { case FSM_IDLE : // IDLE.