Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
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 <hal.h>
30 #include <canard.h>
31 #include <string.h>
32 
35  CANDriver *can_driver;
37  CANConfig can_cfg;
38 
39  event_source_t tx_request;
40  mutex_t mutex;
41  void *thread_rx_wa;
42  void *thread_tx_wa;
47 
49  CanardInstance canard;
51 
54 };
55 
57 typedef void (*uavcan_callback)(struct uavcan_iface_t *iface, CanardRxTransfer *transfer);
58 
65 };
67 
69 #if UAVCAN_USE_CAN1
70 extern struct uavcan_iface_t uavcan1;
71 #endif
72 #if UAVCAN_USE_CAN2
73 extern struct uavcan_iface_t uavcan2;
74 #endif
75 
77 void uavcan_init(void);
78 void uavcan_bind(uint16_t data_type_id, uint64_t data_type_signature, uavcan_event *ev, uavcan_callback cb);
79 void uavcan_broadcast(struct uavcan_iface_t *iface, uint64_t data_type_signature, uint16_t data_type_id,
80  uint8_t priority, const void *payload, uint16_t payload_len);
81 
82 #endif /* MODULES_UAVCAN_ARCH_H */
uavcan_init
void uavcan_init(void)
uavcan interfaces
Definition: uavcan.c:383
uint32_t
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
transfer
int transfer(const Mat *from, const image_t *to)
Definition: wedgebug_opencv.cpp:40
uint64_t
unsigned long long uint64_t
Definition: vl53l1_types.h:72
uavcan_iface_t::tx_request
event_source_t tx_request
Definition: uavcan.h:39
uavcan_event_t::data_type_signature
uint64_t data_type_signature
Definition: uavcan.h:62
uavcan_iface_t::transfer_id
uint8_t transfer_id
Definition: uavcan.h:52
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: uavcan.c:412
uavcan_iface_t::canard
CanardInstance canard
Definition: uavcan.h:49
uavcan_iface_t::mutex
mutex_t mutex
Definition: uavcan.h:40
uavcan_event_t::data_type_id
uint16_t data_type_id
Definition: uavcan.h:61
uavcan_iface_t::can_cfg
CANConfig can_cfg
Definition: uavcan.h:37
uavcan_iface_t::can_driver
CANDriver * can_driver
Definition: uavcan.h:35
uavcan_event_t
Main uavcan event structure for registering/calling callbacks.
Definition: uavcan.h:60
uavcan_iface_t::can_baudrate
uint32_t can_baudrate
Definition: uavcan.h:36
uavcan_callback
void(* uavcan_callback)(struct uavcan_iface_t *iface, CanardRxTransfer *transfer)
Generic uavcan callback definition.
Definition: uavcan.h:57
uavcan_iface_t::thread_rx_wa_size
size_t thread_rx_wa_size
Definition: uavcan.h:44
uavcan_event_t::cb
uavcan_callback cb
Definition: uavcan.h:63
uavcan_iface_t
uavcan interface structure
Definition: uavcan.h:34
uavcan_iface_t::thread_rx_wa
void * thread_rx_wa
Definition: uavcan.h:41
ev
abi_event ev
Definition: rssi.c:45
uavcan_iface_t::thread_tx_wa_size
size_t thread_tx_wa_size
Definition: uavcan.h:45
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: uavcan.c:427
uavcan_iface_t::canard_memory_pool
uint8_t canard_memory_pool[1024 *2]
Definition: uavcan.h:50
uavcan_iface_t::initialized
bool initialized
Definition: uavcan.h:53
uavcan_iface_t::node_id
uint8_t node_id
Definition: uavcan.h:48
uavcan_iface_t::thread_tx_wa
void * thread_tx_wa
Definition: uavcan.h:42
uavcan_iface_t::thread_uavcan_wa_size
size_t thread_uavcan_wa_size
Definition: uavcan.h:46
uavcan_event_t::next
struct uavcan_event_t * next
Definition: uavcan.h:64
uint16_t
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
uavcan_iface_t::thread_uavcan_wa
void * thread_uavcan_wa
Definition: uavcan.h:43