jianghuai/HARDWARE/CAN/bsp_can.h
2024-05-07 09:36:09 +08:00

63 lines
933 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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