shoot/User/task/can_task.c

37 lines
831 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* can发送与解码任务
*/
#include "can_task.h"
#include "TopDefine.h"
#include "attrTask.h"
#include "djiMotor.h"
extern motor_measure_t *motor_3508_data;
/**
* \brief can任务
*
* \param argument 未使用
*/
void Task_Can(void *argument)
{
(void)argument; /* 未使用argument消除警告 */
const uint32_t delay_tick = osKernelGetTickFreq() / TASK_FREQ_CAN;
djiInit();//FIFO滤波器初始化
Odrive_Can_Init();
uint32_t tick = osKernelGetTickCount(); /* 控制任务运行频率的计算 */
while(1)
{
waitNewDji();//等待新数据
djiMotorEncode();//数据解析
//将can数据添加到消息队列
tick += delay_tick; /* 计算下一个唤醒时刻 */
osDelayUntil(tick); /* 运行结束,等待下一个周期唤醒 */
}
}