Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 #include <inttypes.h>
33 #include "std.h"
34 #include "pprzlink/pprzlink_device.h"
35 #include "pprzlink/pprzlink_transport.h"
36 #include "pprzlink/messages.h"
37 
40 typedef void (*telemetry_cb)(struct transport_tx *trans, struct link_device *dev);
41 
44 typedef const char telemetry_msg[64];
45 
47 #define TELEMETRY_NB_CBS 4
48 
52 };
53 
61 };
62 
70 #if PERIODIC_TELEMETRY
72 #else
73 static inline int8_t register_periodic_telemetry(struct periodic_telemetry *_pt __attribute__((unused)),
74  uint8_t _id __attribute__((unused)), telemetry_cb _cb __attribute__((unused))) { return -1; }
75 #endif
76 
77 #if USE_PERIODIC_TELEMETRY_REPORT
78 
83 extern void periodic_telemetry_err_report(uint8_t _process, uint8_t _mode, uint8_t _id);
84 #endif
85 
86 #endif /* TELEMETRY_COMMON_H */
87 
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
Periodic telemetry structure.
uint8_t id
id of telemetry message
#define TELEMETRY_NB_CBS
number of callbacks that can be registered per msg
void(* telemetry_cb)(struct transport_tx *trans, struct link_device *dev)
Telemetry callback definition.
uint8_t nb
number of messages
const char telemetry_msg[64]
periodic telemetry msg name definition
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:73
struct telemetry_cb_slots * cbs
array of callbacks defined through TELEMETRY_MSG
unsigned char uint8_t
Definition: types.h:14
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[TELEMETRY_NB_CBS]
signed char int8_t
Definition: types.h:15