homework 7

Dependencies:   mbed-rtos mbed C12832_lcd LM75B

Files at this revision

API Documentation at this revision

Comitter:
gatedClock
Date:
Thu Sep 12 21:15:47 2013 +0000
Parent:
107:7de171a8464e
Child:
109:2fa55ab6e178
Commit message:
cleanup.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Sep 12 21:14:18 2013 +0000
+++ b/main.cpp	Thu Sep 12 21:15:47 2013 +0000
@@ -102,11 +102,7 @@
     Queue<int, 1> queueSuppressTimeAdjust;      // total time control.
     Queue<int, 1> queueClearTotalTime;          // total time control.
 //--global_variables----------------------------//------------------------------ 
-
-  //  float    gfCelsius;                         // from thermometer.
-        
-    tButtons gtButtons;                         // ISR button updates.
-    
+    tButtons       giButtons;                   // ISR button updates.
     tRemainingTime giRemainingTime;             // structure instance.
     tLCD           giLCD;                       // structure instance.
     
@@ -194,7 +190,7 @@
       initialization();                         // initialize variables.
 
       led1 = 0;
-      gtButtons.cDoorOpen = 0;                  // initialize with door closed.
+      giButtons.cDoorOpen = 0;                  // initialize with door closed.
       gcBeepEnable =0;
       
 
@@ -252,41 +248,41 @@
                                                 // encoded integers will be sent,
                                                 // not pointers.
       
-      if (gtButtons.cLeftButton)                // total time increment button.
+      if (giButtons.cLeftButton)                // total time increment button.
       {
         dMessage = MSG_INC_TIME;                // set message.
         queueModTotalTime.put((int *) dMessage,1);// pretend it's a pointer.
-        gtButtons.cLeftButton = 0;              // clear the button state.
+        giButtons.cLeftButton = 0;              // clear the button state.
       }
 
-      if (gtButtons.cRightButton)               // total time decrement button.
+      if (giButtons.cRightButton)               // total time decrement button.
       {
         dMessage = MSG_DEC_TIME;                // set message.
         queueModTotalTime.put((int *) dMessage,1);// pretend it's a pointer.
-        gtButtons.cRightButton = 0;             // clear the button state.
+        giButtons.cRightButton = 0;             // clear the button state.
       }
    
 //---                                           // COOK-STATE FSM.
     
-      if (gtButtons.cTopButton)                 // start-cook button.             
+      if (giButtons.cTopButton)                 // start-cook button.             
       {
         dMessage = MSG_START;                   // set message.
         queueUpdateFSM.put((int *) dMessage,1);   // pretend it's a pointer.
-        gtButtons.cTopButton = 0;               // clear the button state.
+        giButtons.cTopButton = 0;               // clear the button state.
       }
      
-      if (gtButtons.cBottomButton)              // stop-cook button.
+      if (giButtons.cBottomButton)              // stop-cook button.
       {
         dMessage = MSG_STOP;                    // set message.
         queueUpdateFSM.put((int *) dMessage,1);   // pretend it's a pointer.
-        gtButtons.cBottomButton = 0;            // clear the button state.
+        giButtons.cBottomButton = 0;            // clear the button state.
       }
   
-      if (gtButtons.cCenterButton)              // door-state-toggle.
+      if (giButtons.cCenterButton)              // door-state-toggle.
       {
-        dMessage = gtButtons.cDoorOpen;         // determined in ISR.
+        dMessage = giButtons.cDoorOpen;         // determined in ISR.
         queueUpdateFSM.put((int *) dMessage,1);   // pretend it's a pointer.
-        gtButtons.cCenterButton = 0;            // clear the button state.      
+        giButtons.cCenterButton = 0;            // clear the button state.      
       }
 //---     
       
@@ -582,7 +578,7 @@
     void ISRleftButtonRising(void)              // cooktime plus 60s.
     {
       if (debounceTimer.read_ms() > DEBOUNCEmS)
-      gtButtons.cLeftButton = 1;                // detect left button.
+      giButtons.cLeftButton = 1;                // detect left button.
       
       debounceTimer.reset();                    // begin debounce period.
     } 
@@ -595,7 +591,7 @@
     void ISRrightButtonRising(void)             // cooktime -60s.
     {
       if (debounceTimer.read_ms() > DEBOUNCEmS)
-      gtButtons.cRightButton = 1;               // detect right button.
+      giButtons.cRightButton = 1;               // detect right button.
       
       debounceTimer.reset();                    // begin debounce period.
     } 
@@ -608,7 +604,7 @@
     void ISRtopButtonRising(void)               // cook start.
     {
       if (debounceTimer.read_ms() > DEBOUNCEmS)
-      gtButtons.cTopButton = 1;                 // detect top button.
+      giButtons.cTopButton = 1;                 // detect top button.
       
       debounceTimer.reset();                    // begin debounce period.
     } 
@@ -627,7 +623,7 @@
       if (debounceTimer.read_ms() > DEBOUNCEmS)
       {
         led0 = 0;                               // magnetron off.
-        gtButtons.cBottomButton = 1;            // detect bottom button.
+        giButtons.cBottomButton = 1;            // detect bottom button.
       }
       debounceTimer.reset();                    // begin debounce period.
     }
@@ -645,15 +641,15 @@
     {
       if (debounceTimer.read_ms() > DEBOUNCEmS)
       {
-        if (gtButtons.cDoorOpen == MSG_OPEN)    // calculate door state.
-        gtButtons.cDoorOpen = MSG_CLOSED;
+        if (giButtons.cDoorOpen == MSG_OPEN)    // calculate door state.
+        giButtons.cDoorOpen = MSG_CLOSED;
         else
-        gtButtons.cDoorOpen = MSG_OPEN;
+        giButtons.cDoorOpen = MSG_OPEN;
       
                                                 // magnetron off.
-        if (gtButtons.cDoorOpen == MSG_OPEN) led0 = 0;        
+        if (giButtons.cDoorOpen == MSG_OPEN) led0 = 0;        
       
-        gtButtons.cCenterButton = 1;              
+        giButtons.cCenterButton = 1;              
       }
       debounceTimer.reset();                    // begin debounce period.
     }