Blackbox device type 'file' (SITL) considered working when file handler is available
[inav.git] / src / main / target / OMNIBUSF4 / target.h
blob2c5a27afbb6f2de4f4aa3541cd2a8197e8ed9cd4
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
20 //Same target as OMNIBUSF4PRO with LED strip in M5
21 #ifdef OMNIBUSF4PRO_LEDSTRIPM5
22 #define OMNIBUSF4PRO
23 #endif
24 //Same target as OMNIBUSF4V3 with softserial in M5 and M6
25 #if defined(OMNIBUSF4V3_S6_SS) || defined(OMNIBUSF4V3_S5S6_SS) || defined(OMNIBUSF4V3_S5_S6_2SS)
26 #define OMNIBUSF4V3
27 #endif
29 #ifdef OMNIBUSF4PRO
30 #define TARGET_BOARD_IDENTIFIER "OBSD"
31 #elif defined(OMNIBUSF4V3)
32 #define TARGET_BOARD_IDENTIFIER "OB43"
33 #elif defined(DYSF4PRO)
34 #define TARGET_BOARD_IDENTIFIER "DYS4"
35 #elif defined(DYSF4PROV2)
36 #define TARGET_BOARD_IDENTIFIER "DY42"
37 #else
38 #define TARGET_BOARD_IDENTIFIER "OBF4"
39 #endif
41 #if defined(DYSF4PRO) || defined(DYSF4PROV2)
42 #define USBD_PRODUCT_STRING "DysF4Pro"
43 #else
44 #define USBD_PRODUCT_STRING "Omnibus F4"
45 #endif
47 #define LED0 PB5
49 #define BEEPER PB4
50 #define BEEPER_INVERTED
52 #if defined(DYSF4PROV2)
53 #define USE_I2C
54 #define USE_I2C_DEVICE_1
55 #define I2C1_SCL PB8
56 #define I2C1_SDA PB9
57 #define I2C_EXT_BUS BUS_I2C1
58 #else
59 #define USE_I2C
60 #define USE_I2C_DEVICE_2
61 #define I2C_DEVICE_2_SHARES_UART3
62 #define I2C_EXT_BUS BUS_I2C2
63 #endif
65 #define UG2864_I2C_BUS I2C_EXT_BUS
67 #define MPU6000_CS_PIN PA4
68 #define MPU6000_SPI_BUS BUS_SPI1
70 #if defined(OMNIBUSF4PRO) || defined(OMNIBUSF4V3)
71 #define USE_IMU_MPU6000
72 #define IMU_MPU6000_ALIGN CW270_DEG
73 #else
74 #define USE_IMU_MPU6000
75 #define IMU_MPU6000_ALIGN CW180_DEG
76 #endif
78 // Support for OMNIBUS F4 PRO CORNER - it has ICM20608 instead of MPU6000
79 #if defined(OMNIBUSF4PRO) || defined(OMNIBUSF4V3)
80 #define MPU6500_CS_PIN MPU6000_CS_PIN
81 #define MPU6500_SPI_BUS MPU6000_SPI_BUS
82 #define USE_IMU_MPU6500
83 #define IMU_MPU6500_ALIGN IMU_MPU6000_ALIGN
85 //BMI270
86 #define USE_IMU_BMI270
87 #define IMU_BMI270_ALIGN IMU_MPU6000_ALIGN
88 #define BMI270_SPI_BUS MPU6000_SPI_BUS
89 #define BMI270_CS_PIN MPU6000_CS_PIN
90 #endif
92 #define USE_MAG
93 #define MAG_I2C_BUS I2C_EXT_BUS
94 #define USE_MAG_ALL
96 #define TEMPERATURE_I2C_BUS I2C_EXT_BUS
98 #define USE_BARO
100 #if defined(OMNIBUSF4PRO) || defined(OMNIBUSF4V3)
101 #define USE_BARO_BMP280
102 #define BMP280_SPI_BUS BUS_SPI3
103 #define BMP280_CS_PIN PB3 // v1
104 // Support external barometers
105 #define BARO_I2C_BUS I2C_EXT_BUS
106 #define USE_BARO_BMP085
107 #define USE_BARO_MS5611
108 #else
109 #define BARO_I2C_BUS I2C_EXT_BUS
110 #define USE_BARO_BMP085
111 #define USE_BARO_BMP280
112 #define USE_BARO_MS5611
113 #endif
115 #define PITOT_I2C_BUS I2C_EXT_BUS
117 #define USE_RANGEFINDER
118 #define RANGEFINDER_I2C_BUS I2C_EXT_BUS
120 #define USE_VCP
121 #define VBUS_SENSING_PIN PC5
122 #define VBUS_SENSING_ENABLED
124 #if defined(OMNIBUSF4PRO) || defined(OMNIBUSF4V3)
125 #define USE_UART_INVERTER
126 #endif
128 #define USE_UART1
129 #define UART1_RX_PIN PA10
130 #define UART1_TX_PIN PA9
131 #define UART1_AHB1_PERIPHERALS RCC_AHB1Periph_DMA2
132 #if defined(OMNIBUSF4PRO)
133 #define INVERTER_PIN_UART1_RX PC0 // PC0 has never been used as inverter control on genuine OMNIBUS F4 variants, but leave it as is since some clones actually implement it.
134 #endif
136 #define USE_UART3
137 #define UART3_RX_PIN PB11
138 #define UART3_TX_PIN PB10
140 #define USE_UART6
141 #define UART6_RX_PIN PC7
142 #define UART6_TX_PIN PC6
143 #if defined(OMNIBUSF4V3)
144 #define INVERTER_PIN_UART6_RX PC8
145 #define INVERTER_PIN_UART6_TX PC9
146 #endif
148 #if defined(OMNIBUSF4V3) && !(defined(OMNIBUSF4V3_S6_SS) || defined(OMNIBUSF4V3_S5S6_SS) || defined(OMNIBUSF4V3_S5_S6_2SS))
149 #define USE_SOFTSERIAL1
150 #define SOFTSERIAL_1_RX_PIN PC6 // shared with UART6 TX
151 #define SOFTSERIAL_1_TX_PIN PC6 // shared with UART6 TX
153 #define SERIAL_PORT_COUNT 5 // VCP, USART1, USART3, USART6, SOFTSERIAL1
155 #elif defined(OMNIBUSF4V3_S6_SS) // one softserial on S6
156 #define USE_SOFTSERIAL1
157 #define SOFTSERIAL_1_RX_PIN PA8 // S6 output
158 #define SOFTSERIAL_1_TX_PIN PA8 // S6 output
160 #define SERIAL_PORT_COUNT 5 // VCP, USART1, USART3, USART6, SOFTSERIAL1
162 #elif defined(OMNIBUSF4V3_S5S6_SS) // one softserial on S5/RX S6/TX
163 #define USE_SOFTSERIAL1
164 #define SOFTSERIAL_1_RX_PIN PA1 // S5 output
165 #define SOFTSERIAL_1_TX_PIN PA8 // S6 output
167 #define SERIAL_PORT_COUNT 5 // VCP, USART1, USART3, USART6, SOFTSERIAL1
169 #elif defined(OMNIBUSF4V3_S5_S6_2SS) // two softserials, one on S5 and one on S6
170 #define USE_SOFTSERIAL1
171 #define SOFTSERIAL_1_RX_PIN PA1 // S5 output
172 #define SOFTSERIAL_1_TX_PIN PA1 // S5 output
174 #define USE_SOFTSERIAL2
175 #define SOFTSERIAL_2_RX_PIN PA8 // S6 output
176 #define SOFTSERIAL_2_TX_PIN PA8 // S6 output
178 #define SERIAL_PORT_COUNT 6 // VCP, USART1, USART3, USART6, SOFTSERIAL1, SOFTSERIAL2
180 #else // One softserial on versions other than OMNIBUSF4V3
181 #define USE_SOFTSERIAL1
182 #define SOFTSERIAL_1_RX_PIN PC8 // pad labelled CH5 on OMNIBUSF4PRO
183 #define SOFTSERIAL_1_TX_PIN PC9 // pad labelled CH6 on OMNIBUSF4PRO
185 #define SERIAL_PORT_COUNT 5 // VCP, USART1, USART3, USART6, SOFTSERIAL1
186 #endif
188 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
189 #define SERIALRX_PROVIDER SERIALRX_SBUS
190 #define SERIALRX_UART SERIAL_PORT_USART1
192 #define USE_SPI
194 #define USE_SPI_DEVICE_1
196 #if defined(OMNIBUSF4PRO) || defined(OMNIBUSF4V3)
197 #define USE_SPI_DEVICE_2
198 #define SPI2_NSS_PIN PB12
199 #define SPI2_SCK_PIN PB13
200 #define SPI2_MISO_PIN PB14
201 #define SPI2_MOSI_PIN PB15
202 #endif
204 #define USE_SPI_DEVICE_3
205 #if defined(OMNIBUSF4PRO) || defined(OMNIBUSF4V3)
206 #define SPI3_NSS_PIN PA15
207 #else
208 #define SPI3_NSS_PIN PB3
209 #endif
210 #define SPI3_SCK_PIN PC10
211 #define SPI3_MISO_PIN PC11
212 #define SPI3_MOSI_PIN PC12
214 #define USE_MAX7456
215 #define MAX7456_SPI_BUS BUS_SPI3
216 #define MAX7456_CS_PIN PA15
218 #if defined(OMNIBUSF4PRO) || defined(OMNIBUSF4V3)
219 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
220 #define USE_SDCARD
221 #define USE_SDCARD_SPI
223 #define SDCARD_SPI_BUS BUS_SPI2
224 #define SDCARD_CS_PIN SPI2_NSS_PIN
226 #define SDCARD_DETECT_PIN PB7
227 #define SDCARD_DETECT_INVERTED
228 #else
229 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
230 #define M25P16_CS_PIN SPI3_NSS_PIN
231 #define M25P16_SPI_BUS BUS_SPI3
232 #define USE_FLASHFS
233 #define USE_FLASH_M25P16
234 #endif
236 #define USE_ADC
237 #define ADC_CHANNEL_1_PIN PC1
238 #define ADC_CHANNEL_2_PIN PC2
240 #ifdef DYSF4PRO
241 #define ADC_CHANNEL_3_PIN PC3
242 #else
243 #define ADC_CHANNEL_3_PIN PA0
244 #endif
246 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_1
247 #define VBAT_ADC_CHANNEL ADC_CHN_2
248 #define RSSI_ADC_CHANNEL ADC_CHN_3
250 #define SENSORS_SET (SENSOR_ACC|SENSOR_MAG|SENSOR_BARO)
252 #define USE_LED_STRIP
253 #if (defined(OMNIBUSF4PRO) || defined(OMNIBUSF4V3)) && !defined(OMNIBUSF4PRO_LEDSTRIPM5)
254 #define WS2811_PIN PB6
255 #else
256 #define WS2811_PIN PA1
257 #endif
259 #define DISABLE_RX_PWM_FEATURE
260 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX | FEATURE_VBAT | FEATURE_OSD)
262 #define USE_SPEKTRUM_BIND
263 #define BIND_PIN PB11 // USART3 RX
265 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
267 // Number of available PWM outputs
268 #define MAX_PWM_OUTPUT_PORTS 6
269 #define TARGET_MOTOR_COUNT 6
270 #define USE_DSHOT
271 #define USE_ESC_SENSOR
273 #define TARGET_IO_PORTA 0xffff
274 #define TARGET_IO_PORTB 0xffff
275 #define TARGET_IO_PORTC 0xffff
276 #define TARGET_IO_PORTD 0xffff
278 #ifdef OMNIBUSF4PRO
279 #define CURRENT_METER_SCALE 265
280 #endif