2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
24 #ifndef MAX7456_CLOCK_CONFIG_DEFAULT
25 #define MAX7456_CLOCK_CONFIG_DEFAULT MAX7456_CLOCK_CONFIG_OC
28 #ifndef MAX7456_SPI_CLK
29 #define MAX7456_SPI_CLK (SPI_CLOCK_STANDARD)
32 #ifndef MAX7456_RESTORE_CLK
33 #define MAX7456_RESTORE_CLK (SPI_CLOCK_FAST)
36 #ifndef MAX7456_SPI_CS_PIN
37 #define MAX7456_SPI_CS_PIN NONE
40 #ifndef MAX7456_SPI_INSTANCE
41 #define MAX7456_SPI_INSTANCE NULL
47 #ifdef USE_FLASH_M25P16
49 #define FLASH_CS_PIN NONE
52 #ifndef FLASH_SPI_INSTANCE
53 #define FLASH_SPI_INSTANCE NULL
59 #ifdef USE_FLASH_M25P16
61 #define FLASH_CS_PIN NONE
64 #ifndef FLASH_SPI_INSTANCE
65 #define FLASH_SPI_INSTANCE NULL
71 #ifdef I2C_FULL_RECONFIGURABILITY
72 #ifdef USE_I2C_DEVICE_1
77 #ifdef USE_I2C_DEVICE_2
82 #ifdef USE_I2C_DEVICE_3
87 #ifdef USE_I2C_DEVICE_4
92 #else // I2C_FULL_RECONFIGURABILITY
94 // Backward compatibility for exisiting targets
104 #define I2C2_SCL PB10
107 #define I2C2_SDA PB11
122 #define I2C2_SDA PA10
134 #define I2C2_SCL PB10
137 #define I2C2_SDA PB11
155 #define I2C2_SCL PB10
158 #define I2C2_SDA PB11
167 #define I2C4_SCL PD12
170 #define I2C4_SDA PD13
174 #endif // I2C_FULL_RECONFIGURABILITY
176 // Default values for internal pullup
178 #if defined(USE_I2C_PULLUP)
179 #define I2C1_PULLUP true
180 #define I2C2_PULLUP true
181 #define I2C3_PULLUP true
182 #define I2C4_PULLUP true
184 #define I2C1_PULLUP false
185 #define I2C2_PULLUP false
186 #define I2C3_PULLUP false
187 #define I2C4_PULLUP false
192 #ifdef SPI_FULL_RECONFIGURABILITY
194 #ifdef USE_SPI_DEVICE_1
195 #define SPI1_SCK_PIN NONE
196 #define SPI1_MISO_PIN NONE
197 #define SPI1_MOSI_PIN NONE
200 #ifdef USE_SPI_DEVICE_2
201 #define SPI2_SCK_PIN NONE
202 #define SPI2_MISO_PIN NONE
203 #define SPI2_MOSI_PIN NONE
206 #ifdef USE_SPI_DEVICE_3
207 #define SPI3_SCK_PIN NONE
208 #define SPI3_MISO_PIN NONE
209 #define SPI3_MOSI_PIN NONE
212 #ifdef USE_SPI_DEVICE_4
213 #define SPI4_SCK_PIN NONE
214 #define SPI4_MISO_PIN NONE
215 #define SPI4_MOSI_PIN NONE
220 // Pin defaults for backward compatibility
223 #define SPI1_SCK_PIN PA5
224 #define SPI1_MISO_PIN PA6
225 #define SPI1_MOSI_PIN PA7
229 #define SPI2_SCK_PIN PB13
230 #define SPI2_MISO_PIN PB14
231 #define SPI2_MOSI_PIN PB15
235 #define SPI3_SCK_PIN PB3
236 #define SPI3_MISO_PIN PB4
237 #define SPI3_MOSI_PIN PB5
241 // Extracted from rx/rx.c and rx/rx.h
243 #define RX_MAPPABLE_CHANNEL_COUNT 8
245 #ifndef RX_SPI_DEFAULT_PROTOCOL
246 #define RX_SPI_DEFAULT_PROTOCOL 0
248 #ifndef SERIALRX_PROVIDER
249 #define SERIALRX_PROVIDER 0
252 #define RX_MIN_USEC 885
253 #define RX_MAX_USEC 2115
254 #define RX_MID_USEC 1500
256 #ifndef SPEKTRUM_BIND_PIN
257 #define SPEKTRUM_BIND_PIN NONE
261 #define BINDPLUG_PIN NONE
265 #ifndef RX_SPI_LED_PIN
266 #define RX_SPI_LED_PIN NONE
270 // F4 and F7 single gyro boards
271 #if defined(USE_MULTI_GYRO) && !defined(GYRO_2_SPI_INSTANCE)
272 #define GYRO_2_SPI_INSTANCE GYRO_1_SPI_INSTANCE
273 #define GYRO_2_CS_PIN NONE
274 #define GYRO_2_ALIGN ALIGN_DEFAULT
275 #define GYRO_2_EXTI_PIN NONE
276 #define ACC_2_ALIGN ALIGN_DEFAULT
279 #if !defined(GYRO_1_SPI_INSTANCE)
280 #define GYRO_1_SPI_INSTANCE NULL
283 #if !defined(GYRO_1_CS_PIN)
284 #define GYRO_1_CS_PIN NONE
287 #if !defined(GYRO_1_EXTI_PIN)
288 #define GYRO_1_EXTI_PIN NONE
291 #if !defined(GYRO_1_ALIGN)
292 #define GYRO_1_ALIGN ALIGN_DEFAULT
295 #if !defined(ACC_1_ALIGN)
296 #define ACC_1_ALIGN ALIGN_DEFAULT
299 #if defined(MPU_ADDRESS)
300 #define GYRO_I2C_ADDRESS MPU_ADDRESS
302 #define GYRO_I2C_ADDRESS 0 // AUTO
305 #ifdef USE_MULTI_GYRO
306 #define MAX_GYRODEV_COUNT 2
308 #define MAX_GYRODEV_COUNT 1
312 #ifndef USB_DETECT_PIN
313 #define USB_DETECT_PIN NONE
315 #ifndef USB_MSC_BUTTON_PIN
316 #define USB_MSC_BUTTON_PIN NONE
318 #if !defined(MSC_BUTTON_IPU)
319 #define MSC_BUTTON_IPU true
323 #ifdef USE_TIMER_MGMT
324 #ifndef MAX_TIMER_PINMAP_COUNT
325 #define MAX_TIMER_PINMAP_COUNT 21 // Largest known for F405RG (OMNINXT)
330 #ifndef SDCARD_DETECT_PIN
331 #define SDCARD_DETECT_PIN NONE
333 #ifdef SDCARD_DETECT_INVERTED
334 #define SDCARD_DETECT_IS_INVERTED 1
336 #define SDCARD_DETECT_IS_INVERTED 0
338 #ifdef USE_SDCARD_SPI
339 #ifndef SDCARD_SPI_INSTANCE
340 #define SDCARD_SPI_INSTANCE NULL
342 #ifndef SDCARD_SPI_CS_PIN
343 #define SDCARD_SPI_CS_PIN NONE
345 #endif // USE_SDCARD_SPI
346 #ifdef USE_SDCARD_SDIO
347 #ifndef SDCARD_SDIO_DMA_OPT
348 #define SDCARD_SDIO_DMA_OPT (-1)
350 #endif // USE_SDCARD_SDIO
353 #if defined(USE_UART1) || defined(USE_UART2) || defined(USE_UART3) || defined(USE_UART4) || defined(USE_UART5) || defined(USE_UART6) || defined(USE_UART7) || defined(USE_UART8)
358 #if defined(INVERTER_PIN_UART1) || defined(INVERTER_PIN_UART2) || defined(INVERTER_PIN_UART3) || defined(INVERTER_PIN_UART4) || defined(INVERTER_PIN_UART5) || defined(INVERTER_PIN_UART6)
363 #ifndef DEFAULT_MIXER
364 #define DEFAULT_MIXER MIXER_QUADX
367 #if defined(USE_RANGEFINDER) && defined(USE_RANGEFINDER_HCSR04)
368 #ifndef RANGEFINDER_HCSR04_TRIGGER_PIN
369 #define RANGEFINDER_HCSR04_TRIGGER_PIN NONE
371 #ifndef RANGEFINDER_HCSR04_ECHO_PIN
372 #define RANGEFINDER_HCSR04_ECHO_PIN NONE
378 #ifndef MAG_SPI_INSTANCE
379 #define MAG_SPI_INSTANCE NULL
382 #define MAG_CS_PIN NONE
384 #ifndef MAG_I2C_INSTANCE
385 #define MAG_I2C_INSTANCE I2C_DEVICE
390 #define MAG_INT_EXTI NONE
394 #if defined(USE_BARO)
395 #ifndef BARO_SPI_INSTANCE
396 #define BARO_SPI_INSTANCE NULL
399 #define BARO_CS_PIN NONE
401 #ifndef BARO_I2C_INSTANCE
402 #define BARO_I2C_INSTANCE I2C_DEVICE
407 #if !defined(GENERIC_TARGET) && !defined(ADC_INSTANCE)
408 #define ADC_INSTANCE ADC1
410 #define ADC1_DMA_OPT 1
414 #if !defined(ADC1_DMA_OPT)
415 #define ADC1_DMA_OPT (-1)
417 #if !defined(ADC2_DMA_OPT)
418 #define ADC2_DMA_OPT (-1)
420 #if !defined(ADC3_DMA_OPT)
421 #define ADC3_DMA_OPT (-1)
427 #ifdef USE_SPI_DEVICE_1
428 #ifndef SPI1_TX_DMA_OPT
429 #define SPI1_TX_DMA_OPT (-1)
431 #ifndef SPI1_RX_DMA_OPT
432 #define SPI1_RX_DMA_OPT (-1)
435 #ifdef USE_SPI_DEVICE_2
436 #ifndef SPI2_TX_DMA_OPT
437 #define SPI2_TX_DMA_OPT (-1)
439 #ifndef SPI2_RX_DMA_OPT
440 #define SPI2_RX_DMA_OPT (-1)
443 #ifdef USE_SPI_DEVICE_3
444 #ifndef SPI3_TX_DMA_OPT
445 #define SPI3_TX_DMA_OPT (-1)
447 #ifndef SPI3_RX_DMA_OPT
448 #define SPI3_RX_DMA_OPT (-1)
451 #ifdef USE_SPI_DEVICE_4
452 #ifndef SPI4_TX_DMA_OPT
453 #define SPI4_TX_DMA_OPT (-1)
455 #ifndef SPI4_RX_DMA_OPT
456 #define SPI4_RX_DMA_OPT (-1)
462 #ifndef UART1_TX_DMA_OPT
463 #define UART1_TX_DMA_OPT (-1)
465 #ifndef UART1_RX_DMA_OPT
466 #define UART1_RX_DMA_OPT (-1)
471 #ifndef UART2_TX_DMA_OPT
472 #define UART2_TX_DMA_OPT (-1)
474 #ifndef UART2_RX_DMA_OPT
475 #define UART2_RX_DMA_OPT (-1)
480 #ifndef UART3_TX_DMA_OPT
481 #define UART3_TX_DMA_OPT (-1)
483 #ifndef UART3_RX_DMA_OPT
484 #define UART3_RX_DMA_OPT (-1)
489 #ifndef UART4_TX_DMA_OPT
490 #define UART4_TX_DMA_OPT (-1)
492 #ifndef UART4_RX_DMA_OPT
493 #define UART4_RX_DMA_OPT (-1)
498 #ifndef UART5_TX_DMA_OPT
499 #define UART5_TX_DMA_OPT (-1)
501 #ifndef UART5_RX_DMA_OPT
502 #define UART5_RX_DMA_OPT (-1)
507 #ifndef UART6_TX_DMA_OPT
508 #define UART6_TX_DMA_OPT (-1)
510 #ifndef UART6_RX_DMA_OPT
511 #define UART6_RX_DMA_OPT (-1)
516 #ifndef UART7_TX_DMA_OPT
517 #define UART7_TX_DMA_OPT (-1)
519 #ifndef UART7_RX_DMA_OPT
520 #define UART7_RX_DMA_OPT (-1)
525 #ifndef UART8_TX_DMA_OPT
526 #define UART8_TX_DMA_OPT (-1)
528 #ifndef UART8_RX_DMA_OPT
529 #define UART8_RX_DMA_OPT (-1)