Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
telemetry_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Gautier Hattenberger
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  *
21  */
22 
29 #ifndef TELEMETRY_COMMON_H
30 #define TELEMETRY_COMMON_H
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <inttypes.h>
37 #include "std.h"
38 #include "pprzlink/pprzlink_device.h"
39 #include "pprzlink/pprzlink_transport.h"
40 #include "pprzlink/messages.h"
41 
44 typedef void (*telemetry_cb)(struct transport_tx *trans, struct link_device *dev);
45 
48 typedef const char telemetry_msg[64];
49 
51 #define TELEMETRY_NB_CBS 4
52 
56 };
57 
65 };
66 
74 #if PERIODIC_TELEMETRY
76 #else
77 static inline int8_t register_periodic_telemetry(struct periodic_telemetry *_pt __attribute__((unused)),
78  uint8_t _id __attribute__((unused)), telemetry_cb _cb __attribute__((unused))) { return -1; }
79 #endif
80 
81 #if USE_PERIODIC_TELEMETRY_REPORT
82 
87 extern void periodic_telemetry_err_report(uint8_t _process, uint8_t _mode, uint8_t _id);
88 #endif
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* TELEMETRY_COMMON_H */
95 
telemetry_msg
const typedef char telemetry_msg[64]
periodic telemetry msg name definition
Definition: telemetry_common.h:48
telemetry_cb
void(* telemetry_cb)(struct transport_tx *trans, struct link_device *dev)
Telemetry callback definition.
Definition: telemetry_common.h:44
periodic_telemetry::cbs
struct telemetry_cb_slots * cbs
array of callbacks defined through TELEMETRY_MSG
Definition: telemetry_common.h:64
std.h
telemetry_cb_slots::id
uint8_t id
id of telemetry message
Definition: telemetry_common.h:54
dev
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
periodic_telemetry_err_report
void periodic_telemetry_err_report(uint8_t _process, uint8_t _mode, uint8_t _id)
Send an error report when trying to send message that as not been register.
Definition: telemetry.c:78
TELEMETRY_NB_CBS
#define TELEMETRY_NB_CBS
number of callbacks that can be registered per msg
Definition: telemetry_common.h:51
uint8_t
unsigned char uint8_t
Definition: types.h:14
periodic_telemetry
Periodic telemetry structure.
Definition: telemetry_common.h:62
periodic_telemetry::nb
uint8_t nb
number of messages
Definition: telemetry_common.h:63
int8_t
signed char int8_t
Definition: types.h:15
register_periodic_telemetry
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:46
telemetry_cb_slots::slots
telemetry_cb slots[TELEMETRY_NB_CBS]
Definition: telemetry_common.h:55
telemetry_cb_slots
Definition: telemetry_common.h:53
inttypes.h