homework 7

Dependencies:   mbed-rtos mbed C12832_lcd LM75B

Revision:
85:dfc5add157e7
Parent:
84:fee8fb80d190
--- a/main.cpp	Thu Sep 12 04:50:06 2013 +0000
+++ b/main.cpp	Thu Sep 12 04:55:14 2013 +0000
@@ -185,7 +185,7 @@
       tickerSlowClock.attach_us(&slowClock         ,SLOWCLOCKuS);
       
 
-       tickerCookCountdown.attach(&tickCookRemainingTime,1);
+  //     tickerCookCountdown.attach(&tickCookRemainingTime,1);
  
       
       Thread thread_1(temperatureThread       ,NULL,osPriorityIdle,DEFAULT_STACK_SIZE,NULL);
@@ -324,6 +324,8 @@
       
       while(1)                                  // thread loop.
       {
+      
+        tickerCookCountdown.attach(&tickCookRemainingTime,1);
   
         switch (dFSMstate)                      // cook-mode state machine.
         {
@@ -349,6 +351,8 @@
             if (dFSMstate != dFSMstateLast)     // if just entered state.
             { 
               giRemainingTime.cControl = RT_DECREMENT;
+              tickerCookCountdown.detach();
+              tickerCookCountdown.attach(&tickCookRemainingTime,1);
             }    
             
             giLCD.dTotalCookTime = giRemainingTime.dTotalTime;