VCAN
2.0.0
Virtual CAN bus
|
Go to the documentation of this file.
37 #define VCAN_VERSION "2.0.0"
45 #define VCAN_DATA_MAX_LEN 64
47 #define VCAN_MAX_CONNECTED_NODES 16
Virtual node.
Definition: vcan.h:94
#define VCAN_DATA_MAX_LEN
Max payload size of a CAN message in bytes.
Definition: vcan.h:45
@ VCAN_TOO_MANY_CONNECTED
Max amount of connected nodes reached.
Definition: vcan.h:67
uint32_t id
The CAN ID - unused by VCAN.
Definition: vcan.h:79
@ VCAN_ALREADY_CONNECTED
The node is already connected to the bus.
Definition: vcan.h:72
size_t connected
Amount of nodes.
Definition: vcan.h:139
vcan_msg_t received_msg
The message just transmitted over the bus.
Definition: vcan.h:133
vcan_err_t vcan_connect(vcan_bus_t *bus, vcan_node_t *node)
Attaches a new node to the bus, enabling it to receive any transmitted message.
void * other_custom_data
Any data the callback may need, such as a flag to trigger on reception.
Definition: vcan.h:111
uint32_t len
Used bytes in the data field.
Definition: vcan.h:82
uint32_t id
Identifier of the node.
Definition: vcan.h:114
@ VCAN_NODE_NOT_FOUND
This node is not connected to the bus, so it cannot be disconnected.
Definition: vcan.h:70
vcan_err_t vcan_init(vcan_bus_t *bus)
Initialises the bus.
vcan_err_t vcan_tx(vcan_bus_t *bus, const vcan_msg_t *msg, const vcan_node_t *src_node)
Sends a copy of the message to every connected node and calls every nodes's callback to notify them.
vcan_err_t vcan_disconnect(vcan_bus_t *bus, const vcan_node_t *node)
Detaches a node from the bus, disabling it from receiving any further messages.
@ VCAN_NULL_MSG
The message argument is NULL.
Definition: vcan.h:57
vcan_err_t
VCAN error codes.
Definition: vcan.h:50
Message to transmit or receive.
Definition: vcan.h:76
#define VCAN_MAX_CONNECTED_NODES
MAx amount of virtual nodes connected to the virtual bus.
Definition: vcan.h:47
@ VCAN_NULL_CALLBACK
The callback within the node is NULL.
Definition: vcan.h:61
@ VCAN_NULL_BUS
The bus argument is NULL.
Definition: vcan.h:55
@ VCAN_OK
Successfully completed.
Definition: vcan.h:53
void(* callback_on_rx)(struct vcan_node *node, const vcan_msg_t *msg)
Callback called when a message has been written into received_msg.
Definition: vcan.h:107
@ VCAN_NULL_NODE
The node argument is NULL.
Definition: vcan.h:59
Virtual bus.
Definition: vcan.h:130