All tasks complete

Dependencies:   mbed MCP23017 mbed-rtos WattBob_TextLCD

Revision:
4:27340b291c09
Parent:
3:f88d667629e6
Child:
5:f5dda79b93cb
diff -r f88d667629e6 -r 27340b291c09 assignment3tasks.cpp
--- a/assignment3tasks.cpp	Mon Mar 25 21:13:24 2019 +0000
+++ b/assignment3tasks.cpp	Tue Mar 26 14:49:10 2019 +0000
@@ -1,8 +1,8 @@
 #include "header.h"
 
 
-//definitions of taskss
-//lock and unlock variables in struct whne performing calculations 
+//definitions of tasks
+//lock and unlock variables in struct when performing calculations 
 
 //pedals 
 AnalogIn            brake_pedal(pin_analog_1);
@@ -18,8 +18,8 @@
 
 //indicators 
 DigitalOut          ngeneind(pin_LED1);
-DigitalOut          leftind(pin_LED2);
-DigitalOut          rightind(pin_LED3);
+PwmOut              leftind(pin_LED2); //was digitalout
+PwmOut              rightind(pin_LED3);//was digitalout
 DigitalOut          sideind(pin_LED4);
 
 
@@ -27,30 +27,46 @@
 DigitalOut          brakeind(pin_LED5);
 DigitalOut          overspeedind(pin_LED6);
 
-Mutex stdio_mutex;
+
+
+//
+extern SDATA speed;
+extern CARINFO info;
+extern SIMU_DATA sim;
+
+// LCD
+
+extern WattBob_TextLCD *display;
+
+// MUTEX
+
+extern Mutex simuXS;
+extern Mutex speedXS;
+extern Mutex carstateXS;
+//
 
 
 void task1readbrake()
 {
-   stdio_mutex.lock();//lock
+   speedXS.lock();//lock
    speed.brakevalue = brake_pedal.read(); 
-   stdio_mutex.unlock();//unlock
+   speedXS.unlock();//unlock
 }
 
 void task2readaccel()
 {
-   stdio_mutex.lock();//lock
+   speedXS.lock();//lock
    speed.accelvalue = accel_pedal.read(); 
-   stdio_mutex.unlock();//unlock
+   speedXS.unlock();//unlock
 }
 
 void task3enginestate()
 {   
     //lock
-    stdio_mutex.lock();
+    carstateXS.lock();
     uint8_t engineonoff = ngene.read();  
     info.ENGINESTATE = engineonoff;
-    stdio_mutex.unlock();
+    carstateXS.unlock();
     //unlock
     
     if(engineonoff == 1){