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/>.
20 #define TARGET_BOARD_IDENTIFIER "ATF4"
22 #define USBD_PRODUCT_STRING "SAGEATF4"
24 /**********swd debuger reserved *****************
46 #define BEEPER_INVERTED
47 #define BEEPER_PWM_FREQUENCY 2500 //0 Active BB | 2500Hz Passive BB
49 // *************** Gyro & ACC **********************
51 #define USE_SPI_DEVICE_1
53 #define SPI1_SCK_PIN PA5
54 #define SPI1_MISO_PIN PA6
55 #define SPI1_MOSI_PIN PA7
56 #define SPI1_NSS_PIN PA4
59 #define USE_IMU_MPU6000
60 #define IMU_MPU6000_ALIGN CW0_DEG
61 #define MPU6000_SPI_BUS BUS_SPI1
62 #define MPU6000_CS_PIN SPI1_NSS_PIN
64 #define USE_IMU_MPU6500
65 #define IMU_MPU6500_ALIGN CW0_DEG
66 #define MPU6500_SPI_BUS BUS_SPI1
67 #define MPU6500_CS_PIN SPI1_NSS_PIN
70 #define USE_IMU_ICM42605
71 #define IMU_ICM42605_ALIGN CW0_DEG
72 #define ICM42605_SPI_BUS BUS_SPI1
73 #define ICM42605_CS_PIN SPI1_NSS_PIN
76 #define USE_IMU_MPU9250
77 #define IMU_MPU9250_ALIGN CW0_DEG
78 #define MPU9250_SPI_BUS BUS_SPI1
79 #define MPU9250_CS_PIN SPI1_NSS_PIN
82 #define USE_IMU_BMI270
83 #define IMU_BMI270_ALIGN CW90_DEG
84 #define BMI270_SPI_BUS BUS_SPI1
85 #define BMI270_CS_PIN SPI1_NSS_PIN
88 #define USE_IMU_BMI088
90 #define IMU_BMI088_ALIGN CW0_DEG
91 #define BMI088_SPI_BUS BUS_SPI1
93 #define BMI088_GYRO_CS_PIN SPI1_NSS_PIN
94 #define BMI088_GYRO_EXTI_PIN PA15
95 #define BMI088_ACC_CS_PIN PC13
96 #define BMI088_ACC_EXTI_PIN PD13
98 // *************** I2C/Baro/Mag/EXT*********************
100 #define USE_I2C_DEVICE_3
101 #define I2C3_SCL PC0 // SCL pad
102 #define I2C3_SDA PC1 // SDA pad
103 #define USE_I2C_PULLUP
106 #define BARO_I2C_BUS BUS_I2C3
107 #define USE_BARO_BMP280
108 #define USE_BARO_DPS310
111 #define MAG_I2C_BUS BUS_I2C3
114 // temperature sensors
115 //#define TEMPERATURE_I2C_BUS BUS_I2C1
117 //#define PITOT_I2C_BUS BUS_I2C1
119 //#define USE_RANGEFINDER
120 //#define RANGEFINDER_I2C_BUS BUS_I2C1
122 // *************** OSD *****************************
123 #define USE_SPI_DEVICE_2
124 #define SPI2_SCK_PIN PD1//PB13 on LQFP64
125 #define SPI2_MISO_PIN PD3//PB14 on LQFP64
126 #define SPI2_MOSI_PIN PD4//PB15 on LQFP64
127 #define SPI2_NSS_PIN PD5 //confirm on lqfp64
128 #define SPI2_SCK_AF GPIO_MUX_6
129 #define SPI2_MISO_AF GPIO_MUX_6
130 #define SPI2_MOSI_AF GPIO_MUX_6
134 #define MAX7456_SPI_BUS BUS_SPI2
135 #define MAX7456_CS_PIN SPI2_NSS_PIN
138 // *************** SD/BLACKBOX **************************
139 #define USE_SPI_DEVICE_3
140 #define SPI3_SCK_PIN PC10
141 #define SPI3_MISO_PIN PC11
142 #define SPI3_MOSI_PIN PC12
143 #define SPI3_NSS_PIN PD6 //confirm on lqfp64
145 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
147 #define USE_FLASH_M25P16
148 #define M25P16_SPI_BUS BUS_SPI3
149 #define M25P16_CS_PIN SPI3_NSS_PIN
151 #define USE_FLASH_W25N01G
152 #define W25N01G_SPI_BUS BUS_SPI3
153 #define W25N01G_CS_PIN SPI3_NSS_PIN
155 // *************** UART *****************************
157 #define USB_DETECT_PIN PC14
158 #define USE_USB_DETECT
161 #define UART1_RX_PIN PA10
162 #define UART1_TX_PIN PA9
165 #define UART2_RX_PIN PA3
166 #define UART2_TX_PIN PA2
169 #define UART3_RX_PIN PC5
170 #define UART3_TX_PIN PC4
173 #define UART4_RX_PIN PA1
174 #define UART4_TX_PIN PA0
177 #define UART8_RX_PIN PC3
178 #define UART8_TX_PIN PC2
180 #define SERIAL_PORT_COUNT 6
182 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
183 #define SERIALRX_PROVIDER SERIALRX_CRSF
184 #define SERIALRX_UART SERIAL_PORT_USART1
186 // *************** ADC *****************************
188 #define ADC_INSTANCE ADC1
190 #define ADC1_DMA_STREAM DMA2_CHANNEL1
191 #define ADC_CHANNEL_1_PIN PB0
192 #define ADC_CHANNEL_2_PIN PB1
193 //#define ADC_CHANNEL_3_PIN PB0
194 #define VBAT_ADC_CHANNEL ADC_CHN_1
195 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
196 //#define RSSI_ADC_CHANNEL ADC_CHN_3
198 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_CURRENT_METER | FEATURE_TELEMETRY| FEATURE_VBAT | FEATURE_OSD )
200 #define USE_LED_STRIP
201 #define WS2811_PIN PB10 //TIM2_CH3
204 #define USE_SPEKTRUM_BIND
205 #define BIND_PIN PA3 //UART2_RX_PIN
207 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
209 #define TARGET_IO_PORTA 0xffff
210 #define TARGET_IO_PORTB 0xffff
211 #define TARGET_IO_PORTC 0xffff
212 #define TARGET_IO_PORTD 0xffff
213 #define TARGET_IO_PORTE BIT(2)
215 #define MAX_PWM_OUTPUT_PORTS 12
217 #define USE_ESC_SENSOR