UartTask.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /****************************************************************************
  2. *
  3. * Copy right: Qx.
  4. * File name: UartTask.h
  5. * Description: 串口任务
  6. * History: 2021-03-05
  7. *
  8. ****************************************************************************/
  9. #define PROC_UART_TASK_STACK_SIZE (1024)
  10. #define UART_READ_CODE 0x03
  11. #define UART_WRITE_CODE 0x10
  12. #define BMS_ADDRESS_CODE 0x01
  13. typedef struct Uart_Read_Msg_Type
  14. {
  15. uint8_t Bms_Address;
  16. uint8_t Bms_Funcode;
  17. uint8_t Reg_Begin_H;
  18. uint8_t Reg_Begin_L;
  19. uint8_t Reg_Num_H;
  20. uint8_t Reg_Num_L;
  21. uint8_t CRC_H;
  22. uint8_t CRC_L;
  23. }Uart_Read_Msg_Type;
  24. typedef struct Uart_Write_Msg_Type
  25. {
  26. uint8_t Bms_Address;
  27. uint8_t Bms_Funcode;
  28. uint8_t Reg_Begin_H;
  29. uint8_t Reg_Begin_L;
  30. uint8_t Reg_Num_H;
  31. uint8_t Reg_Num_L;
  32. uint8_t Data_Count;
  33. uint8_t Data[2];
  34. uint8_t CRC_H;
  35. uint8_t CRC_L;
  36. }Uart_Write_Msg_Type;
  37. typedef struct Uart_Write_Answer_Msg_Type
  38. {
  39. uint8_t Bms_Address;
  40. uint8_t Bms_Funcode;
  41. }Uart_Write_Answer_Msg_Type;
  42. typedef enum
  43. {
  44. PROCESS_UART_STATE_IDLE = 0,
  45. PROCESS_UART_STATE_CHECK,
  46. PROCESS_UART_STATE_WORK,
  47. PROCESS_UART_STATE_SLEEP
  48. }process_Uart;
  49. void UartTaskInit(void* arg);
  50. void UartTaskDeInit(void* arg);