2 ******************************************************************************
5 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
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 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
77 // ------------------------
79 // ------------------------
80 #define TELEM_QUEUE_SIZE 10
82 // ------------------------
84 // ------------------------
85 #define PIOS_LED_HEARTBEAT 0
87 // -------------------------
89 // -------------------------
90 #define PIOS_MASTER_CLOCK 72000000
92 // -------------------------
93 // Interrupt Priorities
94 // -------------------------
95 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
96 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
97 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
98 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
99 // ------------------------
101 // See also pios_board.c
102 // ------------------------
103 #define PIOS_I2C_MAX_DEVS 1
104 extern uint32_t pios_i2c_flexi_adapter_id
;
105 #define PIOS_I2C_MAIN_ADAPTER (pios_i2c_flexi_adapter_id)
106 #define PIOS_I2C_ESC_ADAPTER (pios_i2c_flexi_adapter_id)
107 #define PIOS_I2C_BMP085_ADAPTER (pios_i2c_flexi_adapter_id)
109 // ------------------------
111 // ------------------------
112 #define PIOS_BMP085_OVERSAMPLING 3
114 // -------------------------
117 // See also pios_board.c
118 // -------------------------
119 #define PIOS_SPI_MAX_DEVS 2
120 extern uint32_t pios_spi_gyro_adapter_id
;
121 #define PIOS_SPI_MPU6000_ADAPTER (pios_spi_gyro_adapter_id)
122 extern uint32_t pios_spi_flash_accel_adapter_id
;
123 #define PIOS_SPI_ADXL345_ADAPTER (pios_spi_flash_accel_adapter_id)
125 // -------------------------
127 // -------------------------
128 #define PIOS_USART_MAX_DEVS 2
130 // Inverter for SBUS handling
131 #define PIOS_USART_INVERTER_PORT USART1
132 #define PIOS_USART_INVERTER_GPIO GPIOB
133 #define PIOS_USART_INVERTER_PIN GPIO_Pin_2
134 #define PIOS_USART_INVERTER_ENABLE Bit_SET
135 #define PIOS_USART_INVERTER_DISABLE Bit_RESET
137 // -------------------------
140 // See also pios_board.c
141 // -------------------------
142 #define PIOS_COM_MAX_DEVS 3
144 #define PIOS_COM_TELEM_RF_RX_BUF_LEN 32
145 #define PIOS_COM_TELEM_RF_TX_BUF_LEN 12
147 #define PIOS_COM_GPS_RX_BUF_LEN 32
149 #define PIOS_COM_TELEM_USB_RX_BUF_LEN 65
150 #define PIOS_COM_TELEM_USB_TX_BUF_LEN 65
152 #define PIOS_COM_BRIDGE_RX_BUF_LEN 65
153 #define PIOS_COM_BRIDGE_TX_BUF_LEN 12
155 #define PIOS_COM_HKOSD_TX_BUF_LEN 22
157 #define PIOS_COM_MSP_TX_BUF_LEN 128
158 #define PIOS_COM_MSP_RX_BUF_LEN 64
160 #define PIOS_COM_MAVLINK_TX_BUF_LEN 128
162 #define PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN 40
164 // -------------------------
166 // PIOS_ADC_PinGet(0) = Gyro Z
167 // PIOS_ADC_PinGet(1) = Gyro Y
168 // PIOS_ADC_PinGet(2) = Gyro X
169 // -------------------------
170 // #define PIOS_ADC_OVERSAMPLING_RATE 1
171 #define PIOS_ADC_USE_TEMP_SENSOR 1
172 #define PIOS_ADC_TEMP_SENSOR_ADC ADC1
173 #define PIOS_ADC_TEMP_SENSOR_ADC_CHANNEL 1
175 #define PIOS_ADC_PIN1_GPIO_PORT GPIOA // PA4 (Gyro X)
176 #define PIOS_ADC_PIN1_GPIO_PIN GPIO_Pin_4 // ADC12_IN4
177 #define PIOS_ADC_PIN1_GPIO_CHANNEL ADC_Channel_4
178 #define PIOS_ADC_PIN1_ADC ADC2
179 #define PIOS_ADC_PIN1_ADC_NUMBER 1
181 #define PIOS_ADC_PIN2_GPIO_PORT GPIOA // PA5 (Gyro Y)
182 #define PIOS_ADC_PIN2_GPIO_PIN GPIO_Pin_5 // ADC123_IN5
183 #define PIOS_ADC_PIN2_GPIO_CHANNEL ADC_Channel_5
184 #define PIOS_ADC_PIN2_ADC ADC1
185 #define PIOS_ADC_PIN2_ADC_NUMBER 2
187 #define PIOS_ADC_PIN3_GPIO_PORT GPIOA // PA3 (Gyro Z)
188 #define PIOS_ADC_PIN3_GPIO_PIN GPIO_Pin_3 // ADC12_IN3
189 #define PIOS_ADC_PIN3_GPIO_CHANNEL ADC_Channel_3
190 #define PIOS_ADC_PIN3_ADC ADC2
191 #define PIOS_ADC_PIN3_ADC_NUMBER 2
193 #define PIOS_ADC_NUM_PINS 3
195 #define PIOS_ADC_PORTS { PIOS_ADC_PIN1_GPIO_PORT, PIOS_ADC_PIN2_GPIO_PORT, PIOS_ADC_PIN3_GPIO_PORT }
196 #define PIOS_ADC_PINS { PIOS_ADC_PIN1_GPIO_PIN, PIOS_ADC_PIN2_GPIO_PIN, PIOS_ADC_PIN3_GPIO_PIN }
197 #define PIOS_ADC_CHANNELS { PIOS_ADC_PIN1_GPIO_CHANNEL, PIOS_ADC_PIN2_GPIO_CHANNEL, PIOS_ADC_PIN3_GPIO_CHANNEL }
198 #define PIOS_ADC_MAPPING { PIOS_ADC_PIN1_ADC, PIOS_ADC_PIN2_ADC, PIOS_ADC_PIN3_ADC }
199 #define PIOS_ADC_CHANNEL_MAPPING { PIOS_ADC_PIN1_ADC_NUMBER, PIOS_ADC_PIN2_ADC_NUMBER, PIOS_ADC_PIN3_ADC_NUMBER }
200 #define PIOS_ADC_NUM_CHANNELS (PIOS_ADC_NUM_PINS + PIOS_ADC_USE_TEMP_SENSOR)
201 #define PIOS_ADC_NUM_ADC_CHANNELS 2
202 #define PIOS_ADC_USE_ADC2 1
203 #define PIOS_ADC_CLOCK_FUNCTION RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2, ENABLE)
204 #define PIOS_ADC_ADCCLK RCC_PCLK2_Div8
205 /* RCC_PCLK2_Div2: ADC clock = PCLK2/2 */
206 /* RCC_PCLK2_Div4: ADC clock = PCLK2/4 */
207 /* RCC_PCLK2_Div6: ADC clock = PCLK2/6 */
208 /* RCC_PCLK2_Div8: ADC clock = PCLK2/8 */
209 #define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_239Cycles5
211 /* With an ADCCLK = 14 MHz and a sampling time of 239.5 cycles: */
212 /* Tconv = 239.5 + 12.5 = 252 cycles = 18�s */
213 /* (1 / (ADCCLK / CYCLES)) = Sample Time (�S) */
214 #define PIOS_ADC_IRQ_PRIO PIOS_IRQ_PRIO_LOW
216 // Currently analog acquistion hard coded at 480 Hz
218 // ADCCLK = PCLK2 / 2
219 #define PIOS_ADC_RATE (72.0e6f / 1.0f / 8.0f / 252.0f / (PIOS_ADC_NUM_CHANNELS >> PIOS_ADC_USE_ADC2))
220 #define PIOS_ADC_MAX_OVERSAMPLING 48
222 #define PIOS_ADC_TEMPERATURE_PIN 0
224 // ------------------------
226 // See also pios_board.c
227 // ------------------------
228 #define PIOS_RCVR_MAX_DEVS 3
229 #define PIOS_RCVR_MAX_CHANNELS 12
230 #define PIOS_GCSRCVR_TIMEOUT_MS 100
232 // -------------------------
233 // Receiver PPM input
234 // -------------------------
235 #define PIOS_PPM_MAX_DEVS 1
236 #define PIOS_PPM_NUM_INPUTS 16
238 // -------------------------
239 // Receiver PWM input
240 // -------------------------
241 #define PIOS_PWM_MAX_DEVS 1
242 #define PIOS_PWM_NUM_INPUTS 6
244 // -------------------------
245 // Receiver DSM input
246 // -------------------------
247 #define PIOS_DSM_MAX_DEVS 2
248 #define PIOS_DSM_NUM_INPUTS 12
250 // -------------------------
251 // Receiver S.Bus input
252 // -------------------------
253 #define PIOS_SBUS_MAX_DEVS 1
254 #define PIOS_SBUS_NUM_INPUTS (16 + 2)
256 // -------------------------
257 // Receiver HOTT input
258 // -------------------------
259 #define PIOS_HOTT_MAX_DEVS 1
260 #define PIOS_HOTT_NUM_INPUTS 32
262 // -------------------------
263 // Receiver EX.Bus input
264 // -------------------------
265 #define PIOS_EXBUS_MAX_DEVS 1
266 #define PIOS_EXBUS_NUM_INPUTS 16
268 // -------------------------
269 // Receiver Multiplex SRXL input
270 // -------------------------
271 #define PIOS_SRXL_MAX_DEVS 1
272 #define PIOS_SRXL_NUM_INPUTS 16
274 // -------------------------
275 // Receiver FlySky IBus input
276 // -------------------------
277 #define PIOS_IBUS_MAX_DEVS 1
278 #define PIOS_IBUS_NUM_INPUTS 10
280 // -------------------------
282 // -------------------------
283 #define PIOS_SERVO_UPDATE_HZ 50
284 #define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
285 #define PIOS_SERVO_BANKS 6
287 // --------------------------
288 // Timer controller settings
289 // --------------------------
290 #define PIOS_TIM_MAX_DEVS 3
292 // -------------------------
294 // -------------------------
295 #define PIOS_GPIO_PORTS {}
296 #define PIOS_GPIO_PINS {}
297 #define PIOS_GPIO_CLKS {}
298 #define PIOS_GPIO_NUM 0
300 // -------------------------
302 // -------------------------
303 #define PIOS_USB_HID_MAX_DEVS 1
305 #define PIOS_USB_ENABLED 1
306 #define PIOS_USB_DETECT_GPIO_PORT GPIOC
307 #define PIOS_USB_MAX_DEVS 1
308 #define PIOS_USB_DETECT_GPIO_PIN GPIO_Pin_15
310 #endif /* PIOS_BOARD_H */