hal_can.h 1023 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef __HAL_CAN_H__
  2. #define __HAL_CAN_H__
  3. #include "hc32_ll_mcan.h"
  4. #include "hc32_ll_fcg.h"
  5. #include "hc32_ll_clk.h"
  6. #include "hc32_ll_interrupts.h"
  7. #include "hc32_ll_gpio.h"
  8. #include "string.h"
  9. #include "FreeRTOS.h"
  10. #include "queue.h"
  11. #define MSG_RECEIVE_ID_UDS 0x1C00EDEA
  12. #define MSG_SEND_ID_UDS 0x1C00EAED
  13. #define MSG_RECEIVE_ID_EXTD 0X18DA5541
  14. #define MSG_SEND_ID_EXTD 0X18DA4155
  15. #define MSG_RECEIVE_ID_STD 0X7B0
  16. #define MSG_SEND_ID_STD 0X7B8
  17. #define VER_MAJOR_H 0X01
  18. #define VER_MAJOR_L 0X00
  19. #define VER_SLAVE_H 0X01
  20. #define VER_SLAVE_L 0X00
  21. typedef struct
  22. {
  23. uint8_t ide;
  24. uint8_t len;
  25. uint32_t id;
  26. uint8_t data[8];
  27. }hc32_can_rx_msg_t;
  28. void bsp_can1_init(void);
  29. void bsp_can2_init(void);
  30. extern QueueHandle_t can1_recieve_data_queue;
  31. extern QueueHandle_t can2_recieve_data_queue;
  32. extern QueueHandle_t can1_send_data_queue;
  33. extern QueueHandle_t can2_send_data_queue;
  34. int32_t can_send_msg(CM_MCAN_TypeDef *MCANx,stc_mcan_tx_msg_t *pTxMsg);
  35. #endif