OP-1900 manual induced autotakeoff sequencing safer for multis and fixed wing
[librepilot.git] / flight / pios / pios.h
blobed3e8fd52348ac8136324fb3f43e26164fe49c80
1 /**
2 ******************************************************************************
3 * @file pios.h
4 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2013
5 * @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
6 * @brief Main PiOS header.
7 * @see The GNU Public License (GPL) Version 3
8 *****************************************************************************/
9 /*
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 * To add new PIOS options, drivers or functions please insert their
27 * includes below into a corresponding group. If new driver has optional
28 * features, add them as comments before including the driver header.
29 * Finally update all pios_config.h files for every board in the same order
30 * as in this file. Include new definition and all options, but comment
31 * out unused ones.
34 #ifndef PIOS_H
35 #define PIOS_H
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
41 #include <pios_helpers.h>
42 #include <pios_math.h>
43 #include <pios_constants.h>
45 #ifdef USE_SIM_POSIX
46 /* SimPosix version of this file. This will probably be removed later */
47 #include <pios_sim_posix.h>
48 #else
50 /* C Lib includes */
51 #include <stdio.h>
52 #include <stdint.h>
53 #include <stdlib.h>
54 #include <stdarg.h>
55 #include <string.h>
56 #include <math.h>
58 /* STM32 Std Peripherals Lib */
59 #if defined(STM32F10X)
60 #include <stm32f10x.h>
61 #elif defined(STM32F4XX)
62 #include <stm32f4xx.h>
63 #include <stm32f4xx_rcc.h>
64 #elif defined(STM32F0)
65 #include <stm32f0xx.h>
66 #else
67 #error "No Architecture defined"
68 #endif
70 /* PIOS board specific feature selection */
71 #include "pios_config.h"
73 /* PIOS board specific device configuration */
74 #include "pios_board.h"
76 /* PIOS debug interface */
77 /* #define PIOS_INCLUDE_DEBUG_CONSOLE */
78 /* #define DEBUG_LEVEL 0 */
79 /* #define PIOS_ENABLE_DEBUG_PINS */
80 #include <pios_debug.h>
81 #include <pios_debuglog.h>
83 /* PIOS common functions */
84 #include <pios_crc.h>
86 /* PIOS FreeRTOS support */
87 #ifdef PIOS_INCLUDE_FREERTOS
88 #include "FreeRTOS.h"
89 #include "task.h"
90 #include "queue.h"
91 #include "semphr.h"
92 #endif
93 #include <stdbool.h>
95 #include <pios_mem.h>
97 #include <pios_architecture.h>
99 #ifdef PIOS_INCLUDE_TASK_MONITOR
100 #ifndef PIOS_INCLUDE_FREERTOS
101 #error PiOS Task Monitor requires PIOS_INCLUDE_FREERTOS to be defined
102 #endif
103 #include <pios_task_monitor.h>
104 #endif
106 /* PIOS CallbackScheduler */
107 #ifdef PIOS_INCLUDE_CALLBACKSCHEDULER
108 #ifndef PIOS_INCLUDE_FREERTOS
109 #error PiOS CallbackScheduler requires PIOS_INCLUDE_FREERTOS to be defined
110 #endif
111 #include <pios_callbackscheduler.h>
112 #endif
114 /* PIOS bootloader helper */
115 #ifdef PIOS_INCLUDE_BL_HELPER
116 /* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */
117 #include <pios_bl_helper.h>
118 #endif
120 /* PIOS system functions */
121 #ifdef PIOS_INCLUDE_DELAY
122 #include <pios_delay.h>
123 #include <pios_deltatime.h>
124 #endif
126 #ifdef PIOS_INCLUDE_INITCALL
127 #include "pios_initcall.h"
128 #endif
130 #ifdef PIOS_INCLUDE_SYS
131 #include <pios_sys.h>
132 #endif
134 /* PIOS hardware peripherals */
135 #ifdef PIOS_INCLUDE_IRQ
136 #include <pios_irq.h>
137 #endif
139 #ifdef PIOS_INCLUDE_RTC
140 #include <pios_rtc.h>
141 #endif
143 #ifdef PIOS_INCLUDE_TIM
144 #include <pios_tim.h>
145 #endif
147 #ifdef PIOS_INCLUDE_USART
148 #include <pios_usart.h>
149 #endif
151 #ifdef PIOS_INCLUDE_ADC
152 #include <pios_adc.h>
153 #endif
155 #ifdef PIOS_INCLUDE_I2C
156 #include <pios_i2c.h>
157 #endif
159 #ifdef PIOS_INCLUDE_SPI
160 #include <pios_spi.h>
161 #endif
163 #ifdef PIOS_INCLUDE_GPIO
164 #include <pios_gpio.h>
165 #endif
167 #ifdef PIOS_INCLUDE_EXTI
168 #include <pios_exti.h>
169 #endif
171 #ifdef PIOS_INCLUDE_WDG
172 #include <pios_wdg.h>
173 #endif
175 /* PIOS USB functions */
176 #ifdef PIOS_INCLUDE_USB
177 /* #define PIOS_INCLUDE_USB_HID */
178 /* #define PIOS_INCLUDE_USB_CDC */
179 /* #define PIOS_INCLUDE_USB_RCTX */
180 #include <pios_usb.h>
181 #ifdef PIOS_INCLUDE_USB_HID
182 #include <pios_usb_hid.h>
183 #endif
184 #ifdef PIOS_INCLUDE_USB_RCTX
185 #include <pios_usb_rctx.h>
186 #endif
187 #endif
189 #ifdef PIOS_INCLUDE_MPXV
190 /* MPXV5004, MPXV7002 based Airspeed Sensor */
191 #include <pios_mpxv.h>
192 #endif
194 #ifdef PIOS_INCLUDE_ETASV3
195 /* Eagle Tree Systems Airspeed MicroSensor V3 */
196 #include <pios_etasv3.h>
197 #endif
199 #ifdef PIOS_INCLUDE_MS4525DO
200 /* PixHawk Airspeed Sensor based on MS4525DO */
201 #include <pios_ms4525do.h>
202 #endif
205 #ifdef PIOS_INCLUDE_HCSR04
206 /* HC-SR04 Ultrasonic Sensor */
207 #include <pios_hcsr04.h>
208 #endif
210 /* PIOS receiver drivers */
211 #ifdef PIOS_INCLUDE_PWM
212 #include <pios_pwm.h>
213 #endif
215 #ifdef PIOS_INCLUDE_PPM
216 #include <pios_ppm.h>
217 #endif
219 #ifdef PIOS_INCLUDE_PPM_FLEXI
220 /* PPM on CC flexi port */
221 #endif
223 #ifdef PIOS_INCLUDE_DSM
224 #include <pios_dsm.h>
225 #endif
227 #ifdef PIOS_INCLUDE_SBUS
228 #include <pios_sbus.h>
229 #endif
231 #ifdef PIOS_INCLUDE_SRXL
232 #include <pios_srxl.h>
233 #endif
235 /* PIOS abstract receiver interface */
236 #ifdef PIOS_INCLUDE_RCVR
237 #include <pios_rcvr.h>
238 #endif
240 /* PIOS common peripherals */
241 #ifdef PIOS_INCLUDE_LED
242 #include <pios_led.h>
243 #endif
245 #ifdef PIOS_INCLUDE_IAP
246 #include <pios_iap.h>
247 #endif
249 #ifdef PIOS_INCLUDE_SERVO
250 #include <pios_servo.h>
251 #endif
253 #ifdef PIOS_INCLUDE_I2C_ESC
254 #include <pios_i2c_esc.h>
255 #endif
257 #ifdef PIOS_INCLUDE_OVERO
258 /* #define PIOS_OVERO_SPI */
259 #include <pios_overo.h>
260 #endif
262 #ifdef PIOS_INCLUDE_SDCARD
263 /* #define LOG_FILENAME "startup.log" */
264 #include <dosfs.h>
265 #include <pios_sdcard.h>
266 #endif
268 #ifdef PIOS_INCLUDE_FLASH
269 /* #define PIOS_INCLUDE_FLASH_LOGFS_SETTINGS */
270 /* #define FLASH_FREERTOS */
271 #include <pios_flash.h>
272 #include <pios_flashfs.h>
273 #endif
275 /* driver for storage on internal flash */
276 /* #define PIOS_INCLUDE_FLASH_INTERNAL */
278 #ifdef PIOS_INCLUDE_FLASH_EEPROM
279 #include <pios_flash_eeprom.h>
280 #endif
282 /* PIOS radio modules */
283 #ifdef PIOS_INCLUDE_RFM22B
284 /* #define PIOS_INCLUDE_PPM_OUT */
285 /* #define PIOS_RFM22B_DEBUG_ON_TELEM */
286 #include <pios_rfm22b.h>
287 #ifdef PIOS_INCLUDE_RFM22B_COM
288 #include <pios_rfm22b_com.h>
289 #endif
290 #endif /* PIOS_INCLUDE_RFM22B */
292 /* PIOS misc peripherals */
293 #ifdef PIOS_INCLUDE_VIDEO
294 #include <pios_video.h>
295 #endif
297 #ifdef PIOS_INCLUDE_WAVE
298 #include <pios_wavplay.h>
299 #endif
301 #ifdef PIOS_INCLUDE_UDP
302 #include <pios_udp.h>
303 #endif
305 /* PIOS abstract comms interface with options */
306 #ifdef PIOS_INCLUDE_COM
307 /* #define PIOS_INCLUDE_COM_MSG */
308 /* #define PIOS_INCLUDE_TELEMETRY_RF */
309 /* #define PIOS_INCLUDE_COM_TELEM */
310 /* #define PIOS_INCLUDE_COM_FLEXI */
311 /* #define PIOS_INCLUDE_COM_AUX */
312 /* #define PIOS_TELEM_PRIORITY_QUEUE */
313 /* #define PIOS_INCLUDE_GPS */
314 /* #define PIOS_GPS_MINIMAL */
315 /* #define PIOS_INCLUDE_GPS_NMEA_PARSER */
316 /* #define PIOS_INCLUDE_GPS_UBX_PARSER */
317 /* #define PIOS_GPS_SETS_HOMELOCATION */
318 #include <pios_com.h>
319 #endif
321 /* Stabilization options */
322 /* #define PIOS_QUATERNION_STABILIZATION */
324 /* Performance counters */
325 /* #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 995998 */
327 #endif /* USE_SIM_POSIX */
330 #ifdef __cplusplus
331 } // closing brace for extern "C"
332 #endif
334 #endif /* PIOS_H */