12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- /****************************************************************************
- *
- * 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;
- typedef struct Uart_Write_Data_Type
- {
- volatile uint8_t WriteCmd;
- uint8_t Data[2];
- }Uart_Write_Data_Type;
- //全局变量输出区
- extern UartReadMsgType UartReadMsg;
- extern osMutexId_t UartMutex;
- extern Uart_Write_Data_Type UartWriteData;
- //
- #define UART_WRITE_FLAG 0x01
- #define UART_READ_FLAG 0x00
- #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_L;
- uint8_t CRC_H;
- }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_L;
- uint8_t CRC_H;
- }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);
|