File can_driver.c¶
FileList > examples > python_api > src > can_driver.c
Go to the source code of this file
#include "can_driver.h"
Public Static Attributes¶
| Type | Name |
|---|---|
| const can_driver_t * | active_driver = 0Pointer to the currently active CAN driver (set by mock_can_init) |
Public Functions¶
| Type | Name |
|---|---|
| int | can_receive (uint32_t * id, uint8_t * data, uint8_t * len) Receives a CAN frame using the active CAN driver. |
| int | can_send (uint32_t id, const uint8_t * data, uint8_t len) Sends a CAN frame using the active CAN driver. |
| void | can_set_driver (const can_driver_t * driver) Sets the active CAN driver to be used by the ISO-TP implementation. |
Public Static Attributes Documentation¶
variable active_driver¶
Pointer to the currently active CAN driver (set by mock_can_init)
const can_driver_t* active_driver;
Public Functions Documentation¶
function can_receive¶
Receives a CAN frame using the active CAN driver.
int can_receive (
uint32_t * id,
uint8_t * data,
uint8_t * len
)
Parameters:
idPointer to store the received CAN ID.dataPointer to buffer to store the received CAN data.lenPointer to variable to store the length of the received CAN data.
Returns:
int 0 on success, -1 if the queue is empty or if the driver is not set.
function can_send¶
Sends a CAN frame using the active CAN driver.
int can_send (
uint32_t id,
const uint8_t * data,
uint8_t len
)
Parameters:
idCAN ID to send.dataPointer to the CAN data to send.lenLength of the CAN data to send.
Returns:
int 0 on success, -1 on failure (e.g., if the driver is not set or if send fails).
function can_set_driver¶
Sets the active CAN driver to be used by the ISO-TP implementation.
void can_set_driver (
const can_driver_t * driver
)
Parameters:
driverPointer to the CAN driver to set as active.
The documentation for this class was generated from the following file examples/python_api/src/can_driver.c