Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 8:e6403cb3582f
- Parent:
- 7:e49685bca7c7
diff -r e49685bca7c7 -r e6403cb3582f main.cpp
--- 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