63 lines
933 B
C
63 lines
933 B
C
#ifndef __BSP_CAN_H
|
||
#define __BSP_CAN_H
|
||
#include "sys.h"
|
||
|
||
#include "stm32f10x.h"
|
||
#include "stm32f10x_can.h"
|
||
|
||
|
||
//CAN接收RX0中断使能
|
||
#define CAN_RX0_INT_ENABLE 1 //0,不使能;1,使能.
|
||
|
||
u8 CAN_Mode_Init(void);//CAN初始化
|
||
|
||
u8 Can_Send_Msg(u8* msg,u8 len); //发送数据
|
||
|
||
u8 Can_Receive_Msg(u8 *buf); //接收数据
|
||
|
||
|
||
#define CAN_RX2_INT_ENABLE 1 //0,不使能;1,使能.
|
||
|
||
u8 CAN2_Mode_Init(void);//CAN初始化
|
||
|
||
u8 Can2_Send_Msg(u8* msg,u8 len); //发送数据
|
||
u8 Can2_Send_Message( CanTxMsg msg);
|
||
u8 Can2_Receive_Msg(u8 *buf); //接收数据
|
||
|
||
|
||
/**
|
||
* @brief: 处理bus off的recovery操作
|
||
*
|
||
* @param : void
|
||
*
|
||
* @return: void
|
||
*
|
||
* @remark: 自动恢复总线,可放在定时器或在循环内,其被执行的间隔不能超过10ms。
|
||
*/
|
||
void can_bus_off_recovery(void);
|
||
|
||
|
||
/**
|
||
* @brief: 打印 can 总线状态
|
||
*/
|
||
void can_bus_off_status_printf(void);
|
||
|
||
#endif
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|