RxFIFO.h 866 B

12345678910111213141516171819202122232425262728
  1. #ifndef _RXFIFO_H
  2. #define _RXFIFO_H
  3. #define CAN_RXBUFFER_SIZE (128U)
  4. #define NVIC_INTERRPUT_DISABLE // 自行定义
  5. #define NVIC_INTERRPUT_ENABLE // 自行定义
  6. typedef struct {
  7. uint32_t id;
  8. uint8_t dlc;
  9. uint8_t data[8];
  10. }can_message_t;
  11. typedef struct {
  12. uint16_t WriteIndex; /*The index of the frame that is currently receiving data*/
  13. uint16_t ReadIndex; /*Complete frame, read data start index*/
  14. uint16_t GotMsgNum; /*The number of complete frames received*/
  15. uint16_t BufferSize; /*The maximum number of frames the buffer can hold*/
  16. can_message_t *pBuffer; /*Buffer first address*/
  17. }RxFIFOCtrl_t;
  18. extern RxFIFOCtrl_t RxFIFOCtrl;
  19. void pushRxFIFO(can_message_t can_message);
  20. int32_t popRxFIFO(can_message_t **can_message, uint8_t msglen);
  21. #endif /* _RXFIFO_H */