This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2650 TI-RTOS 如何产生EVENT

Other Parts Discussed in Thread: CC2510, SIMPLELINK-CC13X0-SDK

一直没用过TI-RTOS,如何产生EVENT?

用况是这样的,我的定时器每10ms中断一次,我需要在中断中产生一个事件,然后去task中处理。

不同于free-RTOS,在网上找不到任何TI-RTOS这个方面的例程,尽管有文档,全是文字叙述。

有没有可供参考的例程?

此外,2650支持私有协议,但必须基于RTOS,又没有丰富的例程,把简单的事复杂了,而且RF部分的配置实时性还差,虽然是双模的,但在使用的简便性完全不如CC2510,除了处理速度快一点。

  • 首先,你需要创建一个event,例如

    /* Create event used internally for state changes */
    Event_Params eventParam;
    Event_Params_init(&eventParam);
    Event_construct(&concentratorEvent, &eventParam);
    concentratorEventHandle = Event_handle(&concentratorEvent);

    在你的user task中等待event的发生

    /* Wait for event */
    uint32_t events = Event_pend(concentratorEventHandle, 0, CONCENTRATOR_EVENT_ALL, BIOS_WAIT_FOREVER);

    然后,在你的中断处理或者callback函数中post对应event,例如

    static void packetReceivedCallback(union ConcentratorPacket* packet, int8_t rssi)
    {
    /* If we recived an ADC sensor packet, for backward compatibility */
    if (packet->header.packetType == RADIO_PACKET_TYPE_ADC_SENSOR_PACKET)
    {
    /* Save the values */
    latestActiveAdcSensorNode.address = packet->header.sourceAddress;
    latestActiveAdcSensorNode.latestAdcValue = packet->adcSensorPacket.adcValue;
    latestActiveAdcSensorNode.button = 0; //no button value in ADC packet
    latestActiveAdcSensorNode.latestRssi = rssi;

    Event_post(concentratorEventHandle, CONCENTRATOR_EVENT_NEW_ADC_SENSOR_VALUE);
    }
    /* If we recived an DualMode ADC sensor packet*/
    else if(packet->header.packetType == RADIO_PACKET_TYPE_DM_SENSOR_PACKET)
    {

    /* Save the values */
    latestActiveAdcSensorNode.address = packet->header.sourceAddress;
    latestActiveAdcSensorNode.latestAdcValue = packet->dmSensorPacket.adcValue;
    latestActiveAdcSensorNode.button = packet->dmSensorPacket.button;
    latestActiveAdcSensorNode.latestRssi = rssi;

    Event_post(concentratorEventHandle, CONCENTRATOR_EVENT_NEW_ADC_SENSOR_VALUE);
    }
    }

    以上代码示例都来自simplelink_cc13x0_sdk_1_00_00_13中的easylink\rfWsnConcentrator示例

    你可以在下面连接找到

    http://www.ti.com/tool/SIMPLELINK-CC13X0-SDK