libxr 1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::FDCAN Class Referenceabstract

FDCAN 通信接口,扩展 CAN 功能,支持灵活数据速率(FD)CAN 消息 (FDCAN communication interface that extends CAN functionality by supporting Flexible Data-Rate (FD) CAN messages). More...

#include <can.hpp>

Inheritance diagram for LibXR::FDCAN:
Collaboration diagram for LibXR::FDCAN:

Public Member Functions

 FDCAN (const char *name_tp="can", const char *name_fd_tp="fdcan", Topic::Domain *domain=nullptr)
 构造 FDCAN 对象,可指定主题名称和通信域 (Constructs an FDCAN object with optional topic names and domain).
 
struct __attribute__ ((packed))
 FD CAN 消息结构 (Structure representing an FD CAN message).
 
virtual ErrorCode AddMessage (const FDPack &pack)=0
 添加 FD CAN 消息到系统 (Adds an FD CAN message to the system).
 
virtual ErrorCode AddMessage (const ClassicPack &pack)=0
 添加 CAN 消息到系统 (Adds a CAN message to the system).
 
- Public Member Functions inherited from LibXR::CAN
 CAN (const char *name_tp="can", Topic::Domain *domain=nullptr)
 构造 CAN 对象,可指定主题名称和通信域 (Constructs a CAN object with an optional topic name and domain).
 
struct __attribute__ ((packed))
 经典 CAN 消息结构 (Structure representing a classic CAN message).
 

Data Fields

 FDPack
 
Topic fd_tp_
 FD CAN 消息的主题 (Topic for FD CAN messages).
 
- Data Fields inherited from LibXR::CAN
 ClassicPack
 
Topic classic_tp_
 经典 CAN 消息的主题 (Topic for classic CAN messages).
 

Additional Inherited Members

- Public Types inherited from LibXR::CAN
enum class  Type : uint8_t { STANDARD = 0 , EXTENDED = 1 , REMOTE_STANDARD = 2 , REMOTE_EXTENDED = 3 }
 CAN 消息类型 (Enumeration of CAN message types). More...
 

Detailed Description

FDCAN 通信接口,扩展 CAN 功能,支持灵活数据速率(FD)CAN 消息 (FDCAN communication interface that extends CAN functionality by supporting Flexible Data-Rate (FD) CAN messages).

Definition at line 63 of file can.hpp.

Constructor & Destructor Documentation

◆ FDCAN()

LibXR::FDCAN::FDCAN ( const char name_tp = "can",
const char name_fd_tp = "fdcan",
Topic::Domain domain = nullptr 
)
inline

构造 FDCAN 对象,可指定主题名称和通信域 (Constructs an FDCAN object with optional topic names and domain).

Parameters
name_tp经典 CAN 消息的主题名称 (Topic name for classic CAN messages).
name_fd_tpFD CAN 消息的主题名称 (Topic name for FD CAN messages).
domain可选的通信域 (Optional domain for message communication).

Definition at line 73 of file can.hpp.

75 : CAN(name_tp, domain), fd_tp_(name_fd_tp, sizeof(FDPack), domain, false, false)
76 {
77 }
CAN(const char *name_tp="can", Topic::Domain *domain=nullptr)
构造 CAN 对象,可指定主题名称和通信域 (Constructs a CAN object with an optional topic name and domain).
Definition can.hpp:33
Topic fd_tp_
FD CAN 消息的主题 (Topic for FD CAN messages).
Definition can.hpp:99
constexpr auto min(T1 a, T2 b) -> typename std::common_type< T1, T2 >::type
计算两个数的最小值

Member Function Documentation

◆ __attribute__()

struct LibXR::FDCAN::__attribute__ ( (packed )
inline

FD CAN 消息结构 (Structure representing an FD CAN message).

< 消息 ID (Message ID).

< 消息类型 (Message type).

< 数据长度,最大 64 字节 (Data length, up to 64 bytes).

< 数据载荷 (Data payload).

Definition at line 73 of file can.hpp.

83 {
84 uint32_t id;
85 Type type;
86 uint8_t len;
87 uint8_t data[64];
88 } FDPack;
Type
CAN 消息类型 (Enumeration of CAN message types).
Definition can.hpp:20

◆ AddMessage() [1/2]

virtual ErrorCode LibXR::CAN::AddMessage ( const ClassicPack &  pack)
virtual

添加 CAN 消息到系统 (Adds a CAN message to the system).

Parameters
pack经典 CAN 消息包 (The classic CAN message packet).
Returns
操作结果 (ErrorCode indicating success or failure).

Implements LibXR::CAN.

Reimplemented in LibXR::STM32CANFD.

◆ AddMessage() [2/2]

virtual ErrorCode LibXR::FDCAN::AddMessage ( const FDPack &  pack)
pure virtual

添加 FD CAN 消息到系统 (Adds an FD CAN message to the system).

Parameters
packFD CAN 消息包 (The FD CAN message packet).
Returns
操作结果 (ErrorCode indicating success or failure).

Implemented in LibXR::STM32CANFD.

Field Documentation

◆ fd_tp_

Topic LibXR::FDCAN::fd_tp_

FD CAN 消息的主题 (Topic for FD CAN messages).

Definition at line 99 of file can.hpp.

◆ FDPack

LibXR::FDCAN::FDPack

Definition at line 88 of file can.hpp.


The documentation for this class was generated from the following file: