CAN任务


void CAN_Task( void *pvParameters ){
    (void)pvParameters;

    //frame buffer
    CAN_frame_t __RX_frame;

    //create CAN RX Queue
    CAN_cfg.rx_queue = xQueueCreate(10,sizeof(CAN_frame_t));

    //start CAN Module
    CAN_init();
    DEBUG_LOGI(LOGTAG,"Can Init done - wait now..\n");
    while (1){
        //receive next CAN frame from queue
        if(xQueueReceive(CAN_cfg.rx_queue,&__RX_frame, 3*portTICK_PERIOD_MS)==pdTRUE){
            DEBUG_LOGI(LOGTAG,"Frame from : 0x%08x, DLC %d \n", __RX_frame.MsgID, __RX_frame.FIR.B.DLC);
            DEBUG_LOGI(LOGTAG,"D0: 0x%02x, ", __RX_frame.data.u8[0]);
            DEBUG_LOGI(LOGTAG,"D1: 0x%02x, ", __RX_frame.data.u8[1]);
            DEBUG_LOGI(LOGTAG,"D2: 0x%02x, ", __RX_frame.data.u8[2]);
            DEBUG_LOGI(LOGTAG,"D3: 0x%02x, ", __RX_frame.data.u8[3]);
            DEBUG_LOGI(LOGTAG,"D4: 0x%02x, ", __RX_frame.data.u8[4]);
            DEBUG_LOGI(LOGTAG,"D5: 0x%02x, ", __RX_frame.data.u8[5]);
            DEBUG_LOGI(LOGTAG,"D6: 0x%02x, ", __RX_frame.data.u8[6]);
            DEBUG_LOGI(LOGTAG,"D7: 0x%02x\n", __RX_frame.data.u8[7]);
            DEBUG_LOGI(LOGTAG,"==============================================================================\n");

            //loop back frame
            // CAN_write_frame(&__RX_frame);
        }
    }
}

```php(语言类型选填)
<?php echo 'hello jrotty!'; ?>


删除上边代码中的
Last modification:November 9th, 2019 at 02:03 am
如果觉得我的文章对你有用,请随意赞赏