2 ******************************************************************************
5 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2017.
6 * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
8 * @brief Defines board hardware for the OpenPilot Version 1.1 hardware.
9 * @see The GNU Public License (GPL) Version 3
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 // ------------------------
31 // Timers and Channels Used
32 // ------------------------
34 Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
35 ------+-----------+-----------+-----------+----------
37 TIM2 | RC In 5 | RC In 6 | Servo 6 |
38 TIM3 | Servo 5 | RC In 2 | RC In 3 | RC In 4
39 TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1
40 ------+-----------+-----------+-----------+----------
43 // ------------------------
45 // ------------------------
59 // ------------------------
60 // BOOTLOADER_SETTINGS
61 // ------------------------
62 #define BOARD_READABLE true
63 #define BOARD_WRITABLE true
64 #define MAX_DEL_RETRYS 3
66 // ------------------------
68 // ------------------------
69 #define PIOS_WATCHDOG_TIMEOUT 250
70 #define PIOS_WDG_REGISTER RTC_BKP_DR4
71 #define PIOS_WDG_ACTUATOR 0x0001
72 #define PIOS_WDG_STABILIZATION 0x0002
73 #define PIOS_WDG_ATTITUDE 0x0004
74 #define PIOS_WDG_MANUAL 0x0008
75 #define PIOS_WDG_AUTOTUNE 0x0010
76 #define PIOS_WDG_SENSORS 0x0020
79 // ------------------------
81 // ------------------------
82 #define TELEM_QUEUE_SIZE 10
84 // ------------------------
86 // ------------------------
87 #define PIOS_LED_HEARTBEAT 0
89 // -------------------------
91 // -------------------------
92 #define PIOS_MASTER_CLOCK 72000000
93 #define PIOS_PERIPHERAL_CLOCK (PIOS_MASTER_CLOCK / 2)
95 // -------------------------
96 // Interrupt Priorities
97 // -------------------------
98 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
99 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
100 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
101 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
102 // ------------------------
104 // See also pios_board.c
105 // ------------------------
106 #define PIOS_I2C_MAX_DEVS 1
107 #define PIOS_I2C_EXTERNAL_ADAPTER (0)
108 #define PIOS_I2C_FLEXI_ADAPTER (0)
110 // ------------------------
112 // ------------------------
113 #define PIOS_BMP085_OVERSAMPLING 3
115 // -------------------------
118 // See also pios_board.c
119 // -------------------------
120 #define PIOS_SPI_MAX_DEVS 2
121 extern uint32_t pios_spi_gyro_id
;
122 #define PIOS_SPI_MPU6000_ADAPTER (pios_spi_gyro_id)
123 // -------------------------
125 // -------------------------
126 #define PIOS_USART_MAX_DEVS 2
128 // -------------------------
131 // See also pios_board.c
132 // -------------------------
133 #define PIOS_COM_MAX_DEVS 3
135 #ifdef PIOS_INCLUDE_WS2811
136 extern uint32_t pios_ws2811_id
;
137 #define PIOS_WS2811_DEVICE (pios_ws2811_id)
140 // -------------------------
142 // PIOS_ADC_PinGet(0) = Gyro Z
143 // PIOS_ADC_PinGet(1) = Gyro Y
144 // PIOS_ADC_PinGet(2) = Gyro X
145 // -------------------------
146 // #define PIOS_ADC_OVERSAMPLING_RATE 1
147 #define PIOS_ADC_USE_TEMP_SENSOR 1
148 #define PIOS_ADC_TEMP_SENSOR_ADC ADC1
149 #define PIOS_ADC_TEMP_SENSOR_ADC_CHANNEL 1
151 #define PIOS_ADC_PIN1_GPIO_PORT GPIOA // PA4 (Gyro X)
152 #define PIOS_ADC_PIN1_GPIO_PIN GPIO_Pin_4 // ADC12_IN4
153 #define PIOS_ADC_PIN1_GPIO_CHANNEL ADC_Channel_4
154 #define PIOS_ADC_PIN1_ADC ADC2
155 #define PIOS_ADC_PIN1_ADC_NUMBER 1
157 #define PIOS_ADC_PIN2_GPIO_PORT GPIOA // PA5 (Gyro Y)
158 #define PIOS_ADC_PIN2_GPIO_PIN GPIO_Pin_5 // ADC123_IN5
159 #define PIOS_ADC_PIN2_GPIO_CHANNEL ADC_Channel_5
160 #define PIOS_ADC_PIN2_ADC ADC1
161 #define PIOS_ADC_PIN2_ADC_NUMBER 2
163 #define PIOS_ADC_PIN3_GPIO_PORT GPIOA // PA3 (Gyro Z)
164 #define PIOS_ADC_PIN3_GPIO_PIN GPIO_Pin_3 // ADC12_IN3
165 #define PIOS_ADC_PIN3_GPIO_CHANNEL ADC_Channel_3
166 #define PIOS_ADC_PIN3_ADC ADC2
167 #define PIOS_ADC_PIN3_ADC_NUMBER 2
169 #define PIOS_ADC_NUM_PINS 3
171 #define PIOS_ADC_PORTS { PIOS_ADC_PIN1_GPIO_PORT, PIOS_ADC_PIN2_GPIO_PORT, PIOS_ADC_PIN3_GPIO_PORT }
172 #define PIOS_ADC_PINS { PIOS_ADC_PIN1_GPIO_PIN, PIOS_ADC_PIN2_GPIO_PIN, PIOS_ADC_PIN3_GPIO_PIN }
173 #define PIOS_ADC_CHANNELS { PIOS_ADC_PIN1_GPIO_CHANNEL, PIOS_ADC_PIN2_GPIO_CHANNEL, PIOS_ADC_PIN3_GPIO_CHANNEL }
174 #define PIOS_ADC_MAPPING { PIOS_ADC_PIN1_ADC, PIOS_ADC_PIN2_ADC, PIOS_ADC_PIN3_ADC }
175 #define PIOS_ADC_CHANNEL_MAPPING { PIOS_ADC_PIN1_ADC_NUMBER, PIOS_ADC_PIN2_ADC_NUMBER, PIOS_ADC_PIN3_ADC_NUMBER }
176 #define PIOS_ADC_NUM_CHANNELS (PIOS_ADC_NUM_PINS + PIOS_ADC_USE_TEMP_SENSOR)
177 #define PIOS_ADC_NUM_ADC_CHANNELS 2
178 #define PIOS_ADC_USE_ADC2 1
179 #define PIOS_ADC_CLOCK_FUNCTION RCC_AHBPeriphClockCmd(RCC_AHBPeriph_ADC12, ENABLE)
180 #define PIOS_ADC_ADCCLK RCC_ADC12PLLCLK_Div32
181 /* RCC_PCLK2_Div2: ADC clock = PCLK2/2 */
182 /* RCC_PCLK2_Div4: ADC clock = PCLK2/4 */
183 /* RCC_PCLK2_Div6: ADC clock = PCLK2/6 */
184 /* RCC_PCLK2_Div8: ADC clock = PCLK2/8 */
185 #define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_181Cycles5
187 /* With an ADCCLK = 14 MHz and a sampling time of 239.5 cycles: */
188 /* Tconv = 239.5 + 12.5 = 252 cycles = 18�s */
189 /* (1 / (ADCCLK / CYCLES)) = Sample Time (�S) */
190 #define PIOS_ADC_IRQ_PRIO PIOS_IRQ_PRIO_LOW
192 // Currently analog acquistion hard coded at 480 Hz
194 // ADCCLK = PCLK2 / 2
195 #define PIOS_ADC_RATE (72.0e6f / 1.0f / 8.0f / 252.0f / (PIOS_ADC_NUM_CHANNELS >> PIOS_ADC_USE_ADC2))
196 #define PIOS_ADC_MAX_OVERSAMPLING 48
198 #define PIOS_ADC_TEMPERATURE_PIN 0
200 // ------------------------
202 // See also pios_board.c
203 // ------------------------
204 #define PIOS_RCVR_MAX_DEVS 3
205 #define PIOS_RCVR_MAX_CHANNELS 12
206 #define PIOS_GCSRCVR_TIMEOUT_MS 100
208 // -------------------------
209 // Receiver PPM input
210 // -------------------------
211 #define PIOS_PPM_MAX_DEVS 1
212 #define PIOS_PPM_NUM_INPUTS 16
214 // -------------------------
215 // Receiver PWM input
216 // -------------------------
217 #define PIOS_PWM_MAX_DEVS 1
218 #define PIOS_PWM_NUM_INPUTS 6
220 // -------------------------
221 // Receiver DSM input
222 // -------------------------
223 #define PIOS_DSM_MAX_DEVS 2
224 #define PIOS_DSM_NUM_INPUTS 12
226 // -------------------------
227 // Receiver S.Bus input
228 // -------------------------
229 #define PIOS_SBUS_MAX_DEVS 1
230 #define PIOS_SBUS_NUM_INPUTS (16 + 2)
232 // -------------------------
233 // Receiver HOTT input
234 // -------------------------
235 #define PIOS_HOTT_MAX_DEVS 1
236 #define PIOS_HOTT_NUM_INPUTS 32
238 // -------------------------
239 // Receiver EX.Bus input
240 // -------------------------
241 #define PIOS_EXBUS_MAX_DEVS 1
242 #define PIOS_EXBUS_NUM_INPUTS 16
244 // -------------------------
245 // Receiver Multiplex SRXL input
246 // -------------------------
247 #define PIOS_SRXL_MAX_DEVS 1
248 #define PIOS_SRXL_NUM_INPUTS 16
250 // -------------------------
251 // Receiver FlySky IBus input
252 // -------------------------
253 #define PIOS_IBUS_MAX_DEVS 1
254 #define PIOS_IBUS_NUM_INPUTS 10
256 // -------------------------
258 // -------------------------
259 #define PIOS_SERVO_UPDATE_HZ 50
260 #define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
261 #define PIOS_SERVO_BANKS 6
263 // --------------------------
264 // Timer controller settings
265 // --------------------------
266 #define PIOS_TIM_MAX_DEVS 3
268 // -------------------------
270 // -------------------------
271 #define PIOS_GPIO_PORTS {}
272 #define PIOS_GPIO_PINS {}
273 #define PIOS_GPIO_CLKS {}
274 #define PIOS_GPIO_NUM 0
276 // -------------------------
278 // -------------------------
279 #define PIOS_USB_HID_MAX_DEVS 1
281 #define PIOS_USB_ENABLED 1
282 #define PIOS_USB_DETECT_GPIO_PORT GPIOC
283 #define PIOS_USB_MAX_DEVS 1
284 #define PIOS_USB_DETECT_GPIO_PIN GPIO_Pin_15
286 #endif /* PIOS_BOARD_H */