uncrustification!
[librepilot.git] / flight / pios / pios.h
blobdb25c274d5280b72b80cd18c7e31fc14826bdc95
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 #include <pios_helpers.h>
38 #include <pios_math.h>
39 #include <pios_constants.h>
41 #ifdef USE_SIM_POSIX
42 /* SimPosix version of this file. This will probably be removed later */
43 #include <pios_sim_posix.h>
44 #else
46 /* C Lib includes */
47 #include <stdio.h>
48 #include <stdint.h>
49 #include <stdlib.h>
50 #include <stdarg.h>
51 #include <string.h>
52 #include <math.h>
54 /* STM32 Std Peripherals Lib */
55 #if defined(STM32F10X)
56 #include <stm32f10x.h>
57 #elif defined(STM32F4XX)
58 #include <stm32f4xx.h>
59 #include <stm32f4xx_rcc.h>
60 #elif defined(STM32F0)
61 #include <stm32f0xx.h>
62 #else
63 #error "No Architecture defined"
64 #endif
66 /* PIOS board specific feature selection */
67 #include "pios_config.h"
69 /* PIOS board specific device configuration */
70 #include "pios_board.h"
72 /* PIOS debug interface */
73 /* #define PIOS_INCLUDE_DEBUG_CONSOLE */
74 /* #define DEBUG_LEVEL 0 */
75 /* #define PIOS_ENABLE_DEBUG_PINS */
76 #include <pios_debug.h>
77 #include <pios_debuglog.h>
79 /* PIOS common functions */
80 #include <pios_crc.h>
82 /* PIOS FreeRTOS support */
83 #ifdef PIOS_INCLUDE_FREERTOS
84 #include "FreeRTOS.h"
85 #include "task.h"
86 #include "queue.h"
87 #include "semphr.h"
88 #endif
89 #include <stdbool.h>
91 #include <pios_mem.h>
93 #include <pios_architecture.h>
95 #ifdef PIOS_INCLUDE_TASK_MONITOR
96 #ifndef PIOS_INCLUDE_FREERTOS
97 #error PiOS Task Monitor requires PIOS_INCLUDE_FREERTOS to be defined
98 #endif
99 #include <pios_task_monitor.h>
100 #endif
102 /* PIOS CallbackScheduler */
103 #ifdef PIOS_INCLUDE_CALLBACKSCHEDULER
104 #ifndef PIOS_INCLUDE_FREERTOS
105 #error PiOS CallbackScheduler requires PIOS_INCLUDE_FREERTOS to be defined
106 #endif
107 #include <pios_callbackscheduler.h>
108 #endif
110 /* PIOS bootloader helper */
111 #ifdef PIOS_INCLUDE_BL_HELPER
112 /* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */
113 #include <pios_bl_helper.h>
114 #endif
116 /* PIOS system functions */
117 #ifdef PIOS_INCLUDE_DELAY
118 #include <pios_delay.h>
119 #include <pios_deltatime.h>
120 #endif
122 #ifdef PIOS_INCLUDE_INITCALL
123 #include "pios_initcall.h"
124 #endif
126 #ifdef PIOS_INCLUDE_SYS
127 #include <pios_sys.h>
128 #endif
130 /* PIOS hardware peripherals */
131 #ifdef PIOS_INCLUDE_IRQ
132 #include <pios_irq.h>
133 #endif
135 #ifdef PIOS_INCLUDE_RTC
136 #include <pios_rtc.h>
137 #endif
139 #ifdef PIOS_INCLUDE_TIM
140 #include <pios_tim.h>
141 #endif
143 #ifdef PIOS_INCLUDE_USART
144 #include <pios_usart.h>
145 #endif
147 #ifdef PIOS_INCLUDE_ADC
148 #include <pios_adc.h>
149 #endif
151 #ifdef PIOS_INCLUDE_I2C
152 #include <pios_i2c.h>
153 #endif
155 #ifdef PIOS_INCLUDE_SPI
156 #include <pios_spi.h>
157 #endif
159 #ifdef PIOS_INCLUDE_GPIO
160 #include <pios_gpio.h>
161 #endif
163 #ifdef PIOS_INCLUDE_EXTI
164 #include <pios_exti.h>
165 #endif
167 #ifdef PIOS_INCLUDE_WDG
168 #include <pios_wdg.h>
169 #endif
171 /* PIOS USB functions */
172 #ifdef PIOS_INCLUDE_USB
173 /* #define PIOS_INCLUDE_USB_HID */
174 /* #define PIOS_INCLUDE_USB_CDC */
175 /* #define PIOS_INCLUDE_USB_RCTX */
176 #include <pios_usb.h>
177 #ifdef PIOS_INCLUDE_USB_HID
178 #include <pios_usb_hid.h>
179 #endif
180 #ifdef PIOS_INCLUDE_USB_RCTX
181 #include <pios_usb_rctx.h>
182 #endif
183 #endif
185 /* PIOS sensor interfaces */
186 #ifdef PIOS_INCLUDE_ADXL345
187 /* ADXL345 3-Axis Accelerometer */
188 #include <pios_adxl345.h>
189 #endif
191 #ifdef PIOS_INCLUDE_BMA180
192 /* BMA180 3-Axis Accelerometer */
193 #include <pios_bma180.h>
194 #endif
196 #ifdef PIOS_INCLUDE_L3GD20
197 /* L3GD20 3-Axis Gyro */
198 #include <pios_l3gd20.h>
199 #endif
201 #ifdef PIOS_INCLUDE_MPU6000
202 /* MPU6000 3-Axis Gyro/Accelerometer */
203 /* #define PIOS_MPU6000_ACCEL */
204 #include <pios_mpu6000.h>
205 #endif
207 #ifdef PIOS_INCLUDE_HMC5843
208 /* HMC5843 3-Axis Digital Compass */
209 #include <pios_hmc5843.h>
210 #endif
212 #ifdef PIOS_INCLUDE_HMC5X83
213 /* HMC5883/HMC5983 3-Axis Digital Compass */
214 /* #define PIOS_HMC5x83_HAS_GPIOS */
215 #include <pios_hmc5x83.h>
216 #endif
218 #ifdef PIOS_INCLUDE_BMP085
219 /* BMP085 Barometric Pressure Sensor */
220 #include <pios_bmp085.h>
221 #endif
223 #ifdef PIOS_INCLUDE_MS5611
224 /* MS5611 Barometric Pressure Sensor */
225 #include <pios_ms5611.h>
226 #endif
228 #ifdef PIOS_INCLUDE_MPXV
229 /* MPXV5004, MPXV7002 based Airspeed Sensor */
230 #include <pios_mpxv.h>
231 #endif
233 #ifdef PIOS_INCLUDE_ETASV3
234 /* Eagle Tree Systems Airspeed MicroSensor V3 */
235 #include <pios_etasv3.h>
236 #endif
238 #ifdef PIOS_INCLUDE_MS4525DO
239 /* PixHawk Airspeed Sensor based on MS4525DO */
240 #include <pios_ms4525do.h>
241 #endif
244 #ifdef PIOS_INCLUDE_HCSR04
245 /* HC-SR04 Ultrasonic Sensor */
246 #include <pios_hcsr04.h>
247 #endif
249 /* PIOS receiver drivers */
250 #ifdef PIOS_INCLUDE_PWM
251 #include <pios_pwm.h>
252 #endif
254 #ifdef PIOS_INCLUDE_PPM
255 #include <pios_ppm.h>
256 #endif
258 #ifdef PIOS_INCLUDE_PPM_FLEXI
259 /* PPM on CC flexi port */
260 #endif
262 #ifdef PIOS_INCLUDE_DSM
263 #include <pios_dsm.h>
264 #endif
266 #ifdef PIOS_INCLUDE_SBUS
267 #include <pios_sbus.h>
268 #endif
270 /* PIOS abstract receiver interface */
271 #ifdef PIOS_INCLUDE_RCVR
272 #include <pios_rcvr.h>
273 #endif
275 /* PIOS common peripherals */
276 #ifdef PIOS_INCLUDE_LED
277 #include <pios_led.h>
278 #endif
280 #ifdef PIOS_INCLUDE_IAP
281 #include <pios_iap.h>
282 #endif
284 #ifdef PIOS_INCLUDE_SERVO
285 #include <pios_servo.h>
286 #endif
288 #ifdef PIOS_INCLUDE_I2C_ESC
289 #include <pios_i2c_esc.h>
290 #endif
292 #ifdef PIOS_INCLUDE_OVERO
293 /* #define PIOS_OVERO_SPI */
294 #include <pios_overo.h>
295 #endif
297 #ifdef PIOS_INCLUDE_SDCARD
298 /* #define LOG_FILENAME "startup.log" */
299 #include <dosfs.h>
300 #include <pios_sdcard.h>
301 #endif
303 #ifdef PIOS_INCLUDE_FLASH
304 /* #define PIOS_INCLUDE_FLASH_LOGFS_SETTINGS */
305 /* #define FLASH_FREERTOS */
306 #include <pios_flash.h>
307 #include <pios_flashfs.h>
308 #endif
310 /* driver for storage on internal flash */
311 /* #define PIOS_INCLUDE_FLASH_INTERNAL */
313 #ifdef PIOS_INCLUDE_FLASH_EEPROM
314 #include <pios_eeprom.h>
315 #endif
317 /* PIOS radio modules */
318 #ifdef PIOS_INCLUDE_RFM22B
319 /* #define PIOS_INCLUDE_PPM_OUT */
320 /* #define PIOS_RFM22B_DEBUG_ON_TELEM */
321 #include <pios_rfm22b.h>
322 #ifdef PIOS_INCLUDE_RFM22B_COM
323 #include <pios_rfm22b_com.h>
324 #endif
325 #endif /* PIOS_INCLUDE_RFM22B */
327 /* PIOS misc peripherals */
328 #ifdef PIOS_INCLUDE_VIDEO
329 #include <pios_video.h>
330 #endif
332 #ifdef PIOS_INCLUDE_WAVE
333 #include <pios_wavplay.h>
334 #endif
336 #ifdef PIOS_INCLUDE_UDP
337 #include <pios_udp.h>
338 #endif
340 /* PIOS abstract comms interface with options */
341 #ifdef PIOS_INCLUDE_COM
342 /* #define PIOS_INCLUDE_COM_MSG */
343 /* #define PIOS_INCLUDE_TELEMETRY_RF */
344 /* #define PIOS_INCLUDE_COM_TELEM */
345 /* #define PIOS_INCLUDE_COM_FLEXI */
346 /* #define PIOS_INCLUDE_COM_AUX */
347 /* #define PIOS_TELEM_PRIORITY_QUEUE */
348 /* #define PIOS_INCLUDE_GPS */
349 /* #define PIOS_GPS_MINIMAL */
350 /* #define PIOS_INCLUDE_GPS_NMEA_PARSER */
351 /* #define PIOS_INCLUDE_GPS_UBX_PARSER */
352 /* #define PIOS_GPS_SETS_HOMELOCATION */
353 #include <pios_com.h>
354 #endif
356 /* Stabilization options */
357 /* #define PIOS_QUATERNION_STABILIZATION */
359 /* Performance counters */
360 /* #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 995998 */
362 #endif /* USE_SIM_POSIX */
363 #endif /* PIOS_H */