/**
 * can发送与解码任务
*/
#include "TopDefine.h"
#include "userTask.h"
#include "encodeCan.hpp"
#include "djiMotor.h"

/**
 * \brief can任务
 *
 * \param argument 未使用
 */
void FunctionCan(void *argument) 
{
    (void)argument; /* 未使用argument，消除警告 */

    const uint32_t delay_tick = osKernelGetTickFreq() / TASK_FREQ_CAN;

    djiInit();

    uint32_t tick = osKernelGetTickCount();
    while(1)
    {
  #ifdef DEBUG
     task_struct.stack_water_mark.can = osThreadGetStackSpace(osThreadGetId()); 
    
  #endif 
        //waitNewDji();
        djiMotorEncode();
        can2MotorEncode();

        tick += delay_tick; /* 计算下一个唤醒时刻 */
        osDelayUntil(tick);
    }
}
