/**************************************************************************** * * Copy right: Qx. * File name: UartTask.h * Description: 串口任务 * History: 2021-03-05 * ****************************************************************************/ typedef struct _UartRedMsg { bool UartFlag; UINT8 Header[3]; UINT8 data[120]; UINT16 len; }UartReadMsgType; //全局变量输出区 extern UartReadMsgType UartReadMsg; extern osMutexId_t UartMutex; // #define PROC_UART_TASK_STACK_SIZE (1024) #define BMS_ADDRESS_CODE 0x01 #define UART_READ_CODE 0x03 #define UART_WRITE_CODE 0x10 typedef struct Uart_Read_Msg_Type { uint8_t Bms_Address; uint8_t Bms_Funcode; uint8_t Reg_Begin_H; uint8_t Reg_Begin_L; uint8_t Reg_Num_H; uint8_t Reg_Num_L; uint8_t CRC_H; uint8_t CRC_L; }Uart_Read_Msg_Type; typedef struct Uart_Write_Msg_Type { uint8_t Bms_Address; uint8_t Bms_Funcode; uint8_t Reg_Begin_H; uint8_t Reg_Begin_L; uint8_t Reg_Num_H; uint8_t Reg_Num_L; uint8_t Data_Count; uint8_t Data[2]; uint8_t CRC_H; uint8_t CRC_L; }Uart_Write_Msg_Type; typedef struct Uart_Write_Answer_Msg_Type { uint8_t Bms_Address; uint8_t Bms_Funcode; }Uart_Write_Answer_Msg_Type; typedef enum { PROCESS_UART_STATE_IDLE = 0, PROCESS_UART_STATE_READ, PROCESS_UART_STATE_WRITE, PROCESS_UART_STATE_SLEEP }process_Uart; void UartTaskInit(void* arg); void UartTaskDeInit(void* arg);