Paparazzi UAS  v5.15_devel-81-gd13dafb
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 #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 
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