Why we must use a mutex to access the GLCD
How to do it…
To access the GLCD using mutual exclusion, follow the steps outlined:
- Create a new project and using the manager configure the RTE to provide support for the Graphic LCD.
- Create a new file named
RTXBlinky.c
, add the boilerplate code, and then add this source file to the project. - Add the following code to
RTXBlinky.c
:#include "stm32f4xx_hal.h" /* STM32F4xx Defs */ #include "RTXBlinkyUtils.h" #include "cmsis_os.h" osThreadId tid_taskA; /* id of thread: task_a */ osThreadId tid_taskB; /* id of thread: task_b */ osMutexId mut_GLCD; /* Mutex to control GLCD access */ /*-------------------------------------------------- * Switch LED on *--------------------------------------------------*/ void switch_On ...
Get ARM® Cortex® M4 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.