OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
Loading...
Searching...
No Matches
can_config_t Struct Reference

CAN bus transport configuration. More...

Data Fields

bool(* transmit_raw_can_frame )(can_msg_t *can_msg)
 Transmit a raw CAN frame. REQUIRED.
 
bool(* is_tx_buffer_clear )(void)
 Check if CAN TX hardware buffer can accept another frame. REQUIRED.
 
void(* lock_shared_resources )(void)
 Disable interrupts / acquire mutex for shared resource access. REQUIRED. Same function as openlcb_config_t.lock_shared_resources.
 
void(* unlock_shared_resources )(void)
 Re-enable interrupts / release mutex. REQUIRED. Same function as openlcb_config_t.unlock_shared_resources.
 
void(* on_rx )(can_msg_t *can_msg)
 Called when a CAN frame is received. Optional.
 
void(* on_tx )(can_msg_t *can_msg)
 Called when a CAN frame is transmitted. Optional.
 
void(* on_alias_change )(uint16_t alias, node_id_t node_id)
 Called when a node's CAN alias changes. Optional.
 

Detailed Description

CAN bus transport configuration.

Users provide their hardware-specific CAN driver functions here. All other CAN-internal wiring is handled automatically.

Example:

static const can_config_t can_config = {
.transmit_raw_can_frame = &MyCanDriver_transmit,
.is_tx_buffer_clear = &MyCanDriver_is_tx_clear,
.lock_shared_resources = &MyDriver_lock,
.unlock_shared_resources = &MyDriver_unlock,
.on_rx = &my_can_rx_handler, // optional
.on_tx = &my_can_tx_handler, // optional
.on_alias_change = &my_alias_handler, // optional
};
CanConfig_initialize(&can_config);
void CanConfig_initialize(const can_config_t *config)
Initializes the CAN bus transport layer.
Definition can_config.c:260
CAN bus transport configuration.
Definition can_config.h:72

Field Documentation

◆ transmit_raw_can_frame

bool(* transmit_raw_can_frame) (can_msg_t *can_msg)

Transmit a raw CAN frame. REQUIRED.

◆ is_tx_buffer_clear

bool(* is_tx_buffer_clear) (void)

Check if CAN TX hardware buffer can accept another frame. REQUIRED.

◆ lock_shared_resources

void(* lock_shared_resources) (void)

Disable interrupts / acquire mutex for shared resource access. REQUIRED. Same function as openlcb_config_t.lock_shared_resources.

◆ unlock_shared_resources

void(* unlock_shared_resources) (void)

Re-enable interrupts / release mutex. REQUIRED. Same function as openlcb_config_t.unlock_shared_resources.

◆ on_rx

void(* on_rx) (can_msg_t *can_msg)

Called when a CAN frame is received. Optional.

◆ on_tx

void(* on_tx) (can_msg_t *can_msg)

Called when a CAN frame is transmitted. Optional.

◆ on_alias_change

void(* on_alias_change) (uint16_t alias, node_id_t node_id)

Called when a node's CAN alias changes. Optional.


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

Copyright (c) 2026 Jim Kueneman all rights reserved. See the License