LP-500 HoTT Telemetry added device definitions
[librepilot.git] / flight / targets / boards / discoveryf4bare / pios_board.h
bloba6373ccd39179cae72678ea3c377596db6dc5a9a
1 /**
2 ******************************************************************************
3 * @addtogroup OpenPilotSystem OpenPilot System
4 * @{
5 * @addtogroup OpenPilotCore OpenPilot Core
6 * @{
7 * @file pios_board.h
8 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
9 * @brief Defines board hardware for the OpenPilot Version 1.1 hardware.
10 * @see The GNU Public License (GPL) Version 3
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef PIOS_BOARD_H
30 #define PIOS_BOARD_H
32 #include <stdbool.h>
33 // ------------------------
34 // Timers and Channels Used
35 // ------------------------
37 Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
38 ------+-----------+-----------+-----------+----------
39 TIM1 | | | |
40 TIM2 | --------------- PIOS_DELAY -----------------
41 TIM3 | | | |
42 TIM4 | | | |
43 TIM5 | | | |
44 TIM6 | | | |
45 TIM7 | | | |
46 TIM8 | | | |
47 ------+-----------+-----------+-----------+----------
50 // ------------------------
51 // DMA Channels Used
52 // ------------------------
53 /* Channel 1 - */
54 /* Channel 2 - SPI1 RX */
55 /* Channel 3 - SPI1 TX */
56 /* Channel 4 - SPI2 RX */
57 /* Channel 5 - SPI2 TX */
58 /* Channel 6 - */
59 /* Channel 7 - */
60 /* Channel 8 - */
61 /* Channel 9 - */
62 /* Channel 10 - */
63 /* Channel 11 - */
64 /* Channel 12 - */
66 // ------------------------
67 // BOOTLOADER_SETTINGS
68 // ------------------------
69 #define BOARD_READABLE true
70 #define BOARD_WRITABLE true
71 #define MAX_DEL_RETRYS 3
73 // ------------------------
74 // PIOS_LED
75 // ------------------------
76 #define PIOS_LED_HEARTBEAT 0
77 #define PIOS_LED_ALARM 1
79 #define PIOS_LED_D1 2
80 #define PIOS_LED_D2 3
81 #define PIOS_LED_D3 4
82 #define PIOS_LED_D4 5
84 // ------------------------
85 // PIOS_SPI
86 // See also pios_board.c
87 // ------------------------
88 #define PIOS_SPI_MAX_DEVS 3
90 // ------------------------
91 // PIOS_WDG
92 // ------------------------
93 #define PIOS_WATCHDOG_TIMEOUT 250
94 #define PIOS_WDG_REGISTER RTC_BKP_DR4
95 #define PIOS_WDG_ACTUATOR 0x0001
96 #define PIOS_WDG_STABILIZATION 0x0002
97 #define PIOS_WDG_ATTITUDE 0x0004
98 #define PIOS_WDG_MANUAL 0x0008
99 #define PIOS_WDG_SENSORS 0x0010
101 // ------------------------
102 // PIOS_I2C
103 // See also pios_board.c
104 // ------------------------
105 #define PIOS_I2C_MAX_DEVS 3
106 extern uint32_t pios_i2c_mag_pressure_adapter_id;
107 #define PIOS_I2C_MAIN_ADAPTER (pios_i2c_mag_pressure_adapter_id)
108 extern uint32_t pios_i2c_flexiport_adapter_id;
109 #define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id)
110 #define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER)
112 // -------------------------
113 // PIOS_USART
115 // See also pios_board.c
116 // -------------------------
117 #define PIOS_USART_MAX_DEVS 5
119 // -------------------------
120 // PIOS_COM
122 // See also pios_board.c
123 // -------------------------
124 #define PIOS_COM_MAX_DEVS 4
125 extern uint32_t pios_com_telem_rf_id;
126 extern uint32_t pios_com_gps_id;
127 extern uint32_t pios_com_telem_usb_id;
128 extern uint32_t pios_com_bridge_id;
129 extern uint32_t pios_com_vcp_id;
130 extern uint32_t pios_com_hkosd_id;
131 extern uint32_t pios_com_msp_id;
132 extern uint32_t pios_com_mavlink_id;
134 #define PIOS_COM_GPS (pios_com_gps_id)
135 #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
136 #define PIOS_COM_TELEM_RF (pios_com_telem_rf_id)
137 #define PIOS_COM_BRIDGE (pios_com_bridge_id)
138 #define PIOS_COM_VCP (pios_com_vcp_id)
139 #define PIOS_COM_OSDHK (pios_com_hkosd_id)
140 #define PIOS_COM_MSP (pios_com_msp_id)
141 #define PIOS_COM_MAVLINK (pios_com_mavlink_id)
143 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
144 extern uint32_t pios_com_debug_id;
145 #define PIOS_COM_DEBUG (pios_com_debug_id)
146 #endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
148 #if defined(PIOS_INCLUDE_RFM22B)
149 extern uint32_t pios_rfm22b_id;
150 extern uint32_t pios_spi_telem_flash_id;
151 #define PIOS_RFM22_SPI_PORT (pios_spi_telem_flash_id)
152 #endif /* PIOS_INCLUDE_RFM22B */
154 // -------------------------
155 // Packet Handler
156 // -------------------------
157 #define RS_ECC_NPARITY 4
158 #define PIOS_PH_MAX_PACKET 255
159 #define PIOS_PH_WIN_SIZE 3
160 #define PIOS_PH_MAX_CONNECTIONS 1
161 extern uint32_t pios_packet_handler;
162 #define PIOS_PACKET_HANDLER (pios_packet_handler)
164 // ------------------------
165 // TELEMETRY
166 // ------------------------
167 #define TELEM_QUEUE_SIZE 80
168 #define PIOS_TELEM_STACK_SIZE 800
170 // -------------------------
171 // System Settings
173 // See also System_stm32f4xx.c
174 // -------------------------
175 // These macros are deprecated
176 // please use PIOS_PERIPHERAL_APBx_CLOCK According to the table below
177 // #define PIOS_MASTER_CLOCK
178 // #define PIOS_PERIPHERAL_CLOCK
179 // #define PIOS_PERIPHERAL_CLOCK
181 #define PIOS_SYSCLK 168000000
182 // Peripherals that belongs to APB1 are:
183 // DAC |PWR |CAN1,2
184 // I2C1,2,3 |UART4,5 |USART3,2
185 // I2S3Ext |SPI3/I2S3 |SPI2/I2S2
186 // I2S2Ext |IWDG |WWDG
187 // RTC/BKP reg
188 // TIM2,3,4,5,6,7,12,13,14
190 // Calculated as SYSCLK / APBPresc * (APBPre == 1 ? 1 : 2)
191 // Default APB1 Prescaler = 4
192 #define PIOS_PERIPHERAL_APB1_CLOCK (PIOS_SYSCLK / 2)
194 // Peripherals belonging to APB2
195 // SDIO |EXTI |SYSCFG |SPI1
196 // ADC1,2,3
197 // USART1,6
198 // TIM1,8,9,10,11
200 // Default APB2 Prescaler = 2
202 #define PIOS_PERIPHERAL_APB2_CLOCK PIOS_SYSCLK
204 // -------------------------
205 // Interrupt Priorities
206 // -------------------------
207 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
208 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
209 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
210 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
211 // ------------------------
212 // PIOS_RCVR
213 // See also pios_board.c
214 // ------------------------
215 #define PIOS_RCVR_MAX_DEVS 3
216 #define PIOS_RCVR_MAX_CHANNELS 12
217 #define PIOS_GCSRCVR_TIMEOUT_MS 100
218 #define PIOS_RFM22B_RCVR_TIMEOUT_MS 200
219 #define PIOS_OPLINK_RCVR_TIMEOUT_MS 100
221 // -------------------------
222 // Receiver PPM input
223 // -------------------------
224 #define PIOS_PPM_MAX_DEVS 1
225 #define PIOS_PPM_NUM_INPUTS 16
227 // -------------------------
228 // Receiver PWM input
229 // -------------------------
230 #define PIOS_PWM_MAX_DEVS 1
231 #define PIOS_PWM_NUM_INPUTS 8
233 // -------------------------
234 // Receiver SPEKTRUM input
235 // -------------------------
236 #define PIOS_SPEKTRUM_MAX_DEVS 2
237 #define PIOS_SPEKTRUM_NUM_INPUTS 12
239 // -------------------------
240 // Receiver S.Bus input
241 // -------------------------
242 #define PIOS_SBUS_MAX_DEVS 1
243 #define PIOS_SBUS_NUM_INPUTS (16 + 2)
245 // -------------------------
246 // Receiver DSM input
247 // -------------------------
248 #define PIOS_DSM_MAX_DEVS 2
249 #define PIOS_DSM_NUM_INPUTS 12
251 // -------------------------
252 // Servo outputs
253 // -------------------------
254 #define PIOS_SERVO_UPDATE_HZ 50
255 #define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
256 #define PIOS_SERVO_BANKS 6
258 // --------------------------
259 // Timer controller settings
260 // --------------------------
261 #define PIOS_TIM_MAX_DEVS 6
263 // -------------------------
264 // ADC
265 // PIOS_ADC_PinGet(0) = Current sensor
266 // PIOS_ADC_PinGet(1) = Voltage sensor
267 // PIOS_ADC_PinGet(4) = VREF
268 // PIOS_ADC_PinGet(5) = Temperature sensor
269 // -------------------------
270 #define PIOS_DMA_PIN_CONFIG \
272 { GPIOC, GPIO_Pin_1, ADC_Channel_11, false }, \
273 { GPIOC, GPIO_Pin_2, ADC_Channel_12, false }, \
274 { NULL, 0, ADC_Channel_Vrefint, false }, /* Voltage reference */ \
275 { NULL, 0, ADC_Channel_TempSensor, false }, /* Temperature sensor */ \
278 /* we have to do all this to satisfy the PIOS_ADC_MAX_SAMPLES define in pios_adc.h */
279 /* which is annoying because this then determines the rate at which we generate buffer turnover events */
280 /* the objective here is to get enough buffer space to support 100Hz averaging rate */
281 #define PIOS_ADC_NUM_CHANNELS 4
282 #define PIOS_ADC_MAX_OVERSAMPLING 2
283 #define PIOS_ADC_USE_ADC2 0
285 #define PIOS_ADC_USE_TEMP_SENSOR
286 #define PIOS_ADC_TEMPERATURE_PIN 3
288 // -------------------------
289 // USB
290 // -------------------------
291 #define PIOS_USB_MAX_DEVS 1
292 #define PIOS_USB_ENABLED 1 /* Should remove all references to this */
293 #define PIOS_USB_HID_MAX_DEVS 1
295 #endif /* PIOS_BOARD_H */
298 * @}
299 * @}