Paparazzi UAS  v5.15_devel-99-g2ff7410
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 /* Set the event function to the correct */
48 #define RadioControlEvent(_received_frame_handler) spektrum_event(_received_frame_handler)
49 
50 /* Per satellite we keep track of data */
52  bool valid;
58 };
59 
60 /* Main spektrum structure */
61 struct spektrum_t {
62  bool valid;
66 };
67 
68 /* External functions */
69 extern void spektrum_event(void (*_received_frame_handler)(void));
70 extern void spektrum_try_bind(void);
71 
72 #endif /* RADIO_CONTROL_SPEKTRUM_H */
#define SPEKTRUM_MAX_CHANNELS
Definition: spektrum.h:44
struct spektrum_sat_t satellites[SPEKTRUM_SATELLITES_NB]
All the satellites connected.
Definition: spektrum.h:65
#define RADIO_CONTROL_NB_CHANNEL
Definition: intermcu_ap.h:49
uint8_t buf[SPEKTRUM_FRAME_LEN]
input buffer
Definition: spektrum.h:55
bool valid
True when we received a packet else false.
Definition: spektrum.h:62
unsigned long uint32_t
Definition: types.h:18
signed short int16_t
Definition: types.h:17
uint32_t timer
Timer to keep track of the UART synchronisation.
Definition: spektrum.h:53
#define SPEKTRUM_FRAME_LEN
16 bytes in a standard frame
Definition: spektrum.h:41
uint8_t lost_frame_cnt
Amount of RC frames lost.
Definition: spektrum.h:54
uint8_t tx_type
Transmitter type encoded (see wiki)
Definition: spektrum.h:63
void spektrum_try_bind(void)
Definition: spektrum_arch.c:57
#define SPEKTRUM_SATELLITES_NB
Definition: spektrum.h:38
int8_t signs[RADIO_CONTROL_NB_CHANNEL]
Signs for the RC channels.
Definition: spektrum.h:64
unsigned char uint8_t
Definition: types.h:14
int16_t values[SPEKTRUM_MAX_CHANNELS]
RC channel values.
Definition: spektrum.h:57
bool valid
True when we received a packet else false.
Definition: spektrum.h:52
uint8_t idx
input buffer index
Definition: spektrum.h:56
void spektrum_event(void(*_received_frame_handler)(void))
Checks if there is one valid satellite and sets the radio_control structure.
Definition: spektrum_arch.c:46
signed char int8_t
Definition: types.h:15
Radio control channels defaults, because they are digital.