/*** * @Author: chenjie * @Date: 2022-06-06 * @LastEditTime: 2022-10-27 * @LastEditors: chenjie * @Description: * @FilePath: \S32K146_4G\code\app\AppTaskUart0.h * @Copyright (c) 2022 by chenjie, All Rights Reserved. */ #ifndef APPTASKUART0_H_ #define APPTASKUART0_H_ #include "hal_adapter.h" #include "AppFunclib.h" #include "AppGlobalVar.h" #ifdef APP_UART0_ENABLE #define BMS_ADDRESS_CODE 0x01 #define METER1_ADDRESS_CODE 0x04 #define UART_READ_CODE 0x04 #define UART_WRITE_CODE 0x06 #define UART_ENCRYPT_CODE 0x05 #define UART_WRITE_FLAG 0x01 #define UART_READ_FLAG 0x00 void Uart0Task(void *pvParameters); typedef struct _UartAnsType { uint8 BmsAdd; uint8 FunCode; uint8 Datalen; uint8 Data[300]; } UartAnsType; typedef enum { PROCESS_UART_STATE_IDLE = 0, PROCESS_UART_STATE_READ, PROCESS_UART_STATE_WRITE, PROCESS_UART_STATE_SLEEP } process_Uart0; typedef struct _UartQueryType { uint8 Bms_Address; uint8 Bms_Funcode; uint8 Reg_Begin_H; uint8 Reg_Begin_L; uint8 Reg_Num_H; uint8 Reg_Num_L; uint8 CRC_L; uint8 CRC_H; } UartQueryType; typedef struct _UartWriteMsgType { uint8 Bms_Address; uint8 Bms_Funcode; uint8 Reg_Begin_H; uint8 Reg_Begin_L; uint8 Reg_Num_H; uint8 Reg_Num_L; uint8 Data_Count; uint8 Data[2]; uint8 CRC_L; uint8 CRC_H; } UartWriteMsgType; #endif #endif /* APPTASKUART0_H_ */