#include <canfd.h>
|
| | CANFD () |
| | 构造函数(配置socket(默认为“can0”)、配置fliters(filter配置直接在源码中更改))
|
| |
| | ~CANFD () |
| | 析构函数(销毁CANFD句柄)
|
| |
| void | fdRead (char *p_data) |
| | 读取CANFD收到的数据。
|
| |
| void | fdWrite (unsigned int can_id_standard, unsigned int flags, char *p_data, unsigned int length_data) |
| | CANFD发送数据。
|
| |
linux-CANFD read and write!
Definition at line 41 of file canfd.h.
◆ CANFD()
构造函数(配置socket(默认为“can0”)、配置fliters(filter配置直接在源码中更改))
- Note
- CANFD扩展帧,最大支持数据64个字节。
- Warning
- 内核中配置部分暂未找到合适的,使用前请配置好CANFD,例如终端使用:sudo ip link set can0 up type can bitrate 1000000 sample-point 0.8 dbitrate 5000000 dsample-point 0.7 fd on
Definition at line 14 of file canfd.cpp.
◆ ~CANFD()
析构函数(销毁CANFD句柄)
Definition at line 59 of file canfd.cpp.
◆ fdRead()
| void CANFD::fdRead |
( |
char * | p_data | ) |
|
读取CANFD收到的数据。
- Note
- 该函数使用到内核read,为阻塞函数,用户不必担心cpu资源的损耗,直接while循环读即可。
- Parameters
-
| p_data | 用户数据buf,CANFD收到数据后,放入用户的数据buf。 |
- Return values
-
Definition at line 70 of file canfd.cpp.
◆ fdWrite()
| void CANFD::fdWrite |
( |
unsigned int | can_id_standard, |
|
|
unsigned int | flags, |
|
|
char * | p_data, |
|
|
unsigned int | length_data ) |
CANFD发送数据。
- Note
- CANFD扩展帧,最大支持数据64个字节。
- Warning
- 未进行波特率等基础配置,使用前确认这些配置正常,参考构造函数注解!
- Parameters
-
| can_id_standard | CANFD-id |
| flags | 默认为0 |
| p_data | 数据指针指向需要发送的数据buf |
| length_data | 需要发送的数据长度。 |
- Return values
-
Definition at line 106 of file canfd.cpp.
The documentation for this class was generated from the following files: