Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
radio_control.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006 Pascal Brisset, Antoine Drouin
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  */
22 
23 #ifndef RADIO_CONTROL_H
24 #define RADIO_CONTROL_H
25 
26 #include "led.h"
27 #include "generated/airframe.h"
28 #include "paparazzi.h"
29 
30 /* underlying hardware, also include if RADIO_CONTROL is not defined for ap in dual mcu case */
31 #include RADIO_CONTROL_TYPE_H
32 
33 /* RADIO_CONTROL_NB_CHANNEL needs to be defined to suitable default the implementation.
34  * If not all available channels are needed, can be overridden in airframe file.
35  */
36 
37 #if defined RADIO_CONTROL
38 /* must be defined by underlying hardware */
39 extern void radio_control_impl_init(void);
40 
41 /* timeouts - for now assumes 60Hz periodic */
42 #define RC_AVG_PERIOD 8 /* TODO remove if IIR filter is used */
43 #define RC_LOST_TIME 30 /* 500ms with a 60Hz timer */
44 #define RC_REALLY_LOST_TIME 60 /* ~1s */
45 /* Number of valid frames before going back to RC OK */
46 #define RC_OK_CPT 15
47 
48 #define RC_OK 0
49 #define RC_LOST 1
50 #define RC_REALLY_LOST 2
51 
52 struct RadioControl {
59 };
60 
61 extern struct RadioControl radio_control;
62 
63 #define RadioControlValues(_chan) radio_control.values[_chan]
64 extern void radio_control_init(void);
65 extern void radio_control_periodic_task(void);
66 
67 // Event implemented in radio_control/*.h
68 
69 
70 #endif /* RADIO_CONTROL */
71 
72 #endif /* RADIO_CONTROL_H */
uint8_t radio_ok_cpt
Definition: radio_control.h:55
uint8_t status
Definition: radio_control.h:53
int16_t pprz_t
Definition: paparazzi.h:6
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:58
void radio_control_impl_init(void)
Initialization.
Definition: spektrum_arch.c:30
#define RADIO_CONTROL_NB_CHANNEL
Definition: spektrum_arch.h:34
unsigned char uint8_t
Definition: types.h:14
arch independent LED (Light Emitting Diodes) API
uint8_t time_since_last_frame
Definition: radio_control.h:54
void radio_control_periodic_task(void)
Definition: radio_control.c:46
struct RadioControl radio_control
Definition: radio_control.c:30
uint8_t frame_cpt
Definition: radio_control.h:57
uint8_t frame_rate
Definition: radio_control.h:56