Queue-based application [STM32 and FreeRTOS].
This application combines a task and a queue. This program is not practical, but it is a sample program for learning to understand the concept of queues in an easy-to-understand way.
In the initial setting, xQueue = xQueueCreate(16, sizeof (int8_t)) is executed to allocate 16 queues.
In the first task, the command ("start@") is entered and 10 queues are passed sequentially when the conditions for establishment are met. The cycle time of the task is set short at 10 ms.
The second task displays strings according to the order of the queue. The cycle of the task is set longer at 500 ms for display purposes.
The functions of the sample program can be summarized as below.
When the program is started, it waits for a command code, so give the code "start@" from the terminal software on the PC. The STM microcontroller then sends 10 parameter IDs to the queue.
When IDs are sent to the queue, ID numbers are sequentially displayed according to the queue ID (ID display is sent to the PC side) in a task that executes the display according to the queue order (display in 500 ms cycles).
This program itself is not very meaningful from a practical standpoint, but it will help you understand the concept of queues.