高级会员
- 积分
- 826
- 金钱
- 826
- 注册时间
- 2017-6-18
- 在线时间
- 163 小时
|
楼主 |
发表于 2021-12-1 18:19:59
|
显示全部楼层
这个是队列接收代码;
/* USER CODE END Header_Main_TASK */
void Main_TASK(void *argument)
{
/* USER CODE BEGIN Main_TASK */
char str[256];
sprintf(str,"UART Init OK...\r\n");
HAL_UART_Transmit(&huart1,(uint8_t*)str,strlen(str),30);
/* Infinite loop */
for(;;)
{
char *pstr=NULL;
osStatus_t err=osOK;
sprintf(str,"_queue size: %d %d %d\r\n",osMessageQueueGetCapacity(rQueueHandle),osMessageQueueGetMsgSize(rQueueHandle),osMessageQueueGetCount(rQueueHandle));
HAL_UART_Transmit(&huart1,(uint8_t*)str,strlen(str),30);
err=osMessageQueueGet(rQueueHandle,pstr,0,0);
if(err==osOK)
{
sprintf(str,"Receive OK...\r\n");
HAL_UART_Transmit(&huart1,(uint8_t*)str,strlen(str),30);
}
osDelay(100);
}
/* USER CODE END Main_TASK */
} |
|