30#define UAVCAN_NODE_ID 100
33#ifndef UAVCAN_BAUDRATE
34#define UAVCAN_BAUDRATE 1000000
40#ifndef UAVCAN_CAN1_NODE_ID
41#define UAVCAN_CAN1_NODE_ID UAVCAN_NODE_ID
44#ifndef UAVCAN_CAN1_BAUDRATE
45#define UAVCAN_CAN1_BAUDRATE UAVCAN_BAUDRATE
66#ifndef UAVCAN_CAN2_NODE_ID
67#define UAVCAN_CAN2_NODE_ID UAVCAN_NODE_ID
70#ifndef UAVCAN_CAN2_BAUDRATE
71#define UAVCAN_CAN2_BAUDRATE UAVCAN_BAUDRATE
119 rx_frame.data_len =
rx_msg.DLC;
120#if defined(STM32_CAN_USE_FDCAN1) || defined(STM32_CAN_USE_FDCAN2)
124 rx_frame.id =
rx_msg.std.SID;
173#if defined(STM32_CAN_USE_FDCAN1) || defined(STM32_CAN_USE_FDCAN2)
174 tx_msg.DLC =
txf->data_len;
176 tx_msg.common.XTD = 1;
177 tx_msg.common.RTR = 0;
179 tx_msg.DLC =
txf->data_len;
215 if (
transfer->data_type_id ==
ev->data_type_id) {
233 if (data_type_id ==
ev->data_type_id) {
247 if (
iface->can_baudrate < 1) {
252#if defined(STM32_CAN_USE_FDCAN1) || defined(STM32_CAN_USE_FDCAN2)
257 static const int MaxBS1 = 16;
258 static const int MaxBS2 = 8;
296 if ((prescaler < 1U) || (prescaler > 1024U)) {
345#if defined(STM32_CAN_USE_FDCAN1) || defined(STM32_CAN_USE_FDCAN2)
382 iface->initialized =
true;
391#if defined(STM32_CAN_USE_FDCAN1) || defined(STM32_CAN_USE_FDCAN2)
402#if defined(STM32_CAN_USE_FDCAN1) || defined(STM32_CAN_USE_FDCAN2)
420 ev->data_type_id = data_type_id;
421 ev->data_type_signature = data_type_signature;
436 if (!
iface->initialized) {
return; }
441 data_type_id, &
iface->transfer_id,
static THD_WORKING_AREA(wa_thd_spi1, SPI_THREAD_STACK_SIZE)
void(* uavcan_callback)(struct uavcan_iface_t *iface, CanardRxTransfer *transfer)
Generic uavcan callback definition.
Main uavcan event structure for registering/calling callbacks.
uavcan interface structure
static THD_FUNCTION(uavcan_rx, p)
void uavcan_init(void)
Initialize all uavcan interfaces.
static bool shouldAcceptTransfer(const CanardInstance *ins, uint64_t *out_data_type_signature, uint16_t data_type_id, CanardTransferType transfer_type, uint8_t source_node_id)
If we should accept this transfer.
static void uavcanInitIface(struct uavcan_iface_t *iface)
Initialize uavcan interface.
static bool uavcanConfigureIface(struct uavcan_iface_t *iface)
Try to compute the timing registers for the can interface and set the configuration.
void uavcan_broadcast(struct uavcan_iface_t *iface, uint64_t data_type_signature, uint16_t data_type_id, uint8_t priority, const void *payload, uint16_t payload_len)
Broadcast an uavcan message to a specific interface.
static uavcan_event * uavcan_event_hd
void uavcan_bind(uint16_t data_type_id, uint64_t data_type_signature, uavcan_event *ev, uavcan_callback cb)
Bind to a receiving message from uavcan.
static void onTransferReceived(CanardInstance *ins, CanardRxTransfer *transfer)
Whenever a valid and 'accepted' transfer is received.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned long long uint64_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
int transfer(const Mat *from, const image_t *to)