修复裁判系统解析未定义的问题

This commit is contained in:
NeoZng 2022-12-05 22:10:08 +08:00
parent 6d4a0cb148
commit a235aec5df
2 changed files with 21 additions and 17 deletions

View File

@ -15,28 +15,13 @@ static referee_info_t referee_info;
static uint8_t Judge_Self_ID; // 当前机器人的ID
static uint16_t Judge_SelfClient_ID; // 发送者机器人对应的客户端ID
static void RefereeRxCallback()
{
JudgeReadData(referee_usart_instance->recv_buff);
}
referee_info_t *RefereeInit(UART_HandleTypeDef *referee_usart_handle)
{
USART_Init_Config_s conf;
conf.module_callback = RefereeRxCallback;
conf.usart_handle = referee_usart_handle;
conf.recv_buff_size = RE_RX_BUFFER_SIZE;
referee_usart_instance = USARTRegister(&conf);
return &referee_info;
}
/**
* @brief ,
* @param
* @retval
* @attention CRC校验,
*/
void JudgeReadData(uint8_t *ReadFromUsart)
static void JudgeReadData(uint8_t *ReadFromUsart)
{
uint16_t judge_length; // 统计一帧数据长度
// referee_info.CmdID = 0; //数据命令码解析
@ -121,4 +106,23 @@ void JudgeReadData(uint8_t *ReadFromUsart)
JudgeReadData(ReadFromUsart + sizeof(xFrameHeader) + LEN_CMDID + referee_info.FrameHeader.DataLength + LEN_TAIL);
}
}
}
/**
* @brief ,
*
*/
static void RefereeRxCallback()
{
JudgeReadData(referee_usart_instance->recv_buff);
}
referee_info_t *RefereeInit(UART_HandleTypeDef *referee_usart_handle)
{
USART_Init_Config_s conf;
conf.module_callback = RefereeRxCallback;
conf.usart_handle = referee_usart_handle;
conf.recv_buff_size = RE_RX_BUFFER_SIZE;
referee_usart_instance = USARTRegister(&conf);
return &referee_info;
}

View File

@ -344,7 +344,7 @@ typedef struct
#pragma pack()
/**
* @brief
* @brief ,
*
* @param referee_usart_handle
* @return referee_info_t*