Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
uavcan.h File Reference

Interface with uavcan using the Chibios can interfaces. More...

#include <hal.h>
#include <canard.h>
#include <string.h>
+ Include dependency graph for uavcan.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  uavcan_iface_t
 uavcan interface structure More...
 
struct  uavcan_event_t
 Main uavcan event structure for registering/calling callbacks. More...
 

Typedefs

typedef void(* uavcan_callback) (struct uavcan_iface_t *iface, CanardRxTransfer *transfer)
 Generic uavcan callback definition. More...
 
typedef struct uavcan_event_t uavcan_event
 

Functions

void uavcan_init (void)
 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...
 

Detailed Description

Interface with uavcan using the Chibios can interfaces.

Stub needed for compiling modules requiring uavcan.

This uses multithreading and starts a transmit and receive thread per interface.

Definition in file uavcan.h.


Data Structure Documentation

◆ uavcan_iface_t

struct uavcan_iface_t

uavcan interface structure

Definition at line 34 of file uavcan.h.

Data Fields
uint32_t can_baudrate
CANConfig can_cfg
CANDriver * can_driver
CanardInstance canard
uint8_t canard_memory_pool[1024 *2]
bool initialized
mutex_t mutex
uint8_t node_id
void * thread_rx_wa
size_t thread_rx_wa_size
void * thread_tx_wa
size_t thread_tx_wa_size
void * thread_uavcan_wa
size_t thread_uavcan_wa_size
uint8_t transfer_id
event_source_t tx_request

◆ uavcan_event_t

struct uavcan_event_t

Main uavcan event structure for registering/calling callbacks.

Definition at line 60 of file uavcan.h.

+ Collaboration diagram for uavcan_event_t:
Data Fields
uavcan_callback cb
uint16_t data_type_id
uint64_t data_type_signature
struct uavcan_event_t * next

Typedef Documentation

◆ uavcan_callback

typedef void(* uavcan_callback) (struct uavcan_iface_t *iface, CanardRxTransfer *transfer)

Generic uavcan callback definition.

Definition at line 57 of file uavcan.h.

◆ uavcan_event

typedef struct uavcan_event_t uavcan_event

Definition at line 57 of file uavcan.h.

Function Documentation

◆ 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(), airspeed_uavcan_init(), can_fuelcell_init(), power_uavcan_init(), and range_sensor_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_cmd_commit(), and actuators_uavcan_commit().

+ Here is the caller graph for this function:

◆ uavcan_init()

void uavcan_init ( void  )

uavcan interfaces

uavcan external functions

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: