Oliver Ainhirn
/
82_Thread_HSA_Mutex
MUTEX_Display
Revision 1:98ffcc251be8, committed 2019-03-21
- Comitter:
- corsa1600
- Date:
- Thu Mar 21 18:13:40 2019 +0000
- Parent:
- 0:ac644277eadb
- Commit message:
- Mutex
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r ac644277eadb -r 98ffcc251be8 main.cpp --- a/main.cpp Thu Mar 21 16:53:36 2019 +0000 +++ b/main.cpp Thu Mar 21 18:13:40 2019 +0000 @@ -57,6 +57,9 @@ Rgb Led1(p23); Rgb Led2(p24); Rgb Led3(p25); + + +Mutex LCDMutex; // hier wird der Mutex instanziiert //void Led1_Blink(void *pvParameters) void Led1_Blink() // red long @@ -69,7 +72,8 @@ for(int i = 0; i < 10; i++) { // randomnes wait_ms(xDelay); } - + // kritischer abschnitt!!! dieser soll mit Mutex behandelt werden + LCDMutex.lock();// Mutex beginnt { lcd.cls(); lcd.locate(0,3); @@ -82,6 +86,7 @@ Delay_Nonsense(&BlueDelay, &TargetCount); wait_ms(xDelay); } + LCDMutex.unlock(); // Mutex endet } } @@ -95,6 +100,7 @@ for(int i = 0; i < 10; i++) { // randomnes wait_ms(xDelay); } + LCDMutex.lock();// Mutex beginnt { lcd.cls(); lcd.locate(0,3); @@ -107,6 +113,7 @@ Delay_Nonsense(&BlueDelay, &TargetCount); wait_ms(xDelay); } + LCDMutex.unlock(); // Mutex endet } } @@ -120,6 +127,7 @@ for(int i = 0; i < 10; i++) { // randomnes wait_ms(xDelay); } + LCDMutex.lock();// Mutex beginnt { lcd.cls(); lcd.locate(0,3); @@ -133,6 +141,7 @@ Delay_Nonsense(&BlueDelay, &TargetCount); wait_ms(xDelay); } + LCDMutex.unlock(); // Mutex endet } }