![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
All tasks complete
Dependencies: mbed MCP23017 mbed-rtos WattBob_TextLCD
Diff: assignment3tasks.cpp
- Revision:
- 2:9d6d07c9cc9c
- Parent:
- 1:c4f62ef9b5b7
- Child:
- 3:f88d667629e6
diff -r c4f62ef9b5b7 -r 9d6d07c9cc9c assignment3tasks.cpp --- a/assignment3tasks.cpp Wed Mar 20 16:12:17 2019 +0000 +++ b/assignment3tasks.cpp Wed Mar 20 19:51:42 2019 +0000 @@ -1,4 +1,6 @@ #include "header.h" +#include "rtos.h" + //definitions of taskss //lock and unlock variables in struct whne performing calculations @@ -25,28 +27,30 @@ DigitalOut brakeind(pin_LED5); DigitalOut overspeedind(pin_LED6); +Mutex stdio_mutex; + void task1readbrake() { - //lock + stdio_mutex.lock();//lock speed.brakevalue = brake_pedal.read(); - //unlock + stdio_mutex.unlock();//unlock } void task2readaccel() { - //lock + stdio_mutex.lock();//lock speed.accelvalue = accel_pedal.read(); - //unlock + stdio_mutex.unlock();//unlock } void task3enginestate() { //lock - + stdio_mutex.lock(); uint8_t engineonoff = ngene.read(); - info->ENGINESTATE = engineonoff;# - + info.ENGINESTATE = engineonoff; + stdio_mutex.unlock(); //unlock if(engineonoff == 1){