You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
725 B

1 year ago
  1. #pragma once
  2. #include <stdint.h>
  3. #pragma pack(1)
  4. /**
  5. * @brief 12bit from,1bit emergency
  6. * H L
  7. * [1] [4bit] [8bit] [8bit] [4bit/4bit]
  8. * , from to frameNum/frameId
  9. */
  10. // 数值越大优先级越低
  11. typedef enum
  12. {
  13. kcmd,
  14. kreceipt,
  15. kerror_receipt,
  16. kreport,
  17. } packet_type_t;
  18. typedef enum
  19. {
  20. kpriority_emergency_report = 7,
  21. kpriority_cmd = 8,
  22. kpriority_receipt = 9,
  23. kpriority_report = 10,
  24. } priority_t;
  25. typedef struct
  26. {
  27. uint8_t frameNumAndFrameId;
  28. uint8_t to;
  29. uint8_t from;
  30. uint8_t pad;
  31. } zcanid_t;
  32. typedef struct
  33. {
  34. uint8_t ptype;
  35. uint8_t index;
  36. uint16_t function_id;
  37. uint8_t params[];
  38. } zcanbus_packet_t;
  39. #pragma pack()