AppTaskUart0.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /***
  2. * @Author: chenjie
  3. * @Date: 2022-06-06
  4. * @LastEditTime: 2022-10-27
  5. * @LastEditors: chenjie
  6. * @Description:
  7. * @FilePath: \S32K146_4G\code\app\AppTaskUart0.h
  8. * @Copyright (c) 2022 by chenjie, All Rights Reserved.
  9. */
  10. #ifndef APPTASKUART0_H_
  11. #define APPTASKUART0_H_
  12. #include "hal_adapter.h"
  13. #include "AppFunclib.h"
  14. #include "AppGlobalVar.h"
  15. #ifdef APP_UART0_ENABLE
  16. #define BMS_ADDRESS_CODE 0x01
  17. #define METER1_ADDRESS_CODE 0x04
  18. #define UART_READ_CODE 0x04
  19. #define UART_WRITE_CODE 0x06
  20. #define UART_ENCRYPT_CODE 0x05
  21. #define UART_WRITE_FLAG 0x01
  22. #define UART_READ_FLAG 0x00
  23. void Uart0Task(void *pvParameters);
  24. typedef struct _UartAnsType
  25. {
  26. uint8 BmsAdd;
  27. uint8 FunCode;
  28. uint8 Datalen;
  29. uint8 Data[300];
  30. } UartAnsType;
  31. typedef enum
  32. {
  33. PROCESS_UART_STATE_IDLE = 0,
  34. PROCESS_UART_STATE_READ,
  35. PROCESS_UART_STATE_WRITE,
  36. PROCESS_UART_STATE_SLEEP
  37. } process_Uart0;
  38. typedef struct _UartQueryType
  39. {
  40. uint8 Bms_Address;
  41. uint8 Bms_Funcode;
  42. uint8 Reg_Begin_H;
  43. uint8 Reg_Begin_L;
  44. uint8 Reg_Num_H;
  45. uint8 Reg_Num_L;
  46. uint8 CRC_L;
  47. uint8 CRC_H;
  48. } UartQueryType;
  49. typedef struct _UartWriteMsgType
  50. {
  51. uint8 Bms_Address;
  52. uint8 Bms_Funcode;
  53. uint8 Reg_Begin_H;
  54. uint8 Reg_Begin_L;
  55. uint8 Reg_Num_H;
  56. uint8 Reg_Num_L;
  57. uint8 Data_Count;
  58. uint8 Data[2];
  59. uint8 CRC_L;
  60. uint8 CRC_H;
  61. } UartWriteMsgType;
  62. #endif
  63. #endif /* APPTASKUART0_H_ */