bs_bcu_app/bsp/dsp_can.h

33 lines
1.1 KiB
C
Raw Normal View History

2024-11-20 15:33:37 +08:00
#ifndef __CAN_H
#define __CAN_H
2024-11-12 19:03:56 +08:00
2024-11-20 17:07:14 +08:00
#include "bsp_flash.h"
2024-11-20 15:33:37 +08:00
#include "bsp_can.h"
#include "bsp_delay.h"
2024-11-12 19:03:56 +08:00
#include "drv_sys.h"
2024-11-20 15:33:37 +08:00
2024-11-12 19:03:56 +08:00
/******************************************************************************************/
/* CAN <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
2024-11-20 15:33:37 +08:00
#define CAN_RX_GPIO_PORT GPIOB
#define CAN_RX_GPIO_PIN GPIO_PIN_12
#define CAN_RX_GPIO_CLK_ENABLE() do{ __HAL_RCC_GPIOB_CLK_ENABLE(); }while(0) /* PA<50><41>ʱ<EFBFBD><CAB1>ʹ<EFBFBD><CAB9> */
2024-11-12 19:03:56 +08:00
2024-11-20 15:33:37 +08:00
#define CAN_TX_GPIO_PORT GPIOB
#define CAN_TX_GPIO_PIN GPIO_PIN_13
#define CAN_TX_GPIO_CLK_ENABLE() do{ __HAL_RCC_GPIOB_CLK_ENABLE(); }while(0) /* PA<50><41>ʱ<EFBFBD><CAB1>ʹ<EFBFBD><CAB9> */
2024-11-12 19:03:56 +08:00
/******************************************************************************************/
/* CAN<41><4E><EFBFBD><EFBFBD>RX0<58>ж<EFBFBD>ʹ<EFBFBD><CAB9> */
#define CAN_RX0_INT_ENABLE 0 /* 0,<2C><>ʹ<EFBFBD><CAB9>; 1,ʹ<><CAB9>; */
/* <20><><EFBFBD><EFBFBD><EFBFBD>ӿں<D3BF><DABA><EFBFBD> */
uint8_t can_receive_msg(uint32_t id, uint8_t *buf); /* CAN<41><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>ѯ */
uint8_t can_send_msg(uint32_t id, uint8_t *msg, uint8_t len); /* CAN<41><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
uint8_t can_init(uint32_t tsjw,uint32_t tbs2,uint32_t tbs1,uint16_t brp,uint32_t mode); /* CAN<41><4E>ʼ<EFBFBD><CABC> */
#endif