Removed excess trailing spaces before new lines on licenses.
[betaflight.git] / src / main / target / REVO / target.h
blob8b7c59e2b4dd50070c5701ffd9353983c71e4e62
1 /*
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)
8 * any later version.
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/>.
21 #pragma once
23 #if defined(AIRBOTF4)
24 #define TARGET_BOARD_IDENTIFIER "AIR4"
25 #define USBD_PRODUCT_STRING "AirbotF4"
27 #elif defined(AIRBOTF4SD)
28 #define TARGET_BOARD_IDENTIFIER "A4SD"
29 #define USBD_PRODUCT_STRING "AirbotF4SD"
31 #elif defined(SOULF4)
32 #define TARGET_BOARD_IDENTIFIER "SOUL"
33 #define USBD_PRODUCT_STRING "DemonSoulF4"
35 #elif defined(PODIUMF4)
36 #define TARGET_BOARD_IDENTIFIER "PODI"
37 #define USBD_PRODUCT_STRING "PodiumF4"
39 #else
40 #define TARGET_BOARD_IDENTIFIER "REVO"
41 #define USBD_PRODUCT_STRING "Revolution"
43 #ifdef OPBL
44 #define USBD_SERIALNUMBER_STRING "0x8020000"
45 #endif
47 #endif
49 #define LED0_PIN PB5
50 #if defined(PODIUMF4)
51 #define LED1_PIN PB4
52 #define LED2_PIN PB6
53 #endif
55 // Disable LED1, conflicts with AirbotF4/Flip32F4 beeper
56 #if defined(AIRBOTF4) || defined(AIRBOTF4SD)
57 #define USE_BEEPER
58 #define BEEPER_PIN PB4
59 #define BEEPER_INVERTED
60 #elif defined(SOULF4)
61 #define USE_BEEPER
62 #define BEEPER_PIN PB6
63 #define BEEPER_INVERTED
64 #else
65 #define LED1_PIN PB4
66 // Leave beeper here but with none as io - so disabled unless mapped.
67 #define USE_BEEPER
68 #define BEEPER_PIN NONE
69 #endif
72 // PC0 used as inverter select GPIO
73 #ifdef AIRBOTF4SD
74 #define INVERTER_PIN_UART6 PD2
75 #else
76 #define INVERTER_PIN_UART1 PC0
77 #endif
79 #define MPU6000_CS_PIN PA4
80 #define MPU6000_SPI_INSTANCE SPI1
82 #define MPU6500_CS_PIN PA4
83 #define MPU6500_SPI_INSTANCE SPI1
85 #define USE_GYRO
86 #define USE_ACC
88 #ifdef AIRBOTF4SD
89 #undef MPU6000_CS_PIN
90 #define MPU6000_CS_PIN PB13
91 #define USE_GYRO_SPI_ICM20601
92 #define ICM20601_CS_PIN PA4 // served through MPU6500 code
93 #define ICM20601_SPI_INSTANCE SPI1
94 #define USE_DUAL_GYRO
95 #define GYRO_1_CS_PIN MPU6000_CS_PIN
96 #define GYRO_2_CS_PIN ICM20601_CS_PIN
97 #define GYRO_1_SPI_INSTANCE MPU6000_SPI_INSTANCE
98 #define GYRO_2_SPI_INSTANCE ICM20601_SPI_INSTANCE
99 #define ACC_1_ALIGN ALIGN_DEFAULT
100 #define ACC_2_ALIGN ALIGN_DEFAULT
101 #endif
103 #if defined(SOULF4)
104 #define USE_GYRO_SPI_MPU6000
105 #define GYRO_MPU6000_ALIGN CW180_DEG
107 #define USE_ACC_SPI_MPU6000
108 #define ACC_MPU6000_ALIGN CW180_DEG
110 #elif defined(PODIUMF4)
112 #define USE_GYRO_MPU6500
113 #define USE_GYRO_SPI_MPU6500
114 #define GYRO_MPU6500_ALIGN CW0_DEG
116 #define USE_ACC_MPU6500
117 #define USE_ACC_SPI_MPU6500
118 #define ACC_MPU6500_ALIGN CW0_DEG
120 #else
122 #define USE_GYRO_SPI_MPU6000
123 #define GYRO_MPU6000_ALIGN CW270_DEG
125 #define USE_GYRO_MPU6500
126 #define USE_GYRO_SPI_MPU6500
127 #define GYRO_MPU6500_ALIGN CW270_DEG
129 #define USE_ACC_SPI_MPU6000
130 #define ACC_MPU6000_ALIGN CW270_DEG
132 #define USE_ACC_MPU6500
133 #define USE_ACC_SPI_MPU6500
134 #define ACC_MPU6500_ALIGN CW270_DEG
136 #endif
138 // MPU6000 interrupts
139 #define USE_EXTI
140 #define MPU_INT_EXTI PC4
141 #define USE_MPU_DATA_READY_SIGNAL
143 // Configure MAG and BARO unconditionally.
144 #define USE_MAG
145 #define USE_MAG_HMC5883
146 #define USE_MAG_QMC5883
147 #define MAG_HMC5883_ALIGN CW90_DEG
149 #define USE_BARO
150 #define USE_BARO_MS5611
151 #define USE_BARO_BMP085
152 #define USE_BARO_BMP280
154 #if defined(AIRBOTF4) || defined(AIRBOTF4SD)
155 #define USE_BARO_SPI_BMP280
156 #define BMP280_SPI_INSTANCE SPI1
157 #define BMP280_CS_PIN PC13
158 #endif
160 #if defined(AIRBOTF4SD)
161 // SDCARD support for AIRBOTF4SD
162 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
163 #define USE_SDCARD
164 #define SDCARD_DETECT_INVERTED
165 #define SDCARD_DETECT_PIN PC0
166 #define SDCARD_SPI_INSTANCE SPI3
167 #define SDCARD_SPI_CS_PIN SPI3_NSS_PIN
169 // SPI2 is on the APB1 bus whose clock runs at 84MHz. Divide to under 400kHz for init:
170 #define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 256 // 328kHz
171 // Divide to under 25MHz for normal operation:
172 #define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 4 // 21MHz
174 #define SDCARD_DMA_CHANNEL_TX DMA1_Stream5
175 #define SDCARD_DMA_CHANNEL 0
177 #else
179 #define M25P16_CS_PIN PB3
180 #define M25P16_SPI_INSTANCE SPI3
181 #define USE_FLASHFS
182 #define USE_FLASH_M25P16
184 #endif // AIRBOTF4SD
187 #define USE_VCP
188 #if defined(PODIUMF4)
189 #define USE_USB_DETECT
190 #define USB_DETECT_PIN PA8
191 #else
192 #define USE_USB_DETECT
193 #define USB_DETECT_PIN PC5
194 #endif
196 #define USE_UART1
197 #define UART1_RX_PIN PA10
198 #define UART1_TX_PIN PA9
199 #define UART1_AHB1_PERIPHERALS RCC_AHB1Periph_DMA2
201 #define USE_UART3
202 #define UART3_RX_PIN PB11
203 #define UART3_TX_PIN PB10
205 #if defined(REVO)
206 #define USE_UART4
207 #define UART4_RX_PIN PA1
208 #define UART4_TX_PIN PA0
209 #endif // REVO
211 #define USE_UART6
212 #define UART6_RX_PIN PC7
213 #define UART6_TX_PIN PC6
214 #define PINIO1_PIN PC8 // DTR pin
216 #define USE_SOFTSERIAL1
217 #define USE_SOFTSERIAL2
219 #if defined(REVO)
220 #define SERIAL_PORT_COUNT 7 //VCP, USART1, USART3, UART4, USART6, SOFTSERIAL x 2
221 #else
222 #define SERIAL_PORT_COUNT 6 //VCP, USART1, USART3, USART6, SOFTSERIAL x 2
223 #endif
225 #define USE_ESCSERIAL
226 #define ESCSERIAL_TIMER_TX_PIN PB14 // (HARDARE=0,PPM)
228 #define USE_SPI
230 #define USE_SPI_DEVICE_1
232 #define USE_SPI_DEVICE_3
233 #define SPI3_NSS_PIN PB3
234 #define SPI3_SCK_PIN PC10
235 #define SPI3_MISO_PIN PC11
236 #define SPI3_MOSI_PIN PC12
238 #define USE_I2C
239 #if defined(AIRBOTF4) || defined(AIRBOTF4SD)
240 // On AIRBOTF4 and AIRBOTF4SD, I2C2 and I2C3 are configurable
241 #define USE_I2C_DEVICE_2
242 #define I2C2_SCL NONE // PB10, shared with UART3TX
243 #define I2C2_SDA NONE // PB11, shared with UART3RX
244 #define USE_I2C_DEVICE_3
245 #define I2C3_SCL NONE // PA8, PWM6
246 #define I2C3_SDA NONE // PC9, CH6
247 #define I2C_DEVICE (I2CDEV_2)
248 #else
249 #define USE_I2C_DEVICE_1
250 #define I2C_DEVICE (I2CDEV_1)
251 #define I2C1_SCL PB8
252 #define I2C1_SDA PB9
253 #endif
255 #define USE_ADC
256 #if !defined(PODIUMF4)
257 #define CURRENT_METER_ADC_PIN PC1
258 #define VBAT_ADC_PIN PC2
259 #else
260 #define VBAT_ADC_PIN PC3
261 #define VBAT_ADC_CHANNEL ADC_Channel_13
262 #endif
264 #if defined(AIRBOTF4SD)
265 #define RSSI_ADC_PIN PA0
266 #endif
268 #define USE_TRANSPONDER
270 #define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
271 #if defined(PODIUMF4)
272 #define SERIALRX_PROVIDER SERIALRX_SBUS
273 #define SERIALRX_UART SERIAL_PORT_USART6
274 #define DEFAULT_FEATURES FEATURE_TELEMETRY
275 #endif
277 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
279 #define TARGET_IO_PORTA 0xffff
280 #define TARGET_IO_PORTB 0xffff
281 #define TARGET_IO_PORTC 0xffff
282 #define TARGET_IO_PORTD (BIT(2))
284 #if defined(AIRBOTF4) || defined(AIRBOTF4SD)
285 #define USABLE_TIMER_CHANNEL_COUNT 13
286 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(5) | TIM_N(8) | TIM_N(12) )
287 #else
288 #define USABLE_TIMER_CHANNEL_COUNT 12
289 #define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(5) | TIM_N(8) | TIM_N(12) )
290 #endif