Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
auto1_commands.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 OpenUAS
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 #include "auto1_commands.h"
24 #include "generated/airframe.h"
25 #include "autopilot.h"
26 #include "modules/core/commands.h"
27 #include "generated/modules.h" // for radio_control channels
28 
30 {
31  // Copy Radio commands in AUTO1
33 #ifdef COMMAND_GEAR
34 #ifndef RADIO_GEAR
35 #error auto1_commands COMMAND_GEAR needs RADIO_GEAR channel
36 #endif
37  command_set(COMMAND_GEAR, radio_control_get(RADIO_GEAR));
38 #endif
39 #ifdef COMMAND_FLAP
40 #ifndef RADIO_FLAP
41 #error auto1_commands COMMAND_FLAP needs RADIO_FLAP channel
42 #endif
43  command_set(COMMAND_FLAP, radio_control_get(RADIO_FLAP));
44 #endif
45 #ifdef COMMAND_AUX1
46 #ifndef RADIO_AUX1
47 #error auto1_commands COMMAND_AUX1 needs RADIO_AUX1 channel
48 #endif
49  command_set(COMMAND_AUX1, radio_control_get(RADIO_AUX1));
50 #endif
51 #ifdef COMMAND_AUX2
52 #ifndef RADIO_AUX2
53 #error auto1_commands COMMAND_AUX2 needs RADIO_AUX2 channel
54 #endif
55  command_set(COMMAND_AUX2, radio_control_get(RADIO_AUX2));
56 #endif
57 #ifdef COMMAND_AUX3
58 #ifndef RADIO_AUX3
59 #error auto1_commands COMMAND_AUX1 needs RADIO_AUX3 channel
60 #endif
61  command_set(COMMAND_AUX3, radio_control_get(RADIO_AUX3));
62 #endif
63 #ifdef COMMAND_AUX4
64 #ifndef RADIO_AUX4
65 #error auto1_commands COMMAND_AUX4 needs RADIO_AUX4 channel
66 #endif
67  command_set(COMMAND_AUX4, radio_control_get(RADIO_AUX4));
68 #endif
69 #ifdef COMMAND_AUX5
70 #ifndef RADIO_AUX5
71 #error auto1_commands COMMAND_AUX5 needs RADIO_AUX5 channel
72 #endif
73  command_set(COMMAND_AUX5, radio_control_get(RADIO_AUX5));
74 #endif
75 #ifdef COMMAND_AUX6
76 #ifndef RADIO_AUX6
77 #error auto1_commands COMMAND_AUX6 needs RADIO_AUX6 channel
78 #endif
79  command_set(COMMAND_AUX6, radio_control_get(RADIO_AUX6));
80 #endif
81 #ifdef COMMAND_AUX7
82 #ifndef RADIO_AUX7
83 #error auto1_commands COMMAND_AUX7 needs RADIO_AUX7 channel
84 #endif
85  command_set(COMMAND_AUX7, radio_control_get(RADIO_AUX7));
86 #endif
87 #ifdef COMMAND_BRAKE
88 #ifndef RADIO_BRAKE
89 #error auto1_commands COMMAND_BRAKE needs RADIO_BRAKE channel
90 #endif
91  command_set(COMMAND_BRAKE, radio_control_get(RADIO_BRAKE));
92 #endif
93 #ifdef COMMAND_HATCH
94 #ifndef RADIO_HATCH
95 #error auto1_commands COMMAND_HATCH needs RADIO_HATCH channel
96 #endif
97  command_set(COMMAND_HATCH, radio_control_get(RADIO_HATCH));
98 #endif
99  }
100 }
void periodic_auto1_commands(void)
Enable AUTO1 commands flaps and hatch from RC.
uint8_t autopilot_get_mode(void)
get autopilot mode
Definition: autopilot.c:217
Core autopilot interface common to all firmwares.
Hardware independent code for commands handling.
#define AP_MODE_AUTO1
static pprz_t radio_control_get(uint8_t idx)
Get a radio control channel value.
Definition: radio_control.h:94
#define RADIO_AUX3
Definition: rc_intermcu.h:43
#define RADIO_FLAP
#define RADIO_AUX7
#define RADIO_GEAR
#define RADIO_AUX5