Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces 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 "modules/core/abi.h"
30#include BOARD_CONFIG
31
32#ifndef RC_POLARITY_GPIO_PORT
33#define RC_POLARITY_GPIO_PORT 0
34#endif
35#ifndef RC_POLARITY_GPIO_PIN
36#define RC_POLARITY_GPIO_PIN 0
37#endif
38
40struct Sbus sbus;
41
42// Telemetry function
43#if PERIODIC_TELEMETRY
45
46static void send_sbus(struct transport_tx *trans, struct link_device *dev)
47{
48 // Using PPM message
51}
52#endif
53
54// Init function
65
66
67// Decoding event function
68// Reading from UART
69static inline void sbus_decode_event(void)
70{
72}
73
74void sbus_event(void)
75{
77
79 //With Sbus one can still have a receiver sent valid frames generated by the
80 //failsafe mode of the receiver, having frames in this case does not guarantee having RC link
85 }
86 } else {
91 } else {
95 }
96 }
97 sbus.frame_available = false;
98 }
99
100}
Main include for ABI (AirBorneInterface).
#define RADIO_CONTROL_SBUS_ID
uint16_t foo
Definition main_demo5.c:58
struct RadioControl radio_control
Generic interface for radio control modules.
uint8_t time_since_last_frame
#define RC_REALLY_LOST
uint8_t radio_ok_cpt
uint8_t frame_rate
uint8_t frame_cpt
#define RC_OK
uint8_t nb_channel
#define RC_POLARITY_GPIO_PORT
Definition sbus.c:33
static void send_sbus(struct transport_tx *trans, struct link_device *dev)
Definition sbus.c:46
#define RC_POLARITY_GPIO_PIN
Definition sbus.c:36
void sbus_event(void)
RC event function.
Definition sbus.c:74
void sbus_init(void)
RC init function.
Definition sbus.c:55
static void sbus_decode_event(void)
Definition sbus.c:69
struct Sbus sbus
SBUS struct.
Definition sbus.c:40
Radio control via single SBUS receiver.
void sbus_common_init(struct Sbus *sbus_p, struct uart_periph *dev, gpio_port_t gpio_polarity_port, uint16_t gpio_polarity_pin)
Init function.
Definition sbus_common.c:74
void sbus_common_decode_event(struct Sbus *sbus_p, struct uart_periph *dev)
Decoding event function.
uint16_t ppm[SBUS_NB_CHANNEL]
Decoded and converted to ppm values.
Definition sbus_common.h:70
uint16_t pulses[SBUS_NB_CHANNEL]
Decoded values.
Definition sbus_common.h:69
bool rc_lost
RC reception is lost.
Definition sbus_common.h:73
bool rc_failsafe
Receiver set to in failsafe mode.
Definition sbus_common.h:72
bool frame_available
A data frame is available.
Definition sbus_common.h:71
#define SBUS_NB_CHANNEL
Definition sbus_common.h:63
SBUS structure.
Definition sbus_common.h:68
static const struct usb_device_descriptor dev
Definition usb_ser_hw.c:74
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition telemetry.c:51
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
Definition telemetry.h:66