Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
spektrum.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009-2014 The Paparazzi Team
3  * 2015 Freek van Tienen <freek.v.tienen@gmail.com>
4  * 2018 Gautier Hattenberger <gautier.hattenberger@enac.fr>
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, see
20  * <http://www.gnu.org/licenses/>.
21  */
22 
29 #ifndef RADIO_CONTROL_SPEKTRUM_H
30 #define RADIO_CONTROL_SPEKTRUM_H
31 
32 #include "std.h"
33 
34 /* Include channels information */
35 #include "spektrum_radio.h"
36 
37 /* For now only two satellites are supported */
38 #define SPEKTRUM_SATELLITES_NB 2
39 
40 /* Timings and maximums of Spektrum DSM protocol */
41 #define SPEKTRUM_FRAME_LEN 16
42 #define SPEKTRUM_CHANNELS_PER_FRAME 7
43 #define SPEKTRUM_MAX_FRAMES 2
44 #define SPEKTRUM_MAX_CHANNELS (SPEKTRUM_CHANNELS_PER_FRAME * SPEKTRUM_MAX_FRAMES)
45 #define SPEKTRUM_MIN_FRAME_SPACE 7
46 
47 /* Per satellite we keep track of data */
49  bool valid;
55 };
56 
57 /* Main spektrum structure */
58 struct spektrum_t {
59  bool valid;
63 };
64 
65 /* External functions */
66 extern void spektrum_init(void);
67 extern void spektrum_event(void);
68 extern void spektrum_try_bind(void);
69 
70 #if USE_NPS
71 extern void radio_control_feed(void);
72 #endif
73 
74 #endif /* RADIO_CONTROL_SPEKTRUM_H */
void radio_control_feed(void)
Definition: ppm_arch.c:42
#define SPEKTRUM_MAX_CHANNELS
Definition: spektrum.h:44
int8_t signs[SPEKTRUM_NB_CHANNEL]
Signs for the RC channels.
Definition: spektrum.h:61
uint8_t lost_frame_cnt
Amount of RC frames lost.
Definition: spektrum.h:51
bool valid
True when we received a packet else false.
Definition: spektrum.h:59
#define SPEKTRUM_SATELLITES_NB
Definition: spektrum.h:38
void spektrum_event(void)
Checks if there is one valid satellite and sets the radio_control structure.
Definition: spektrum_arch.c:44
uint8_t idx
input buffer index
Definition: spektrum.h:53
struct spektrum_sat_t satellites[SPEKTRUM_SATELLITES_NB]
All the satellites connected.
Definition: spektrum.h:62
#define SPEKTRUM_FRAME_LEN
16 bytes in a standard frame
Definition: spektrum.h:41
bool valid
True when we received a packet else false.
Definition: spektrum.h:49
uint8_t buf[SPEKTRUM_FRAME_LEN]
input buffer
Definition: spektrum.h:52
int16_t values[SPEKTRUM_MAX_CHANNELS]
RC channel values.
Definition: spektrum.h:54
uint32_t timer
Timer to keep track of the UART synchronisation.
Definition: spektrum.h:50
void spektrum_init(void)
Main Radio initialization.
Definition: spektrum_arch.c:39
uint8_t tx_type
Transmitter type encoded (see wiki)
Definition: spektrum.h:60
void spektrum_try_bind(void)
Definition: spektrum_arch.c:55
Radio control channels defaults, because they are digital.
#define SPEKTRUM_NB_CHANNEL
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78
short int16_t
Typedef defining 16 bit short type.
Definition: vl53l1_types.h:93
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
signed char int8_t
Typedef defining 8 bit char type.
Definition: vl53l1_types.h:103