|
Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#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"Go to the source code of this file.
Data Structures | |
| struct | uavcan_rx_frame |
| struct | uavcan_iface_t |
| 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 |
| #define | UAVCAN_RX_QUEUE_SIZE 64 |
| uavcan interface structure | |
| #define | UAVCAN_RX_BUFFER_SIZE (UAVCAN_RX_QUEUE_SIZE * (sizeof(struct uavcan_rx_frame) + 2) + 3) |
| A frame is a record of the framed ring buffer: 2 bytes length, and 3 bytes margin for the buffer. | |
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_rx_event (void) |
| Handle the received frames of all interfaces (main thread). | |
| 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) |
| struct uavcan_rx_frame |
| struct 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 | |
| uint16_t | rx_overflows | Frames dropped because the queue was full. |
| struct framed_ring_buffer | rx_queue | Received frames, from the CAN receive thread to the main thread. |
| uint8_t | rx_queue_buf[UAVCAN_RX_BUFFER_SIZE] | |
| 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 | |
| struct uavcan_event_t |
Main uavcan event structure for registering/calling callbacks.
| Data Fields | ||
|---|---|---|
| uavcan_callback | cb | |
| uint16_t | data_type_id | |
| uint64_t | data_type_signature | |
| struct uavcan_event_t * | next | |
| #define UAVCAN_RX_BUFFER_SIZE (UAVCAN_RX_QUEUE_SIZE * (sizeof(struct uavcan_rx_frame) + 2) + 3) |
| #define UAVCAN_RX_QUEUE_SIZE 64 |
| #define UAVCAN_TID_STORE_CAPACITY 30 |
Definition at line 41 of file uavcan.h.
Referenced by uavcanInitIface().
| typedef void(* uavcan_callback) (struct uavcan_iface_t *iface, CanardRxTransfer *transfer) |
| typedef struct uavcan_event_t uavcan_event |
| 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 272 of file uavcan.c.
References ev, and uavcan_event_hd.
Referenced by actuators_uavcan_init(), airspeed_uavcan_init(), can_fuelcell_init(), gps_uavcan_init(), mag_uavcan_init(), power_uavcan_init(), range_sensor_uavcan_init(), rc_uavcan_init(), scout_detector_init(), tunnel_uavcan_init_periph(), uavcan_allocator_init(), and uavcan_init_reporting().
| 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 345 of file uavcan.c.
References 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().
| void uavcan_init | ( | void | ) |
uavcan interfaces
uavcan external functions
uavcan interfaces
Definition at line 257 of file uavcan.c.
References uavcan_allocator_init(), uavcan_init_reporting(), and uavcanInitIface().
| void uavcan_reporting | ( | void | ) |
Definition at line 47 of file uavcan_reporting.c.
References get_uavcan_status(), and uavcan_broadcast().
| void uavcan_request | ( | struct uavcan_iface_t * | iface, |
| uint8_t | destination_node_id, | ||
| CanardTxTransfer * | transfer ) |
| transfer | should be initialized with canardInitTxTransfer. |
Definition at line 321 of file uavcan.c.
References uavcan_iface_t::bsem, uavcan_iface_t::canard, 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().
| void uavcan_response | ( | struct uavcan_iface_t * | iface, |
| uint8_t | destination_node_id, | ||
| CanardTxTransfer * | transfer ) |
| inout_transfer_id | should be set to the request transfer id before calling this function |
Definition at line 364 of file uavcan.c.
References uavcan_iface_t::bsem, uavcan_iface_t::canard, 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().
| void uavcan_rx_event | ( | void | ) |
Handle the received frames of all interfaces (main thread).
Definition at line 244 of file uavcan.c.
References uavcan_handle_rx().
| void uavcan_transfer | ( | struct uavcan_iface_t * | iface, |
| CanardTxTransfer * | transfer ) |
| transfer | should be initialized with canardInitTxTransfer. |
Definition at line 300 of file uavcan.c.
References uavcan_iface_t::bsem, uavcan_iface_t::canard, 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().