»
(008) CubeIDE Implementation of USB Peripherals*
(018) C99 pointer*
(019) C99 With only value assignment*
(022) POSIX pthread multi-threads mutex*
(023) POSIX pthread multi-threads programming*
(027) C99 time and wait*
(028) High-precision calculation with GMP*
(029) Web Service Lib*
(030) International Components for Unicode (ICU)*
(031) Performance of C is higher than C++, because...*
🕹️(035) Message Queue in FreeRTOS
FreeRTOS中的消息队列:
//消息队列句柄
QueueHandle_t xQueue;
//消息元素
struct QueueItem_t{
uint32_t xContent;
}
//主函数中创建消息队列,容量为20个QueueItem
xQueue = xQueueCreate(20, sizeof(QueueItem_t));
//发送端任务
QueueItem_t data;
data.xContent=65535;
xQueueSend(xQueue,&data,portMAX_DELAY);
//接收端任务
QueueItem_t data;
xQueueReceive(xQueue,&data,portMAX_DELAY);
printf("received:::%ul",data.xContent);