device.h

Definitions of CAN device interface.

CAN_MAX_RATE_ERROR

Maximum bit-rate error allowed when computing bittimings in tenth of percent.

1
(50) /* 5 % */
CAN_DLL_NUMOF

Maximum number of interfaces which can be registered on DLL.

1
(1)
struct candev_params candev_params_t

Parameters to initialize a candev.

struct candev_dev candev_dev_t

candev descriptor to pass to the device thread

kernel_types.h::kernel_pid_t can_device_init(char * stack, int stacksize, char priority, const char * name, device.h::candev_dev_t * params)

Initialize a CAN device thread.

This function sets up a CAN device thread

Parameters

stack:the device thread stack
stacksize:the device thread stack size
priority:the device thread priority
name:the device thread name
params:the parameters containing the device pointer and the ifnum

Return values

  • the pid of the created thread
int can_device_calc_bittiming(uint32_t clock, const struct can_bittiming_const * timing_const, struct can_bittiming * bittiming)

Fill in a bittiming structure from bittiming->bitrate and timing_const.

Parameters

clock:the clock of the CAN controller
timing_const:the timing parameter of the CAN controller
bittiming:the calculated bittiming (bitrate field must be set)

Return values

  • 0 on success
  • < 0 on error
struct candev_params

Parameters to initialize a candev.

const char * name

candev name to set

can_trx.h::can_trx_t * trx

transceiver to set

uint32_t rx_inactivity_timeout

power management rx timeout value

uint32_t tx_wakeup_timeout

power management tx wake up value

struct candev_dev

candev descriptor to pass to the device thread

candev.h::candev_t * dev

the device

int ifnum

interface number

kernel_types.h::kernel_pid_t pid

pid

const char * name

device name

can_trx.h::can_trx_t * trx

transceiver attached to the device

uint32_t rx_inactivity_timeout

Min timeout loaded when a frame is received.

uint32_t tx_wakeup_timeout

Min timeout loaded when a frame is sent.

uint32_t last_pm_update

time when the pm was updated

uint32_t last_pm_value

last pm timer value set

xtimer.h::xtimer_t pm_timer

timer for power management