Configurable SDCARD, and clean up of DMA.
[betaflight.git] / src / main / target / ALIENFLIGHTNGF7 / target.h
bloba0637dee0e4bb1ad2f0c613eea218be5940a9d0d
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
19 #define TARGET_BOARD_IDENTIFIER "AFF7"
20 #define USE_TARGET_CONFIG
22 #define USE_HARDWARE_REVISION_DETECTION
23 #define HW_PIN PC13
24 #define USE_BRUSHED_ESC_AUTODETECT
26 #define USBD_PRODUCT_STRING "AlienFlightNG F7"
28 #define LED0_PIN PC12
29 #define LED1_PIN PD2
31 #define BEEPER PC13
32 #define BEEPER_INVERTED
34 // MPU interrupt
35 #define USE_EXTI
36 #define MPU_INT_EXTI PC14
37 //#define DEBUG_MPU_DATA_READY_INTERRUPT
38 #define USE_MPU_DATA_READY_SIGNAL
39 #define ENSURE_MPU_DATA_READY_IS_LOW
41 #define MPU6500_CS_PIN SPI1_NSS_PIN
42 #define MPU6500_SPI_INSTANCE SPI1
44 #define USE_ACC
45 #define USE_ACC_SPI_MPU6500
46 #define ACC_MPU6500_ALIGN CW270_DEG
48 #define USE_GYRO
49 #define USE_GYRO_SPI_MPU6500
50 #define GYRO_MPU6500_ALIGN CW270_DEG
52 #define USE_MAG
53 #define USE_MAG_HMC5883
54 #define USE_MAG_SPI_HMC5883
55 #define USE_MAG_AK8963
56 #define USE_MAG_SPI_AK8963
58 #define HMC5883_CS_PIN PC15
59 #define HMC5883_SPI_INSTANCE SPI3
61 #define AK8963_CS_PIN PC15
62 #define AK8963_SPI_INSTANCE SPI3
64 #define MAG_AK8963_ALIGN CW180_DEG_FLIP
66 #define USE_BARO
67 #define USE_BARO_MS5611
68 #define USE_BARO_SPI_MS5611
69 #define USE_BARO_BMP280
70 #define USE_BARO_SPI_BMP280
72 #define MS5611_CS_PIN SPI3_NSS_PIN
73 #define MS5611_SPI_INSTANCE SPI3
75 #define BMP280_CS_PIN SPI3_NSS_PIN
76 #define BMP280_SPI_INSTANCE SPI3
78 #define USE_SDCARD
80 #define SDCARD_DETECT_INVERTED
81 #define SDCARD_DETECT_PIN PB11
83 #define SDCARD_SPI_INSTANCE SPI2
84 #define SDCARD_SPI_CS_PIN PB10
86 // SPI2 is on the APB1 bus whose clock runs at 84MHz. Divide to under 400kHz for init:
87 #define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 256 // 422kHz
88 // Divide to under 25MHz for normal operation:
89 #define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 8 // 27MHz
91 #define SDCARD_DMA_STREAM_TX_FULL DMA1_Stream4
92 #define SDCARD_DMA_CHANNEL 0
94 // Performance logging for SD card operations:
95 // #define AFATFS_USE_INTROSPECTIVE_LOGGING
97 #define M25P16_CS_PIN SPI2_NSS_PIN
98 #define M25P16_SPI_INSTANCE SPI2
100 #define USE_FLASHFS
101 #define USE_FLASH_M25P16
103 #define USE_VCP
105 #define USE_UART1
106 #define UART1_RX_PIN PA10
107 #define UART1_TX_PIN PA9
109 #define USE_UART2
110 #define UART2_RX_PIN PA3
111 #define UART2_TX_PIN PA2
113 //#define USE_UART3
114 //#define UART3_RX_PIN PB11
115 //#define UART3_TX_PIN PB10
117 #define USE_UART4
118 #define UART4_RX_PIN PC11
119 #define UART4_TX_PIN PC10
121 #define USE_SOFTSERIAL1
122 #define USE_SOFTSERIAL2
124 #define SERIAL_PORT_COUNT 6
126 #define USE_ESCSERIAL
127 #define ESCSERIAL_TIMER_TX_PIN PA8 // (Hardware=0, PPM/LED_STRIP) XXX Crash if using an LED strip.
129 #define USE_SPI
130 #define USE_SPI_DEVICE_1
131 #define USE_SPI_DEVICE_2
132 #define USE_SPI_DEVICE_3
134 #define SPI1_NSS_PIN PA4
135 #define SPI1_SCK_PIN PA5
136 #define SPI1_MISO_PIN PA6
137 #define SPI1_MOSI_PIN PA7
139 #define SPI2_NSS_PIN PB12
140 #define SPI2_SCK_PIN PB13
141 #define SPI2_MISO_PIN PC2
142 #define SPI2_MOSI_PIN PC3
144 #define SPI3_NSS_PIN PA15
145 #define SPI3_SCK_PIN PB3
146 #define SPI3_MISO_PIN PB4
147 #define SPI3_MOSI_PIN PB5
149 #define USE_I2C
150 #define USE_I2C_PULLUP
151 #define USE_I2C_DEVICE_1
152 #define I2C_DEVICE (I2CDEV_1)
153 #define I2C1_SCL PB6
154 #define I2C1_SDA PB7
156 #define USE_ADC
157 #define ADC1_DMA_STREAM DMA2_Stream0
158 //#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
159 //#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
160 #define VBAT_ADC_PIN PC0
161 #define CURRENT_METER_ADC_PIN PC1
162 #define RSSI_ADC_PIN PC4
164 #define CURRENT_METER_OFFSET_DEFAULT 2500 // ACS712/714-30A - 0A = 2.5V
165 #define CURRENT_METER_SCALE_DEFAULT -667 // ACS712/714-30A - 66.666 mV/A inverted mode
167 #define BINDPLUG_PIN PB2
169 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
171 #define DEFAULT_FEATURES (FEATURE_MOTOR_STOP)
172 #define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
173 #define SERIALRX_UART SERIAL_PORT_USART2
174 #define RX_CHANNELS_TAER
176 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
178 #define TARGET_IO_PORTA 0xffff
179 #define TARGET_IO_PORTB 0xffff
180 #define TARGET_IO_PORTC 0xffff
181 #define TARGET_IO_PORTD (BIT(2))
183 #define USABLE_TIMER_CHANNEL_COUNT 13
184 #define USED_TIMERS ( TIM_N(1) | TIM_N(3) | TIM_N(4) | TIM_N(5) | TIM_N(8) )