Paparazzi UAS  v5.15_devel-230-gc96ce27
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 #ifndef RC_AVG_PERIOD
43 #define RC_AVG_PERIOD 8 /* TODO remove if IIR filter is used */
44 #endif
45 #ifndef RC_LOST_TIME
46 #define RC_LOST_TIME 30 /* 500ms with a 60Hz timer */
47 #endif
48 #ifndef RC_REALLY_LOST_TIME
49 #define RC_REALLY_LOST_TIME 60 /* ~1s */
50 #endif
51 /* Number of valid frames before going back to RC OK */
52 #ifndef RC_OK_CPT
53 #define RC_OK_CPT 15
54 #endif
55 
56 #define RC_OK 0
57 #define RC_LOST 1
58 #define RC_REALLY_LOST 2
59 
60 /* macro that can be used in the command laws */
61 #define RCValue(_x) radio_control.values[_x]
62 
63 struct RadioControl {
70 };
71 
72 extern struct RadioControl radio_control;
73 
74 #define RadioControlValues(_chan) radio_control.values[_chan]
75 extern void radio_control_init(void);
76 extern void radio_control_periodic_task(void);
77 
78 // Event implemented in radio_control/*.h
79 
80 
81 #endif /* RADIO_CONTROL */
82 
83 #endif /* RADIO_CONTROL_H */
uint8_t radio_ok_cpt
Definition: radio_control.h:66
uint8_t status
Definition: radio_control.h:64
int16_t pprz_t
Definition: paparazzi.h:6
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:69
#define RADIO_CONTROL_NB_CHANNEL
Definition: intermcu_ap.h:49
void radio_control_impl_init(void)
Main Radio initialization.
Definition: spektrum_arch.c:42
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:65
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:68
uint8_t frame_rate
Definition: radio_control.h:67