Paparazzi UAS  v6.2_unstable
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 
69 extern void telemetry_reporting_task(void);
70 
78 #if PERIODIC_TELEMETRY
80 #else
81 static inline int8_t register_periodic_telemetry(struct periodic_telemetry *_pt __attribute__((unused)),
82  uint8_t _id __attribute__((unused)), telemetry_cb _cb __attribute__((unused))) { return -1; }
83 #endif
84 
85 #if USE_PERIODIC_TELEMETRY_REPORT
86 
91 extern void periodic_telemetry_err_report(uint8_t _process, uint8_t _mode, uint8_t _id);
92 #endif
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* TELEMETRY_COMMON_H */
99 
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
int8_t
signed char int8_t
Typedef defining 8 bit char type.
Definition: vl53l1_types.h:103
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
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
telemetry_reporting_task
void telemetry_reporting_task(void)
Periodic task.
Definition: telemetry.c:77
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:115
TELEMETRY_NB_CBS
#define TELEMETRY_NB_CBS
number of callbacks that can be registered per msg
Definition: telemetry_common.h:51
periodic_telemetry
Periodic telemetry structure.
Definition: telemetry_common.h:62
periodic_telemetry::nb
uint8_t nb
number of messages
Definition: telemetry_common.h:63
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:51
telemetry_cb_slots::slots
telemetry_cb slots[TELEMETRY_NB_CBS]
Definition: telemetry_common.h:55
telemetry_cb_slots
Definition: telemetry_common.h:53