Thread Sync Example

Dependencies:   C12832

Files at this revision

API Documentation at this revision

Comitter:
bulmecisco
Date:
Thu Mar 21 16:47:54 2019 +0000
Parent:
1:a477e0d640e0
Commit message:
Thread Sync Example

Changed in this revision

C12832.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832.lib	Thu Mar 21 16:47:54 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/chris/code/C12832/#7de323fa46fe
--- 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