移除sys/flash.h、sys/flash.cpp、sys/initial.h和sys/OTA相关文件的 引用,清理cproject.yml和cbuild.yml中的未使用组件和文件配置。 BREAKING CHANGE: 移除了FlashEEPROM相关功能和接口。
48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
#ifndef _CAN_H
|
|
#define _CAN_H
|
|
|
|
#include <stdint.h>
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "gd32c10x_can.h"
|
|
#include "stdint.h"
|
|
#include <stdio.h>
|
|
|
|
u8 can_gpio_init(void); // CAN引脚初始化
|
|
void canfd_config(void); // CANFD初始化
|
|
void can_dma_init(void); // CAN DMA初始化
|
|
void CAN0_RX0_IRQHandler(void); // CAN接收中断处理函数
|
|
void DMA0_Channel4_IRQHandler(void); // DMA通道4中断处理函数(CAN接收)
|
|
void DMA0_Channel5_IRQHandler(void); // DMA通道5中断处理函数(CAN发送)
|
|
/*!
|
|
\brief CAN通信类
|
|
\note 封装CAN发送和接收功能
|
|
*/
|
|
class CAN_transmiter {
|
|
|
|
private:
|
|
can_trasnmit_message_struct transmit_message; // 发送消息结构体
|
|
u8 transmit_mailbox = CAN_NOMAILBOX; // 初始化为无mailbox状态
|
|
u8 transmit_data[64]; // CANFD最大64字节
|
|
|
|
public:
|
|
// 添加构造函数声明
|
|
u8 init(void);
|
|
|
|
can_receive_message_struct receive_message; // 接收消息结构体
|
|
FlagStatus can0_receive_flag; // CAN0接收标志
|
|
FlagStatus can0_send_flag; // CAN0发送标志
|
|
|
|
void communication_check(); // 通信检查
|
|
u8 CANFD_AsyncSend(u32 ID, u8 length, u8 *data); // CANFD异步发送(使用DMA)
|
|
u8 sendDATA_ACK(u32 packet_num, bool if_success);
|
|
u8 sendDATA_ACK(u32 packet_num, u8* data); // 恢复原函数签名
|
|
};
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif |