Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
uavcan.h File Reference
#include <canard.h>
#include <string.h>
#include "mcu_periph/can.h"
#include "modules/core/threads.h"
#include "utils/framed_ring_buffer.h"
#include "utils/kv_store.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...
 

Macros

#define UAVCAN_TX_FIFO_SIZE   1024
 
#define UAVCAN_TID_STORE_CAPACITY   30
 

Typedefs

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

Functions

void uavcan_init (void)
 uavcan interfaces
 
void uavcan_reporting (void)
 
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.
 
void uavcan_transfer (struct uavcan_iface_t *iface, CanardTxTransfer *transfer)
 
void uavcan_request (struct uavcan_iface_t *iface, uint8_t destination_node_id, CanardTxTransfer *transfer)
 
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)
 Legacy function Broadcast an uavcan message to a specific interface.
 
void uavcan_response (struct uavcan_iface_t *iface, uint8_t destination_node_id, CanardTxTransfer *transfer)
 

Data Structure Documentation

◆ uavcan_iface_t

struct uavcan_iface_t

uavcan interface structure

Definition at line 44 of file uavcan.h.

+ Collaboration diagram for uavcan_iface_t:
Data Fields
pprz_bsem_t bsem
uint32_t can_baudrate
struct pprzaddr_can can_net
CanardInstance canard
uint8_t canard_memory_pool[1024 *2]
bool initialized
uint16_t nb_errors
uint8_t node_id
pprz_mutex_t rx_mutex
pprz_thread_t thread_tx
uint32_t transfer_ids_keys[UAVCAN_TID_STORE_CAPACITY]
kv_store_t transfer_ids_store
uint8_t transfer_ids_used[UAVCAN_TID_STORE_CAPACITY]
uint8_t transfer_ids_values[UAVCAN_TID_STORE_CAPACITY]
pprz_mutex_t tx_mutex

◆ uavcan_event_t

struct uavcan_event_t

Main uavcan event structure for registering/calling callbacks.

Definition at line 74 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

Macro Definition Documentation

◆ UAVCAN_TID_STORE_CAPACITY

#define UAVCAN_TID_STORE_CAPACITY   30

Definition at line 41 of file uavcan.h.

◆ UAVCAN_TX_FIFO_SIZE

#define UAVCAN_TX_FIFO_SIZE   1024

Definition at line 38 of file uavcan.h.

Typedef Documentation

◆ uavcan_callback

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

Generic uavcan callback definition.

Definition at line 71 of file uavcan.h.

◆ uavcan_event

Definition at line 80 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 
)

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

Legacy function Broadcast an uavcan message to a specific interface.

Definition at line 313 of file uavcan.c.

References foo, transfer(), and uavcan_transfer().

Referenced by actuators_uavcan_cmd_commit(), actuators_uavcan_commit(), handleAllocationRequest(), id_alloc_uavcan_cb(), tunnel_uavcan_send_message(), and uavcan_reporting().

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

◆ uavcan_init()

void uavcan_init ( void  )

uavcan interfaces

uavcan external functions

uavcan interfaces

Definition at line 225 of file uavcan.c.

References foo, uavcan_allocator_init(), uavcan_init_reporting(), and uavcanInitIface().

+ Here is the call graph for this function:

◆ uavcan_reporting()

void uavcan_reporting ( void  )

Definition at line 47 of file uavcan_reporting.c.

References foo, get_uavcan_status(), and uavcan_broadcast().

+ Here is the call graph for this function:

◆ uavcan_request()

void uavcan_request ( struct uavcan_iface_t iface,
uint8_t  destination_node_id,
CanardTxTransfer transfer 
)
Parameters
transfershould be initialized with canardInitTxTransfer.

Definition at line 289 of file uavcan.c.

References uavcan_iface_t::bsem, uavcan_iface_t::canard, foo, get_transfer_id(), uavcan_iface_t::initialized, uavcan_iface_t::nb_errors, pprz_bsem_signal(), pprz_mtx_lock(), pprz_mtx_unlock(), transfer(), and uavcan_iface_t::tx_mutex.

Referenced by request_node_info().

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

◆ uavcan_response()

void uavcan_response ( struct uavcan_iface_t iface,
uint8_t  destination_node_id,
CanardTxTransfer transfer 
)
Parameters
inout_transfer_idshould be set to the request transfer id before calling this function

Definition at line 332 of file uavcan.c.

References uavcan_iface_t::bsem, uavcan_iface_t::canard, foo, uavcan_iface_t::initialized, pprz_bsem_signal(), pprz_mtx_lock(), pprz_mtx_unlock(), transfer(), and uavcan_iface_t::tx_mutex.

Referenced by node_info_cb().

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

◆ uavcan_transfer()

void uavcan_transfer ( struct uavcan_iface_t iface,
CanardTxTransfer transfer 
)
Parameters
transfershould be initialized with canardInitTxTransfer.

Definition at line 268 of file uavcan.c.

References uavcan_iface_t::bsem, uavcan_iface_t::canard, foo, get_transfer_id(), uavcan_iface_t::initialized, uavcan_iface_t::nb_errors, pprz_bsem_signal(), pprz_mtx_lock(), pprz_mtx_unlock(), transfer(), and uavcan_iface_t::tx_mutex.

Referenced by uavcan_broadcast().

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