Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sbus.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Alexandre Bustico, 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 
29 #include BOARD_CONFIG
30 
31 
33 struct _sbus sbus;
34 
35 // Telemetry function
36 #if PERIODIC_TELEMETRY
37 #ifdef FBW
38 #define DOWNLINK_TELEMETRY &telemetry_Fbw
39 #else
40 #define DOWNLINK_TELEMETRY DefaultPeriodic
41 #endif
42 
44 
45 static void send_sbus(void) {
46  // Using PPM message
47  DOWNLINK_SEND_PPM(DefaultChannel, DefaultDevice,
49 }
50 #endif
51 
52 // Init function
54  sbus_common_init(&sbus, &SBUS_UART_DEV);
55 
56  // Register telemetry message
57 #if PERIODIC_TELEMETRY
58  register_periodic_telemetry(DOWNLINK_TELEMETRY, "PPM", send_sbus);
59 #endif
60 }
61 
62 
63 
64 // Decoding event function
65 // Reading from UART
66 void sbus_decode_event(void) {
67  sbus_common_decode_event(&sbus, &SBUS_UART_DEV);
68 }
69 
void radio_control_impl_init(void)
Definition: sbus.c:53
Periodic telemetry system header (includes downlink utility and generated code).
SBUS structure.
Definition: sbus_common.h:65
bool_t register_periodic_telemetry(struct pprz_telemetry *_pt, const char *_msg, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:38
struct _sbus sbus
SBUS struct.
Definition: sbus.c:33
uint16_t ppm[SBUS_NB_CHANNEL]
decoded and converted values
Definition: sbus_common.h:67
void sbus_common_decode_event(struct _sbus *sbus_p, struct uart_periph *dev)
Decoding event function.
Definition: sbus_common.c:114
struct RadioControl radio_control
Definition: radio_control.c:25
uint8_t frame_rate
Definition: radio_control.h:53
Single SBUS radio_control.
void sbus_decode_event(void)
Decoding event function.
Definition: sbus.c:66
#define SBUS_NB_CHANNEL
Definition: sbus_common.h:59
void sbus_common_init(struct _sbus *sbus_p, struct uart_periph *dev)
Init function.
Definition: sbus_common.c:58