Update DPS310 driver to support SPL07-003
[inav.git] / src / main / target / ZEEZF7 / target.h
blob28395b274fbe71de66df92ce1483e8ae674c6020
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 #ifdef ZEEZF7V3
21 #define TARGET_BOARD_IDENTIFIER "ZEF7V3"
22 #define USBD_PRODUCT_STRING "ZEEZF7V3"
23 #endif
24 #ifdef ZEEZF7V2
25 #define TARGET_BOARD_IDENTIFIER "ZEF7V2"
26 #define USBD_PRODUCT_STRING "ZEEZF7V2"
27 #endif
28 #ifdef ZEEZF7
29 #define TARGET_BOARD_IDENTIFIER "ZEF7"
30 #define USBD_PRODUCT_STRING "ZEEZF7"
31 #endif
33 #define USE_TARGET_CONFIG
35 #define LED0 PC14
36 #define LED1 PC15
38 #ifdef ZEEZF7V3
39 #define BEEPER PC4
40 #define BEEPER_INVERTED
41 #else
42 #define BEEPER PB2
43 #define BEEPER_INVERTED
44 #endif
46 // *************** Gyro & ACC **********************
47 #define USE_SPI
49 #ifdef ZEEZF7V3
51 #define USE_SPI_DEVICE_3
53 #define SPI3_NSS_PIN PA15
54 #define SPI3_SCK_PIN PC10
55 #define SPI3_MISO_PIN PC11
56 #define SPI3_MOSI_PIN PB5
58 // *************** SPI3 IMU0 ICM42688P **************
59 #define USE_IMU_ICM42605
61 #define IMU_ICM42605_ALIGN CW0_DEG
62 #define ICM42605_SPI_BUS BUS_SPI3
63 #define ICM42605_CS_PIN SPI3_NSS_PIN
65 // *************** SPI3 IMU0 BMI270 **************
66 #define USE_IMU_BMI270
68 #define IMU_BMI270_ALIGN CW270_DEG
69 #define BMI270_SPI_BUS BUS_SPI3
70 #define BMI270_CS_PIN SPI3_NSS_PIN
71 #endif
73 #ifdef ZEEZF7V2
74 #define USE_SPI_DEVICE_1
75 #define SPI1_NSS_PIN PA4
76 #define SPI1_SCK_PIN PA5
77 #define SPI1_MISO_PIN PA6
78 #define SPI1_MOSI_PIN PA7
80 #define MPU6000_CS_PIN SPI1_NSS_PIN
81 #define MPU6000_SPI_BUS BUS_SPI1
82 #define IMU_MPU6000_ALIGN CW0_DEG
83 #define USE_IMU_MPU6000
84 #endif
87 #ifdef ZEEZF7
88 #define USE_SPI_DEVICE_2
89 #define SPI2_NSS_PIN PB12
90 #define SPI2_SCK_PIN PB13
91 #define SPI2_MISO_PIN PB14
92 #define SPI2_MOSI_PIN PB15
94 #define MPU6000_CS_PIN SPI2_NSS_PIN
95 #define MPU6000_SPI_BUS BUS_SPI2
97 #define IMU_MPU6000_ALIGN CW0_DEG_FLIP
98 #define USE_IMU_MPU6000
99 #endif
101 // *************** I2C/Baro/Mag *********************
103 #ifdef ZEEZF7
104 // Target has no I2C but can use MSP devices, such as those provided on Mateksys MQ8-CAN/MSP
105 // Which contains: GPS SAM-M8Q, Compass QMC5883L, Barometer DPS310
106 // See: http://www.mateksys.com/?portfolio=m8q-can
107 #define USE_BARO
108 #define USE_BARO_DPS310
110 #define USE_MAG
111 #define USE_MAG_QMC5883
112 #endif
114 #if defined ZEEZF7V2 || defined ZEEZF7V3
115 #define USE_I2C
116 #define USE_BARO
117 #define USE_BARO_BMP280
118 #define USE_BARO_BMP388
119 #define USE_BARO_DPS310
121 #define BARO_I2C_BUS BUS_I2C1
123 #define USE_I2C_DEVICE_1
124 #define I2C1_SCL PB8
125 #define I2C1_SDA PB9
127 // External I2C Pads -- I2C3
128 #define USE_I2C_DEVICE_3
129 #define I2C3_SCL PA8
130 #define I2C3_SDA PC9
132 #define USE_MAG
133 #define MAG_I2C_BUS BUS_I2C3
134 #define USE_MAG_ALL
135 #endif
137 // *************** Flash ****************************
139 #if defined ZEEZF7V2 || defined ZEEZF7V3
140 #define USE_SPI_DEVICE_2
141 #define SPI2_NSS_PIN PB12
142 #define SPI2_SCK_PIN PB13
143 #define SPI2_MISO_PIN PC2
144 #define SPI2_MOSI_PIN PC3
146 #define M25P16_SPI_BUS BUS_SPI2
147 #define M25P16_CS_PIN SPI2_NSS_PIN
149 #define W25N01G_SPI_BUS BUS_SPI2
150 #define W25N01G_CS_PIN SPI2_NSS_PIN
151 #ifdef ZEEZF7V3
152 #define SDCARD_SPI_BUS BUS_SPI2
153 #define SDCARD_CS_PIN SPI2_NSS_PIN
155 #define USE_SDCARD
156 #define USE_SDCARD_SPI
157 #endif
159 #endif
161 #ifdef ZEEZF7
162 #define USE_SPI_DEVICE_1
163 #define SPI1_NSS_PIN PA4
164 #define SPI1_SCK_PIN PA5
165 #define SPI1_MISO_PIN PA6
166 #define SPI1_MOSI_PIN PA7
168 #define M25P16_SPI_BUS BUS_SPI1
169 #define M25P16_CS_PIN SPI1_NSS_PIN
171 #define W25N01G_SPI_BUS BUS_SPI1
172 #define W25N01G_CS_PIN SPI1_NSS_PIN
174 #endif
176 #define USE_FLASHFS
177 #define USE_FLASH_M25P16
178 #define USE_FLASH_W25N01G
179 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
181 // *************** OSD *****************************
182 #define USE_MAX7456
184 #if defined ZEEZF7 || defined ZEEZF7V2
185 #define USE_SPI_DEVICE_3
186 #define SPI3_NSS_PIN PA15
187 #define SPI3_SCK_PIN PC10
188 #define SPI3_MISO_PIN PC11
189 #define SPI3_MOSI_PIN PB5
191 #define MAX7456_SPI_BUS BUS_SPI3
192 #define MAX7456_CS_PIN SPI3_NSS_PIN
193 #else
194 #define USE_SPI_DEVICE_1
195 #define SPI1_NSS_PIN PA4
196 #define SPI1_SCK_PIN PA5
197 #define SPI1_MISO_PIN PA6
198 #define SPI1_MOSI_PIN PA7
200 #define MAX7456_SPI_BUS BUS_SPI1
201 #define MAX7456_CS_PIN SPI1_NSS_PIN
202 #endif
204 // *************** PINIO ***************************
206 #ifdef ZEEZF7
207 #define USE_PINIO
208 #define USE_PINIOBOX
209 #define PINIO1_PIN PB11 // VTX power switcher
210 #endif
212 // *************** UART *****************************
214 #define USE_VCP
216 #define USE_UART1
217 #define UART1_RX_PIN PA10
218 #define UART1_TX_PIN PA9
220 #define USE_UART2
221 #define UART2_RX_PIN PA3
222 #define UART2_TX_PIN PA2
224 #define USE_UART3
225 #define UART3_RX_PIN PB11
226 #define UART3_TX_PIN PB10
228 #define USE_UART4
229 #define UART4_RX_PIN PA1
230 #define UART4_TX_PIN PA0
232 #define USE_UART5
233 #define UART5_RX_PIN PD2
234 #define UART5_TX_PIN PC12
236 #if defined ZEEZF7V2 || defined ZEEZF7V3
237 #define SERIAL_PORT_COUNT 6
238 #else
239 #define USE_UART6
240 #define UART6_RX_PIN PC7
241 #define UART6_TX_PIN PC6
242 #define SERIAL_PORT_COUNT 7
243 #endif
245 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
246 #define SERIALRX_PROVIDER SERIALRX_SBUS
247 #define SERIALRX_UART SERIAL_PORT_USART4
249 // *************** ADC *****************************
250 #define USE_ADC
251 #define ADC_INSTANCE ADC1
252 #define ADC1_DMA_STREAM DMA2_Stream0
254 #if defined ZEEZF7V2 || defined ZEEZF7V3
255 #define ADC_CHANNEL_1_PIN PC0
256 #define ADC_CHANNEL_2_PIN PC1
257 #else
258 #define ADC_CHANNEL_1_PIN PC2
259 #define ADC_CHANNEL_2_PIN PC3
260 #endif
262 #define VBAT_ADC_CHANNEL ADC_CHN_1
263 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
265 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_CURRENT_METER | FEATURE_TELEMETRY | FEATURE_VBAT | FEATURE_OSD | FEATURE_LED_STRIP)
267 #if defined ZEEZF7V2 || defined ZEEZF7V3
268 #define CURRENT_METER_SCALE 250
269 #endif
271 // ********** Optical Flow and Lidar **************
273 #define USE_RANGEFINDER
274 #define USE_RANGEFINDER_MSP
275 #define USE_OPFLOW
276 #define USE_OPFLOW_MSP
278 // *************** LED *****************************
280 #define USE_LED_STRIP
281 #define WS2811_PIN PB0
283 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
285 #define TARGET_IO_PORTA 0xffff
286 #define TARGET_IO_PORTB 0xffff
287 #define TARGET_IO_PORTC 0xffff
288 #define TARGET_IO_PORTD (BIT(2))
290 #if defined ZEEZF7V2 || defined ZEEZF7V3
291 #define MAX_PWM_OUTPUT_PORTS 8
292 #else
293 #define MAX_PWM_OUTPUT_PORTS 4
294 #endif
296 #define USE_DSHOT
297 #define USE_ESC_SENSOR