环境:
- SDK:simplelink_cc13x2_26x2_sdk_4_20_01_04
- IDE:Code Composer Studio, Version: 10.0.0.00010
- 例程:simple_peripheral_oad_offchip_CC26X2R1_LAUNCHXL_tirtos_ccs
新建了一个任务,使用如下方式创建队列:
userMsgQueueHandle = Util_constructQueue(&userMsgQueue);
然后在定时器中周期发送队列,发送函数如下:
status_t user_task_enqueueMsg(UserEvent_e event, void *pData) {uint8_t success;userEvt_t *pMsg = ICall_malloc(sizeof(userEvt_t));// Create dynamic pointer to message.if (pMsg){pMsg->event = event;pMsg->pData = pData;// Enqueue the message.success = Util_enqueueMsg(userMsgQueueHandle, userEvent,(uint8_t*) pMsg);Debug("user_task_enqueueMsg = %s", success ?"SUCCESS":"FAILURE");return (success) ? SUCCESS : FAILURE;}return (bleMemAllocError); }
Debug("user_task_enqueueMsg = %s", success ?"SUCCESS":"FAILURE"); 打印 “SUCCESS”
[10:14:58:683]user_task_enqueueMsg = SUCCESS [10:14:58:688] [10:14:59:683]SimplePeripheral_performPeriodicTask [10:14:59:687] [10:15:00:683]user_task_enqueueMsg = SUCCESS
为什么任务收不到队列消息呢?
Viki Shi:
建议先看一下这边的文档了解TI RTOS中队列的操作及实现:dev.ti.com/…/queues.html
Kevin Qiu1:
看下这里创建队列的示例:C:/ti/simplelink_cc13x2_26x2_sdk_4_20_01_04/docs/ble5stack/ble_user_guide/html/ble-stack-tirtos/queues.html