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
115#if defined(STM32_CAN_USE_FDCAN1) || defined(STM32_CAN_USE_FDCAN2)
168#if defined(STM32_CAN_USE_FDCAN1) || defined(STM32_CAN_USE_FDCAN2)
169 tx_msg.DLC =
txf->data_len;
171 tx_msg.common.XTD = 1;
172 tx_msg.common.RTR = 0;
174 tx_msg.DLC =
txf->data_len;
210 if (
transfer->data_type_id ==
ev->data_type_id) {
228 if (data_type_id ==
ev->data_type_id) {
242 if (
iface->can_baudrate < 1) {
247#if defined(STM32_CAN_USE_FDCAN1) || defined(STM32_CAN_USE_FDCAN2)
252 static const int MaxBS1 = 16;
253 static const int MaxBS2 = 8;
291 if ((prescaler < 1U) || (prescaler > 1024U)) {
340#if defined(STM32_CAN_USE_FDCAN1) || defined(STM32_CAN_USE_FDCAN2)
377 iface->initialized =
true;
386#if defined(STM32_CAN_USE_FDCAN1) || defined(STM32_CAN_USE_FDCAN2)
397#if defined(STM32_CAN_USE_FDCAN1) || defined(STM32_CAN_USE_FDCAN2)
415 ev->data_type_id = data_type_id;
416 ev->data_type_signature = data_type_signature;
431 if (!
iface->initialized) {
return; }
436 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)