Thread Sync Example

Dependencies:   C12832

Revision:
2:29dca06b0ee0
Parent:
1:a477e0d640e0
--- a/main.cpp	Wed Mar 22 15:31:42 2017 +0000
+++ b/main.cpp	Thu Mar 21 16:47:54 2019 +0000
@@ -1,8 +1,10 @@
 // see: [[RTOS: Demonstration Setup]] 
 // Trace ab 15:00
-
 #include "mbed.h"
-
+#include "C12832.h"
+ 
+C12832 lcd(p5, p7, p6, p8, p11);
+ 
 class Rgb
 {
 private:
@@ -68,12 +70,16 @@
        }
 
        {
-           Led1.LedOn();
-           Delay_Nonsense(&BlueDelay, &TargetCount);
-           wait_ms(xDelay);
-           Led1.LedOff();
-           Delay_Nonsense(&BlueDelay, &TargetCount);
-           wait_ms(xDelay);
+            lcd.cls();
+            lcd.locate(0,3);
+            lcd.printf("Thread 1 RED LED blinks \r\nRRRRRRRRRR!");
+            wait(1);
+            Led1.LedOn();
+            Delay_Nonsense(&BlueDelay, &TargetCount);
+            wait_ms(xDelay);
+            Led1.LedOff();
+            Delay_Nonsense(&BlueDelay, &TargetCount);
+            wait_ms(xDelay);
        }
    }
 }
@@ -89,6 +95,11 @@
           wait_ms(xDelay);
        }
        {
+            lcd.cls();
+            lcd.locate(0,3);
+            lcd.printf("Thread 2 GREEN LED blinks \r\nGGGGGGGGGGG!");
+            wait(1);
+
            Led2.LedOn();
            Delay_Nonsense(&BlueDelay, &TargetCount);
            wait_ms(xDelay);
@@ -110,6 +121,11 @@
           wait_ms(xDelay);
        }
        {
+            lcd.cls();
+            lcd.locate(0,3);
+            lcd.printf("Thread 3 BLUE LED blinks \r\nxxxxxxxxxx!");
+            wait(1);
+
            Led3.LedOn();
            Delay_Nonsense(&BlueDelay, &TargetCount);
            wait_ms(xDelay);
@@ -134,8 +150,8 @@
 
 // https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/tasks/rtos/#thread
 
-Thread thread1(osPriorityNormal, DEFAULT_STACK_SIZE, NULL);
-// Thread thread1;
+//Thread thread1(osPriorityRealtime, DEFAULT_STACK_SIZE, NULL);
+Thread thread1;
 Thread thread2;
 Thread thread3;
 // parametrisierter Thread