![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Purpose: Simple application example with 2 threads and mutual-exclusion (Mutex) to a shared ressource (a bargraph). Target: L432KC / Nboard (from IUT-Cachan) Tested: yes Author: Jacques-Olivier Klein - IUT de CACHAN Date: 2018-02-10 DEFAULT_STACK_SIZE=2048 Libraries: mbed-os rev2741:bcf7085(26-feb-2017) + IHMV1 (from IUT-Cachan) rev4:a9e51ac(05-jan-2017)
Revision 29:8b329367eec8, committed 2019-01-09
- Comitter:
- jacquesolivierklein
- Date:
- Wed Jan 09 12:26:21 2019 +0000
- Parent:
- 28:e31f8871791d
- Commit message:
- update for mbed-os-5.11 (and IHM-V2)
Changed in this revision
--- a/IHM_V1.lib Sun Feb 11 08:55:28 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://developer.mbed.org/teams/NBoard/code/IHM_V1/#a9e51ac904e2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IHM_V2.lib Wed Jan 09 12:26:21 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/NBoard/code/IHM_V2/#ad91067e3f6d
--- a/main.cpp Sun Feb 11 08:55:28 2018 +0000 +++ b/main.cpp Wed Jan 09 12:26:21 2019 +0000 @@ -1,6 +1,6 @@ // Title: mbed-os-mutex // Author: Jacques-Olivier Klein - IUT de CACHAN -// Date: 2018-02-10 +// Date: 2018-02-10 rev. 2019-01-06 #include "mbed.h" #include "IHM.h" @@ -24,15 +24,15 @@ { ihm.LCD_clear(); ihm.LCD_printf("Mutex-%s %s",__DATE__,__TIME__); printf("\n\rmbed-os-mutex-%s %s\n\r",__DATE__,__TIME__); - printf(" DEFAULT_STACK_SIZE:%d\n\r", DEFAULT_STACK_SIZE); + printf(" OS_STACK_SIZE:%d\n\r", OS_STACK_SIZE); Thread_bargraph_up_counter.start(bargraph_up_counter); Thread_bargraph_down_counter.start(bargraph_down_counter); while(1){ - Thread::wait(4000); + wait(4.000); L0=!L0; - printf(" [pid-%d]Main \n\r",Thread::gettid()); + printf(" [pid-%d]Main \n\r",osThreadGetId()); } } @@ -43,7 +43,7 @@ L1=1; for(up_counter = 1; up_counter != 0xFF; up_counter = (up_counter<<1)|1){ ihm.BAR_set(up_counter); - Thread::wait(200); + wait(0.200); } bargraph_mutex.unlock(); L1=0; @@ -58,7 +58,7 @@ for(down_counter = 0x80; down_counter != 0xFF; down_counter = (down_counter>>1)|0x80){ ihm.BAR_set(down_counter); - Thread::wait(200); + wait(0.200); } bargraph_mutex.unlock(); L2=0;
--- a/mbed-os.lib Sun Feb 11 08:55:28 2018 +0000 +++ b/mbed-os.lib Wed Jan 09 12:26:21 2019 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#bcf7085d85b2811b5d68bdda192c754eadfb8f88 +https://github.com/ARMmbed/mbed-os/#c966348d3f9ca80843be7cdc9b748f06ea73ced0
--- a/readme.txt Sun Feb 11 08:55:28 2018 +0000 +++ b/readme.txt Wed Jan 09 12:26:21 2019 +0000 @@ -4,9 +4,12 @@ mutual-exclusion (Mutex) to a shared ressource (a bargraph). Target: L432KC / Nboard (from IUT-Cachan) -Tested: yes +Tested: YES (2019-01-09) Author: Jacques-Olivier Klein - IUT de CACHAN -Date: 2018-02-10 -DEFAULT_STACK_SIZE=2048 -Libraries: mbed-os rev2741:bcf7085(26-feb-2017) - + IHMV1 (from IUT-Cachan) rev4:a9e51ac(05-jan-2017) +Date: 2018-02-10 rev. 2019-01-09 +OS_STACK_SIZE=4096 +Libraries: mbed-os rev5345:c966348(03jan2019) + IHMV2 (from IUT-Cachan) rev6:ad91067 + +2019-01-06 : update mbed-os, IHMV1->V2, Thread::wait(int ms)-> wait(float s), +ThreadGettid->osThreadGetId, DEFLAULT_STACK_SIZE -> OS_STACK_SIZE, +L432KC Firmare update (ST-LINK) -> test OK. \ No newline at end of file