homework 7

Dependencies:   mbed-rtos mbed C12832_lcd LM75B

Files at this revision

API Documentation at this revision

Comitter:
gatedClock
Date:
Fri Sep 13 00:30:31 2013 +0000
Parent:
125:6b3a86e3c883
Commit message:
turn in for credit.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Sep 13 00:15:02 2013 +0000
+++ b/main.cpp	Fri Sep 13 00:30:31 2013 +0000
@@ -129,6 +129,15 @@
     verify consistency of states and turning off the mangetron if it found
     anything suspicious.  Haven't thought this through.
     
+    blinkers: I've added greater granularity into magetron enunciator (led0)
+    for human appearance of less latency.  I left low granularity in
+    the carousel enunciator (led1) for comparision, you can see the difference.
+    
+    led0 = magnetron numan enunciator.
+    led1 = carousel  human enunciator.
+    led2 = mangetron control.
+    led3 = arousel   control.
+    
     
 -----includes-----------------------------------//----------------------------*/
     #include "mbed.h"                           // mbed class.
@@ -182,7 +191,7 @@
     #define BEEPTIME           3                // beep duration in S.
     #define BEEPFREQ         300                // beep frequency in Hz.
     
-    #define TIMEINC           10                // time increment in seconds.
+    #define TIMEINC           60                // time increment in seconds.
 //--global_definitions--------------------------//------------------------------
     struct tButtons                             // button ISR updates.
     {
@@ -311,7 +320,7 @@
                                                 // kick-off tickers.
       tickerCookCountdown.attach_us(&tickCookRemainingTime,1000000/GRANULARITY);
       tickerBeep.attach_us         (&tickerBeeper         ,2000);     
-      tickerBlinkMagnetron.attach_us(&tickerMagnetron,250000);
+      tickerBlinkMagnetron.attach_us(&tickerMagnetron,250000 / 1024);
       tickerBlinkCarousel.attach_us(&tickerCarousel,250000);
       
                                                 // kick-off threads.
@@ -978,8 +987,14 @@
                                                 // this is not magnetron control.
     void tickerMagnetron(void)                  // magnetron enunciator.
     {
-      if (giMagnetron.cMagnetron) led0 = !led0;
-      else led0 = 0;
+      static int dCounter = 0;                  // latency reduction.
+      
+      if (giMagnetron.cMagnetron)               // turn off humanly quickly.
+      {
+        if (!(dCounter % 1024)) led0 = !led0;
+      } else led0 = 0;
+      
+      dCounter++;
     }
 
 /*----------------------------------------------//----------------------------*/