Lab6 part 1

Files at this revision

API Documentation at this revision

Comitter:
alifsohen
Date:
Thu Apr 02 09:19:44 2020 +0000
Parent:
7:e49685bca7c7
Commit message:
Lab6 part 1

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Mar 11 08:46:57 2020 +0000
+++ b/main.cpp	Thu Apr 02 09:19:44 2020 +0000
@@ -43,12 +43,15 @@
 //   Turn LED1 on/off in response to signals 
 // -----------------------------------------------
 void led1_thread() {  // method to run in thread
+
     int evt ;
     while (true) {
         evt = signals.wait_any(ON1 | OFF1); // wait for either signal
         if (evt & ON1) led1 = ON ;
         if (evt & OFF1) led1 = OFF ;
-        waitButton() ;  // POSSIBLE FAULT HERE
+       // waitButton() ;  // POSSIBLE FAULT HERE
+        wdt_kickA() ;
+
     }
 }
 
@@ -62,6 +65,7 @@
         if (evt & ON2) led2 = ON ;
         if (evt & OFF2) led2 = OFF ;
         // waitButton() ; // POSSIBLE FAULT HERE
+         wdt_kickB() ;
     }
 }
 
@@ -74,7 +78,7 @@
         signals.set(ON1 | ON2) ;
         ThisThread::sleep_for(1000) ;
         signals.set(OFF1 | OFF2) ;
-        // waitButton() ; // POSSIBLE FAULT HERE
+         waitButton() ; // POSSIBLE FAULT HERE
     }
 }
 
@@ -87,9 +91,9 @@
 // ----------------------------------------------
 
 int main(void) {
-    wdt_32ms() ; // initialise watchdog - 32ms timeout
-    wdt_kick_all() ;
-    tick.attach_us(callback(&wdt_kick_all), 20000); // ticks every 20ms    
+    wdt_1sec() ; // initialise watchdog - 32ms timeout
+    //wdt_kick_all() ;
+    //tick.attach_us(callback(&wdt_kick_all), 20000); // ticks every 20ms    
     
     // start threads
     threadT.start(timer_thread) ; // start the timer thread