Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
uavcan.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Freek van Tienen <freek.v.tienen@gmail.com>
3 *
4 * This file is part of paparazzi.
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, write to
18 * the Free Software Foundation, 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
26#ifndef MODULES_UAVCAN_ARCH_H
27#define MODULES_UAVCAN_ARCH_H
28
29#include <canard.h>
30#include <string.h>
31#include "mcu_periph/can.h"
34#include "utils/kv_store.h"
35
36
37#ifndef UAVCAN_TX_FIFO_SIZE
38#define UAVCAN_TX_FIFO_SIZE 1024
39#endif
40
41#define UAVCAN_TID_STORE_CAPACITY 30
42
69
72
81
83#if UAVCAN_USE_CAN1
84extern struct uavcan_iface_t uavcan1;
85#endif
86#if UAVCAN_USE_CAN2
87extern struct uavcan_iface_t uavcan2;
88#endif
89
91void uavcan_init(void);
92void uavcan_reporting(void);
93void uavcan_bind(uint16_t data_type_id, uint64_t data_type_signature, uavcan_event *ev, uavcan_callback cb);
96void uavcan_broadcast(struct uavcan_iface_t *iface, uint64_t data_type_signature, uint16_t data_type_id,
97 uint8_t priority, const void *payload, uint16_t payload_len);
99
100#endif /* MODULES_UAVCAN_ARCH_H */
thread_t * pprz_thread_t
uint16_t foo
Definition main_demo5.c:58
abi_event ev
Definition rssi.c:45
pprz_mutex_t tx_mutex
Definition uavcan.h:49
pprz_mutex_t rx_mutex
Definition uavcan.h:48
uint8_t transfer_ids_values[UAVCAN_TID_STORE_CAPACITY]
Definition uavcan.h:64
void(* uavcan_callback)(struct uavcan_iface_t *iface, CanardRxTransfer *transfer)
Generic uavcan callback definition.
Definition uavcan.h:71
uint32_t can_baudrate
Definition uavcan.h:46
void uavcan_init(void)
uavcan interfaces
Definition uavcan.c:225
bool initialized
Definition uavcan.h:67
void uavcan_transfer(struct uavcan_iface_t *iface, CanardTxTransfer *transfer)
Definition uavcan.c:268
uint32_t transfer_ids_keys[UAVCAN_TID_STORE_CAPACITY]
Definition uavcan.h:63
struct pprzaddr_can can_net
Definition uavcan.h:45
uint16_t data_type_id
Definition uavcan.h:75
pprz_bsem_t bsem
Definition uavcan.h:52
void uavcan_request(struct uavcan_iface_t *iface, uint8_t destination_node_id, CanardTxTransfer *transfer)
Definition uavcan.c:289
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 uavcan.c:313
kv_store_t transfer_ids_store
Definition uavcan.h:66
#define UAVCAN_TID_STORE_CAPACITY
Definition uavcan.h:41
uint8_t transfer_ids_used[UAVCAN_TID_STORE_CAPACITY]
Definition uavcan.h:65
void uavcan_reporting(void)
struct uavcan_event_t * next
Definition uavcan.h:78
pprz_thread_t thread_tx
Definition uavcan.h:50
uint16_t nb_errors
Definition uavcan.h:60
void uavcan_response(struct uavcan_iface_t *iface, uint8_t destination_node_id, CanardTxTransfer *transfer)
Definition uavcan.c:332
uavcan_callback cb
Definition uavcan.h:77
uint8_t node_id
Definition uavcan.h:54
uint64_t data_type_signature
Definition uavcan.h:76
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 uavcan.c:240
CanardInstance canard
Definition uavcan.h:55
uint8_t canard_memory_pool[1024 *2]
Definition uavcan.h:56
Main uavcan event structure for registering/calling callbacks.
Definition uavcan.h:74
uavcan interface structure
Definition uavcan.h:44
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)