CAN frame abstraction for standard, extended and FD (and combinations thereof) CAN frames.
More...
#include <can.hpp>
|
void | SetData (const uint8_t *data, const std::size_t size) |
| Set data (data_len_ and data_ fields)
|
|
bool | RawToFrame (const uint8_t *data, const std::size_t size) |
| Populate frame (this struct) from raw data.
|
|
void | FrameToRaw () |
| Set raw CAN frame from frame (this struct)
|
|
|
uint32_t | can_id_ = 0 |
| CAN ID (masked by CAN_SFF_MASK resp CAN_EFF_MASK), i.e. flags removed)
|
|
bool | is_eff_ = false |
| true = extended frame (29 bits ID, CAN_EFF_FLAG), false = standard frame (11 bits ID)
|
|
bool | is_fd_ = false |
| true = CAN FD frame (up to CANFD_MAX_DLEN bytes), false = classical frame (up to CAN_MAX_DLEN bytes)
|
|
bool | rtr_flag_ = false |
| Remote transmission request flag (CAN_RTR_FLAG)
|
|
bool | err_flag_ = false |
| Error message frame flag (CAN_ERR_FLAG)
|
|
bool | fd_brs_ = false |
| Use bit rate switch for a FD frame (only valid if is_fd_ = true)
|
|
std::size_t | data_len_ = false |
| Number of bytes in payload data: up to CAN_MAX_DLEN for classical frames (is_fd_ = false), up to CANFD_MAX_DLEN for FD frames (is_fd_ = true)
|
|
const uint8_t * | data_ = { can_frame_.data } |
| Pointer to data (can_frame_.data resp. fd_frame_.data)
|
|
union { | |
|
struct can_frame can_frame_ | |
| Classical CAN frame (is_fd_ = false) More...
|
|
struct canfd_frame fd_frame_ = { 0, 0, 0, 0, 0, { 0 } } | |
| FD CAN frame (is_fd_ = true) More...
|
|
}; | | |
| Raw CAN frame.
|
|
CAN frame abstraction for standard, extended and FD (and combinations thereof) CAN frames.
Definition at line 89 of file can.hpp.
◆ SetData()
void fpsdk::common::can::CanFrame::SetData |
( |
const uint8_t * | data, |
|
|
const std::size_t | size ) |
Set data (data_len_ and data_ fields)
- Parameters
-
[in] | data | The data |
[in] | size | Size of the data |
◆ RawToFrame()
bool fpsdk::common::can::CanFrame::RawToFrame |
( |
const uint8_t * | data, |
|
|
const std::size_t | size ) |
Populate frame (this struct) from raw data.
On success, all the fields of the struct are set from the data.
- Parameters
-
[in] | data | The data (struct can_frame or struct canfd_frame) |
[in] | size | Size of the data (CAN_MTU or CANFD_MTU) |
- Returns
- true on success, false otherwise
◆ FrameToRaw()
void fpsdk::common::can::CanFrame::FrameToRaw |
( |
| ) |
|
Set raw CAN frame from frame (this struct)
Updates the raw CAN frame data (below) from the flags and data (above).
◆ can_id_
uint32_t fpsdk::common::can::CanFrame::can_id_ = 0 |
CAN ID (masked by CAN_SFF_MASK resp CAN_EFF_MASK), i.e. flags removed)
Definition at line 92 of file can.hpp.
◆ is_eff_
bool fpsdk::common::can::CanFrame::is_eff_ = false |
true = extended frame (29 bits ID, CAN_EFF_FLAG), false = standard frame (11 bits ID)
Definition at line 93 of file can.hpp.
◆ is_fd_
bool fpsdk::common::can::CanFrame::is_fd_ = false |
true = CAN FD frame (up to CANFD_MAX_DLEN bytes), false = classical frame (up to CAN_MAX_DLEN bytes)
Definition at line 94 of file can.hpp.
◆ rtr_flag_
bool fpsdk::common::can::CanFrame::rtr_flag_ = false |
Remote transmission request flag (CAN_RTR_FLAG)
Definition at line 95 of file can.hpp.
◆ err_flag_
bool fpsdk::common::can::CanFrame::err_flag_ = false |
Error message frame flag (CAN_ERR_FLAG)
Definition at line 96 of file can.hpp.
◆ fd_brs_
bool fpsdk::common::can::CanFrame::fd_brs_ = false |
Use bit rate switch for a FD frame (only valid if is_fd_ = true)
Definition at line 97 of file can.hpp.
◆ data_len_
std::size_t fpsdk::common::can::CanFrame::data_len_ = false |
Number of bytes in payload data: up to CAN_MAX_DLEN for classical frames (is_fd_ = false), up to CANFD_MAX_DLEN for FD frames (is_fd_ = true)
Definition at line 98 of file can.hpp.
◆ data_
const uint8_t* fpsdk::common::can::CanFrame::data_ = { can_frame_.data } |
Pointer to data (can_frame_.data resp. fd_frame_.data)
Definition at line 99 of file can.hpp.
◆ can_frame_
struct can_frame fpsdk::common::can::CanFrame::can_frame_ |
Classical CAN frame (is_fd_ = false)
Definition at line 134 of file can.hpp.
◆ fd_frame_
struct canfd_frame fpsdk::common::can::CanFrame::fd_frame_ = { 0, 0, 0, 0, 0, { 0 } } |
FD CAN frame (is_fd_ = true)
Definition at line 135 of file can.hpp.
The documentation for this struct was generated from the following file:
- fpsdk_common/include/fpsdk_common/can.hpp