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/>.
19 #define TARGET_BOARD_IDENTIFIER "AFF4"
21 #define USE_HARDWARE_REVISION_DETECTION
23 #define USE_BRUSHED_ESC_AUTODETECT
25 #define USBD_PRODUCT_STRING "AlienFlight F4"
31 #define BEEPER_INVERTED
33 #define INVERTER_PIN_USART2 PC15
37 #define GYRO_INT_EXTI PC14
38 //#define DEBUG_MPU_DATA_READY_INTERRUPT
39 #define USE_MPU_DATA_READY_SIGNAL
40 #define ENSURE_MPU_DATA_READY_IS_LOW
42 #define MPU6500_CS_PIN SPI1_NSS_PIN
43 #define MPU6500_SPI_BUS BUS_SPI1
45 #define MPU9250_CS_PIN SPI1_NSS_PIN
46 #define MPU9250_SPI_BUS BUS_SPI1
48 #define USE_IMU_MPU6500
49 #define IMU_MPU6500_ALIGN CW270_DEG
50 #define USE_IMU_MPU9250
51 #define IMU_MPU9250_ALIGN CW270_DEG
55 #define MAG_I2C_BUS BUS_I2C1
56 #define USE_MAG_MPU9250
57 #define USE_MAG_HMC5883
58 #define USE_MAG_MAG3110
59 #define USE_MAG_QMC5883
60 #define USE_MAG_IST8310
61 #define USE_MAG_IST8308
62 #define USE_MAG_LIS3MDL
64 #define TEMPERATURE_I2C_BUS BUS_I2C1
65 #define BNO055_I2C_BUS BUS_I2C1
68 #define BARO_I2C_BUS BUS_I2C1
69 #define USE_BARO_MS5611
70 #define USE_BARO_BMP280
73 #define USE_SDCARD_SPI
74 #define SDCARD_DETECT_INVERTED
75 #define SDCARD_DETECT_PIN PB11
76 #define SDCARD_SPI_BUS BUS_SPI2
77 #define SDCARD_CS_PIN PB10
79 //#define M25P16_CS_PIN SPI2_NSS_PIN
80 //#define M25P16_SPI_BUS BUS_SPI2
83 //#define USE_FLASH_M25P16
88 #define UART1_RX_PIN PA10
89 #define UART1_TX_PIN PA9
92 #define UART2_RX_PIN PA3
93 #define UART2_TX_PIN PA2 //inverter
96 //#define UART3_RX_PIN PB11
97 //#define UART3_TX_PIN PB10
100 #define UART4_RX_PIN PC11
101 #define UART4_TX_PIN PC10
103 #define SERIAL_PORT_COUNT 4
105 #define USE_ESCSERIAL
106 #define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1
109 #define USE_SPI_DEVICE_1
110 #define USE_SPI_DEVICE_2
111 #define USE_SPI_DEVICE_3
113 #define SPI1_NSS_PIN PA4
114 #define SPI1_SCK_PIN PA5
115 #define SPI1_MISO_PIN PA6
116 #define SPI1_MOSI_PIN PA7
118 #define SPI2_NSS_PIN PB12
119 #define SPI2_SCK_PIN PB13
120 #define SPI2_MISO_PIN PC2
121 #define SPI2_MOSI_PIN PC3
123 #define SPI3_NSS_PIN PA15
124 #define SPI3_SCK_PIN PB3
125 #define SPI3_MISO_PIN PB4
126 #define SPI3_MOSI_PIN PB5
129 #define USE_I2C_DEVICE_1
130 #define USE_I2C_PULLUP
135 #define ADC1_DMA_STREAM DMA2_Stream0
136 #define ADC_CHANNEL_1_PIN PC0
137 #define ADC_CHANNEL_2_PIN PC1
138 #define ADC_CHANNEL_3_PIN PC4
139 #define ADC_CHANNEL_4_PIN PC5
141 #define VBAT_ADC_CHANNEL ADC_CHN_1
142 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
143 #define RSSI_ADC_CHANNEL ADC_CHN_3
145 //#define BOARD_HAS_VOLTAGE_DIVIDER
146 //#define BOARD_HAS_CURRENT_SENSOR
148 // LED strip configuration using RC1 pin.
149 #define USE_LED_STRIP
150 // LED Strip can run off Pin 41 (PA8) of the ESC outputs.
151 #define WS2811_PIN PA8
153 #define USE_SPEKTRUM_BIND
155 #define BIND_PIN UART2_RX_PIN
157 #define HARDWARE_BIND_PLUG
158 // Hardware bind plug at PB2 (Pin 28)
159 #define BINDPLUG_PIN PB2
161 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
163 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_MOTOR_STOP | FEATURE_BLACKBOX)
164 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
165 #define SERIALRX_UART SERIAL_PORT_USART2
166 #define RX_CHANNELS_TAER
168 #define TELEMETRY_UART SERIAL_PORT_USART1
170 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
172 // Number of available PWM outputs
173 #define MAX_PWM_OUTPUT_PORTS 12
175 #define TARGET_IO_PORTA 0xffff
176 #define TARGET_IO_PORTB 0xffff
177 #define TARGET_IO_PORTC 0xffff
178 #define TARGET_IO_PORTD (BIT(2))