HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
Loading...
Searching...
No Matches
hf_can_message_t Struct Reference

Platform-agnostic CAN message structure. More...

#include <BaseCan.h>

Public Member Functions

 hf_can_message_t () noexcept
 
constexpr hf_u8_t GetMaxDataLength () const noexcept
 Get maximum data length for current frame type.
 
bool IsValidDLC (hf_u8_t dlc) const noexcept
 Validate DLC for current frame type.
 
hf_u8_t GetEffectiveDLC () const noexcept
 Get effective DLC for the current frame type.
 
bool SetDLC (hf_u8_t dlc) noexcept
 Set data length code for current frame type.
 
void SetStandardFrame () noexcept
 Set standard frame format (11-bit ID)
 
void SetExtendedFrame () noexcept
 Set extended frame format (29-bit ID)
 
void SetDataFrame () noexcept
 Set data frame (not remote)
 
void SetRemoteFrame () noexcept
 Set remote frame.
 
void SetSingleShot () noexcept
 Set single shot transmission.
 
void SetSelfReception () noexcept
 Set self reception request.
 
bool IsValidId () const noexcept
 Validate message ID for current frame format.
 

Public Attributes

hf_u32_t id
 Message ID (11 or 29-bit)
 
hf_u8_t dlc
 Data length code (0-8 for classic CAN)
 
hf_u8_t data [8]
 Message data (max 8 bytes for classic CAN)
 
bool is_extended
 Extended ID flag (29-bit vs 11-bit)
 
bool is_rtr
 Remote transmission request flag.
 
bool is_ss
 Single shot flag (no retransmission)
 
bool is_self
 Self reception request flag.
 
bool dlc_non_comp
 DLC is non-compliant (> 8 for classic CAN)
 
hf_u64_t timestamp_us
 Precise timestamp in microseconds.
 
hf_u32_t sequence_number
 Message sequence number.
 
hf_u8_t controller_id
 Originating controller ID.
 
hf_u8_t retry_count
 Number of transmission retries.
 
hf_u8_t error_count
 Associated error count.
 
bool is_canfd
 CAN-FD frame flag.
 
bool is_brs
 Bit Rate Switching flag (CAN-FD)
 
bool is_esi
 Error State Indicator flag (CAN-FD)
 
hf_u8_t canfd_dlc
 CAN-FD DLC (can be > 8)
 

Detailed Description

Platform-agnostic CAN message structure.

Comprehensive CAN message format with standard flags and metadata. Supports both standard (11-bit) and extended (29-bit) identifiers, with complete transmission control and diagnostic information.

Constructor & Destructor Documentation

◆ hf_can_message_t()

hf_can_message_t::hf_can_message_t ( )
inlinenoexcept

Member Function Documentation

◆ GetEffectiveDLC()

hf_u8_t hf_can_message_t::GetEffectiveDLC ( ) const
inlinenoexcept

Get effective DLC for the current frame type.

Returns
DLC value to use (canfd_dlc for CAN-FD, dlc for classic)

◆ GetMaxDataLength()

constexpr hf_u8_t hf_can_message_t::GetMaxDataLength ( ) const
inlineconstexprnoexcept

Get maximum data length for current frame type.

Returns
Maximum allowed data length (8 for classic CAN, up to 64 for CAN-FD)

◆ IsValidDLC()

bool hf_can_message_t::IsValidDLC ( hf_u8_t dlc) const
inlinenoexcept

Validate DLC for current frame type.

Parameters
dlcData length code to validate
Returns
true if valid for the frame type, false otherwise

◆ IsValidId()

bool hf_can_message_t::IsValidId ( ) const
inlinenoexcept

Validate message ID for current frame format.

Returns
true if valid, false otherwise

◆ SetDataFrame()

void hf_can_message_t::SetDataFrame ( )
inlinenoexcept

Set data frame (not remote)

◆ SetDLC()

bool hf_can_message_t::SetDLC ( hf_u8_t dlc)
inlinenoexcept

Set data length code for current frame type.

Parameters
dlcData length code to set
Returns
true if valid and set, false otherwise

◆ SetExtendedFrame()

void hf_can_message_t::SetExtendedFrame ( )
inlinenoexcept

Set extended frame format (29-bit ID)

◆ SetRemoteFrame()

void hf_can_message_t::SetRemoteFrame ( )
inlinenoexcept

Set remote frame.

◆ SetSelfReception()

void hf_can_message_t::SetSelfReception ( )
inlinenoexcept

Set self reception request.

◆ SetSingleShot()

void hf_can_message_t::SetSingleShot ( )
inlinenoexcept

Set single shot transmission.

◆ SetStandardFrame()

void hf_can_message_t::SetStandardFrame ( )
inlinenoexcept

Set standard frame format (11-bit ID)

Member Data Documentation

◆ canfd_dlc

hf_u8_t hf_can_message_t::canfd_dlc

CAN-FD DLC (can be > 8)

◆ controller_id

hf_u8_t hf_can_message_t::controller_id

Originating controller ID.

◆ data

hf_u8_t hf_can_message_t::data[8]

Message data (max 8 bytes for classic CAN)

◆ dlc

hf_u8_t hf_can_message_t::dlc

Data length code (0-8 for classic CAN)

◆ dlc_non_comp

bool hf_can_message_t::dlc_non_comp

DLC is non-compliant (> 8 for classic CAN)

◆ error_count

hf_u8_t hf_can_message_t::error_count

Associated error count.

◆ id

hf_u32_t hf_can_message_t::id

Message ID (11 or 29-bit)

◆ is_brs

bool hf_can_message_t::is_brs

Bit Rate Switching flag (CAN-FD)

◆ is_canfd

bool hf_can_message_t::is_canfd

CAN-FD frame flag.

◆ is_esi

bool hf_can_message_t::is_esi

Error State Indicator flag (CAN-FD)

◆ is_extended

bool hf_can_message_t::is_extended

Extended ID flag (29-bit vs 11-bit)

◆ is_rtr

bool hf_can_message_t::is_rtr

Remote transmission request flag.

◆ is_self

bool hf_can_message_t::is_self

Self reception request flag.

◆ is_ss

bool hf_can_message_t::is_ss

Single shot flag (no retransmission)

◆ retry_count

hf_u8_t hf_can_message_t::retry_count

Number of transmission retries.

◆ sequence_number

hf_u32_t hf_can_message_t::sequence_number

Message sequence number.

◆ timestamp_us

hf_u64_t hf_can_message_t::timestamp_us

Precise timestamp in microseconds.


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