homework 7
Dependencies: mbed-rtos mbed C12832_lcd LM75B
Diff: main.cpp
- Revision:
- 110:a3b95ccfaed6
- Parent:
- 109:2fa55ab6e178
- Child:
- 111:b89c27ffae01
--- a/main.cpp Thu Sep 12 21:16:37 2013 +0000 +++ b/main.cpp Thu Sep 12 21:19:43 2013 +0000 @@ -81,6 +81,7 @@ struct tRemainingTime // remaining time related. { char cControl; // countdown control. + char cBeepEnable; // beep control. int dTotalTime; // initialize to this. int dRemainingTime; // the countdown value. }; @@ -106,7 +107,7 @@ tRemainingTime giRemainingTime; // structure instance. tLCD giLCD; // structure instance. - char gcBeepEnable; +// char giRemainingTime.cBeepEnable; //--global_instances----------------------------//------------------------------ Serial pc(USBTX, USBRX); // PuTTY terminal communication. LM75B temperature(p28,p27); // on-board thermometer. @@ -190,7 +191,7 @@ led1 = 0; giButtons.cDoorOpen = 0; // initialize with door closed. - gcBeepEnable =0; + giRemainingTime.cBeepEnable =0; @@ -481,7 +482,7 @@ queueTemperatureControl.put((int *) TEMP_FREEZE,1); - gcBeepEnable = 1; + giRemainingTime.cBeepEnable = 1; beepTimer.reset(); // clear the beep timer. } @@ -495,7 +496,7 @@ giRemainingTime.cControl = RT_CLEAR; // determine next state. dFSMstateLast = dFSMstate; - if (beepTimer.read() >= BEEPTIME) {dFSMstate = FSM_IDLE; gcBeepEnable = 0;} + if (beepTimer.read() >= BEEPTIME) {dFSMstate = FSM_IDLE; giRemainingTime.cBeepEnable = 0;} else dFSMstate = FSM_DONE; led3 = 1; @@ -821,10 +822,10 @@ } // cookRemainingTime. /*----------------------------------------------//----------------------------*/ - void tickerBeeper(void) // beep when gcBeepEnable is 1. + void tickerBeeper(void) // beep when giRemainingTime.cBeepEnable is 1. { static char cState = 0; - if (gcBeepEnable) + if (giRemainingTime.cBeepEnable) { if (cState) {speaker = 1; cState = 0;} else {speaker = 0; cState = 1;}