homework 7

Dependencies:   mbed-rtos mbed C12832_lcd LM75B

Revision:
112:465958b0e94e
Parent:
111:b89c27ffae01
Child:
113:8111b9cd15ce
--- a/main.cpp	Thu Sep 12 21:21:19 2013 +0000
+++ b/main.cpp	Thu Sep 12 21:25:28 2013 +0000
@@ -157,10 +157,10 @@
 //==============================================//==============================
     int main(void) 
     {
-  //    char cLeftButtonState;                    // 1 means button was pressed.
     
-    
-    
+      initialization();                         // initialize variables.
+
+                                                // ISR setup.
       iJoyStickLeft.rise (&ISRleftButtonRising);
       iJoyStickLeft.fall (&ISRleftButtonFalling);
       
@@ -179,43 +179,19 @@
       debounceTimer.start();                    // kick-off debounce timer.
       
       
-
-      
-      initialization();                         // initialize variables.
-
-      led1 = 0;
-      giButtons.cDoorOpen = 0;                  // initialize with door closed.
-      giRemainingTime.cBeepEnable =0;
-      
-
+                                                // kick-off tickers.
+      tickerCookCountdown.attach_us(&tickCookRemainingTime,1000000/GRANULARITY);
+      tickerBeep.attach_us         (&tickerBeeper         ,2000);     
       
-
-       tickerCookCountdown.attach_us(&tickCookRemainingTime,1000000/GRANULARITY);
-       
-       tickerBeep.attach_us(&tickerBeeper,2000);
- 
-      
+                                                // kick-off threads.
       Thread thread_1(temperatureThread       ,NULL,osPriorityIdle,DEFAULT_STACK_SIZE,NULL);
-      Thread thread_2(LCDthread               ,NULL,osPriorityHigh,DEFAULT_STACK_SIZE,NULL);
+      Thread thread_2(LCDthread               ,NULL,osPriorityNormal,DEFAULT_STACK_SIZE,NULL);
       Thread thread_3(threadTotalTimeControl  ,NULL,osPriorityIdle,DEFAULT_STACK_SIZE,NULL);
-      Thread thread_4(threadButtonStateManager,NULL,osPriorityIdle,DEFAULT_STACK_SIZE,NULL); // was osPriorityIdle
+      Thread thread_4(threadButtonStateManager,NULL,osPriorityIdle,DEFAULT_STACK_SIZE,NULL);
       Thread thread_5(threadCookStateFSM      ,NULL,osPriorityIdle,DEFAULT_STACK_SIZE,NULL);
 
 
-     
- 
-
-      
-      while(1)
-      {
-
- 
-        Thread::wait(1000);
-      
-      
-      
- 
-      }
+      while(1) Thread::wait(10000);             // execute microwave controller.
     }     
 /*----------------------------------------------//----------------------------*/
 
@@ -560,7 +536,9 @@
 /*----------------------------------------------//----------------------------*/
     void initialization(void)                   // program initializations.
     {
-  //    gcSignalWaitEnable = 1;
+      led1 = 0;
+      giButtons.cDoorOpen = 0;                  // initialize with door closed.
+      giRemainingTime.cBeepEnable =0;
     }
 /*----------------------------------------------//----------------------------*/
     void ISRleftButtonRising(void)              // cooktime plus 60s.