simple semaphore demo with lpc4337 board
Dependencies: ST7567 lpc4337_mbed_os_semaphore_demo
Dependents: lpc4337_mbed_os_semaphore_demo
Diff: main.cpp
- Revision:
- 2:4989b5396fb9
- Parent:
- 0:d767141a0a9c
--- a/main.cpp Wed Sep 28 16:28:49 2016 +0000 +++ b/main.cpp Thu Sep 29 01:09:06 2016 +0000 @@ -50,12 +50,16 @@ for(;;) { - /* dsiplay the semaphore status */ + /* display the semaphore status */ disp.locate((sizeof(lp_message) * FONT_WIDTH), FONT_HEIGHT * 4); disp.printf("WAIT!"); disp.locate((sizeof(rt_message) * FONT_WIDTH), FONT_HEIGHT * 2); disp.printf("TOOK!"); + + /* put a dumming process in order to consume CPU */ + for(int i = 0; i < 0x3FFFFFF; i++) (void)0; + rt_sema.wait(); } @@ -78,6 +82,10 @@ disp.locate((sizeof(hp_message) * FONT_WIDTH), FONT_HEIGHT * 3); disp.printf("TOOK!"); + + /* put a dumming process in order to consume CPU */ + for(int i = 0; i < 0x3FFFFFF; i++) (void)0; + hp_sema.wait(); } } @@ -104,6 +112,7 @@ disp.printf("WAIT!"); disp.locate((sizeof(lp_message) * FONT_WIDTH), FONT_HEIGHT * 4); disp.printf("RUNN!"); + Thread::wait(1000); hp_sema.release(); @@ -111,6 +120,7 @@ disp.printf("WAIT!"); disp.locate((sizeof(lp_message) * FONT_WIDTH), FONT_HEIGHT * 4); disp.printf("RUNN!"); + Thread::wait(1000); } }