Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
commands.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006 Pascal Brisset, Antoine Drouin
3  * Copyright (C) 2021 Gautier Hattenberger <gautier.hattenberger@enac.fr>
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, see
19  * <http://www.gnu.org/licenses/>.
20  *
21  */
22 
28 #ifndef COMMANDS_H
29 #define COMMANDS_H
30 
31 #include "paparazzi.h"
32 #include "generated/airframe.h"
33 
34 #if COMMANDS_NB // commands are defined and nb is > 0
35 
40 extern pprz_t commands[COMMANDS_NB];
41 extern const pprz_t commands_failsafe[COMMANDS_NB];
42 
48 
49 // Set all commands from array
50 #define SetCommands(t) { \
51  int i; \
52  for(i = 0; i < COMMANDS_NB; i++) commands[i] = t[i]; \
53  }
54 
59 static inline void command_set(uint8_t idx, pprz_t value)
60 {
61  if (idx < COMMANDS_NB) {
62  // Bound value ???
63  commands[idx] = value;
64  }
65 }
66 
71 static inline pprz_t command_get(uint8_t idx)
72 {
73  if (idx < COMMANDS_NB) {
74  return commands[idx];
75  }
76  return 0; // is it the best value ???
77 }
78 
79 #endif
80 
81 extern void commands_init(void);
82 
83 #endif /* COMMANDS_H */
pprz_t command_pitch_trim
Definition: commands.c:34
const pprz_t commands_failsafe[COMMANDS_NB]
Definition: commands.c:31
pprz_t commands[COMMANDS_NB]
Definition: commands.c:30
pprz_t command_roll_trim
Definition: commands.c:33
pprz_t command_yaw_trim
Definition: commands.c:35
void commands_init(void)
Definition: commands.c:46
static uint32_t idx
int16_t pprz_t
Definition: paparazzi.h:6
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98