Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
uavcan.c File Reference
#include "uavcan.h"
+ Include dependency graph for uavcan.c:

Go to the source code of this file.

Macros

#define UAVCAN_NODE_ID   100
 
#define UAVCAN_BAUDRATE   1000000
 

Functions

static THD_FUNCTION (uavcan_rx, p)
 
static THD_FUNCTION (uavcan_tx, p)
 
static void onTransferReceived (CanardInstance *ins, CanardRxTransfer *transfer)
 Whenever a valid and 'accepted' transfer is received. More...
 
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. More...
 
static bool uavcanConfigureIface (struct uavcan_iface_t *iface)
 Try to compute the timing registers for the can interface and set the configuration. More...
 
static void uavcanInitIface (struct uavcan_iface_t *iface)
 Initialize uavcan interface. More...
 
void uavcan_init (void)
 Initialize all uavcan interfaces. More...
 
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. More...
 
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. More...
 

Variables

static uavcan_eventuavcan_event_hd = NULL
 

Detailed Description

Interface from actuators to ChibiOS CAN driver using UAVCan

Definition in file uavcan.c.

Macro Definition Documentation

◆ UAVCAN_BAUDRATE

#define UAVCAN_BAUDRATE   1000000

Definition at line 34 of file uavcan.c.

◆ UAVCAN_NODE_ID

#define UAVCAN_NODE_ID   100

Definition at line 30 of file uavcan.c.

Function Documentation

◆ onTransferReceived()

static void onTransferReceived ( CanardInstance *  ins,
CanardRxTransfer *  transfer 
)
static

Whenever a valid and 'accepted' transfer is received.

Definition at line 204 of file uavcan.c.

References abi_struct::cb, ev, abi_struct::next, transfer(), and uavcan_event_hd.

Referenced by uavcanInitIface().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shouldAcceptTransfer()

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 
)
static

If we should accept this transfer.

Definition at line 219 of file uavcan.c.

References ev, abi_struct::next, and uavcan_event_hd.

Referenced by uavcanInitIface().

+ Here is the caller graph for this function:

◆ THD_FUNCTION() [1/2]

static THD_FUNCTION ( uavcan_rx  ,
p   
)
static

Definition at line 94 of file uavcan.c.

References uavcan_iface_t::can_driver, uavcan_iface_t::canard, uavcan_iface_t::mutex, and p.

◆ THD_FUNCTION() [2/2]

static THD_FUNCTION ( uavcan_tx  ,
p   
)
static

◆ uavcan_bind()

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.

Definition at line 412 of file uavcan.c.

References abi_struct::cb, ev, abi_struct::next, and uavcan_event_hd.

Referenced by actuators_uavcan_init().

+ Here is the caller graph for this function:

◆ uavcan_broadcast()

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.

Definition at line 427 of file uavcan.c.

References uavcan_iface_t::canard, uavcan_iface_t::initialized, uavcan_iface_t::mutex, uavcan_iface_t::transfer_id, and uavcan_iface_t::tx_request.

Referenced by actuators_uavcan_commit().

+ Here is the caller graph for this function:

◆ uavcan_init()

void uavcan_init ( void  )

Initialize all uavcan interfaces.

uavcan interfaces

Definition at line 383 of file uavcan.c.

References uavcan_iface_t::can_cfg, and uavcanInitIface().

+ Here is the call graph for this function:

◆ uavcanConfigureIface()

static bool uavcanConfigureIface ( struct uavcan_iface_t iface)
static

Try to compute the timing registers for the can interface and set the configuration.

Definition at line 240 of file uavcan.c.

References uavcan_iface_t::can_baudrate, and uavcan_iface_t::can_cfg.

Referenced by uavcanInitIface().

+ Here is the caller graph for this function:

◆ uavcanInitIface()

static void uavcanInitIface ( struct uavcan_iface_t iface)
static

Variable Documentation

◆ uavcan_event_hd

uavcan_event* uavcan_event_hd = NULL
static

Definition at line 37 of file uavcan.c.

Referenced by onTransferReceived(), shouldAcceptTransfer(), and uavcan_bind().