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_dual.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Christophe De Wagter
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 #include "mcu_periph/uart.h"
31 #include "mcu_periph/gpio.h"
32 #include <string.h>
33 
34 
35 
37 struct _sbus sbus1, sbus2;
38 
39 // Telemetry function
40 #if PERIODIC_TELEMETRY
41 #ifdef FBW
42 #define DOWNLINK_TELEMETRY &telemetry_Fbw
43 #else
44 #define DOWNLINK_TELEMETRY DefaultPeriodic
45 #endif
46 
48 
49 static void send_sbus(void) {
50  // Using PPM message
51  DOWNLINK_SEND_PPM(DefaultChannel, DefaultDevice,
53 }
54 #endif
55 
56 // Init function
58  sbus_common_init(&sbus1, &SBUS1_UART_DEV);
59  sbus_common_init(&sbus2, &SBUS2_UART_DEV);
60 
61  // Register telemetry message
62 #if PERIODIC_TELEMETRY
63  register_periodic_telemetry(DOWNLINK_TELEMETRY, "PPM", send_sbus);
64 #endif
65 }
66 
68  sbus_common_decode_event(&sbus1, &SBUS1_UART_DEV);
69  sbus_common_decode_event(&sbus2, &SBUS2_UART_DEV);
70 }
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
Periodic telemetry system header (includes downlink utility and generated code).
SBUS structure.
Definition: sbus_common.h:65
Some architecture independent helper functions for GPIOs.
void radio_control_impl_init(void)
Definition: sbus_dual.c:57
bool_t register_periodic_telemetry(struct pprz_telemetry *_pt, const char *_msg, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:38
Dual SBUS radio_control.
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
struct _sbus sbus1 sbus2
SBUS struct.
Definition: sbus_dual.c:37
void sbus_dual_decode_event(void)
Decoding event function.
Definition: sbus_dual.c:67
#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