[FLYWOOF411] add board documentation
[inav/snaewe.git] / src / main / target / FIREWORKSV2 / target.h
blobc3818458fd501b0cadaf60c9cb7798afed94b2f5
1 /*
2 * This file is part of INAV.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
6 * You can obtain one at http://mozilla.org/MPL/2.0/.
8 * Alternatively, the contents of this file may be used under the terms
9 * of the GNU General Public License Version 3, as described below:
11 * This file is free software: you may copy, redistribute and/or modify
12 * it under the terms of the GNU General Public License as published by the
13 * Free Software Foundation, either version 3 of the License, or (at your
14 * option) any later version.
16 * This file is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19 * Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see http://www.gnu.org/licenses/.
25 #pragma once
27 #if defined(OMNIBUSF4V6)
28 #define TARGET_BOARD_IDENTIFIER "OBV6"
29 #else
30 #define TARGET_BOARD_IDENTIFIER "FWX2"
31 #endif
33 #if defined(OMNIBUSF4V6)
34 #define USBD_PRODUCT_STRING "OmnibusF4 V6"
35 #else
36 #define USBD_PRODUCT_STRING "OMNIBUS F4 FWX V2"
37 #endif
39 #define USE_DSHOT
40 #define USE_ESC_SENSOR
42 // Status LED
43 #define LED0 PA8
45 // Beeper
46 #define BEEPER PB4
47 #define BEEPER_INVERTED
49 // I2C
50 #define USE_I2C
51 #if defined(OMNIBUSF4V6)
52 #define USE_I2C_DEVICE_1
53 #define I2C1_SCL PB8 // SCL PIN,alt MST8
54 #define I2C1_SDA PB9 // SDA PIN,alt MST7
55 #define DEFAULT_I2C_BUS BUS_I2C1
56 #else
57 #define USE_I2C_DEVICE_2
58 #define I2C_DEVICE_2_SHARES_UART3
59 #endif
61 #define USE_EXTI
62 #define GYRO_INT_EXTI PC8
63 // #define USE_MPU_DATA_READY_SIGNAL // Not connected on FireworksV2
65 #define USE_DUAL_GYRO
66 #define USE_TARGET_IMU_HARDWARE_DESCRIPTORS // Don't use common busdev descriptors for IMU
67 #define USE_IMU_MPU6500
68 #define USE_IMU_MPU6000
70 #if defined(OMNIBUSF4V6)
71 # define IMU_1_CS_PIN PA4
72 # define IMU_1_SPI_BUS BUS_SPI1
73 # define IMU_1_ALIGN CW180_DEG
74 # define IMU_2_CS_PIN PC14
75 # define IMU_2_SPI_BUS BUS_SPI1
76 # define IMU_2_ALIGN CW0_DEG
77 #else
78 // IMU_1 is verified to work on OBF4V6 and Omnibus Fireworks board
79 # define IMU_1_CS_PIN PA4
80 # define IMU_1_SPI_BUS BUS_SPI1
81 # define IMU_1_ALIGN CW0_DEG_FLIP
82 // IMU_2 is sketchy and was not verified on actual hardware
83 # define IMU_2_CS_PIN PD2
84 # define IMU_2_SPI_BUS BUS_SPI3
85 # define IMU_2_ALIGN CW180_DEG
86 #endif
88 #define USE_MAG
89 #if defined(OMNIBUSF4V6)
90 #define MAG_I2C_BUS BUS_I2C1
91 #else
92 #define MAG_I2C_BUS BUS_I2C2
93 #endif
94 #define USE_MAG_HMC5883
95 #define USE_MAG_QMC5883
96 #define USE_MAG_IST8310
97 #define USE_MAG_MAG3110
98 #define USE_MAG_LIS3MDL
100 #if defined(OMNIBUSF4V6)
101 #define TEMPERATURE_I2C_BUS BUS_I2C1
102 #else
103 #define TEMPERATURE_I2C_BUS BUS_I2C2
104 #endif
106 #define USE_BARO
107 #define USE_BARO_BMP280
108 #define BMP280_SPI_BUS BUS_SPI3
109 #define BMP280_CS_PIN PB3
110 #if defined(OMNIBUSF4V6)
111 #define BARO_I2C_BUS BUS_I2C1
112 #endif
114 #if defined(OMNIBUSF4V6)
115 #define PITOT_I2C_BUS BUS_I2C1
116 #else
117 #define PITOT_I2C_BUS BUS_I2C2
118 #endif
120 #define USE_RANGEFINDER
121 #if defined(OMNIBUSF4V6)
122 #define RANGEFINDER_I2C_BUS BUS_I2C1
123 #else
124 #define RANGEFINDER_I2C_BUS BUS_I2C2
125 #endif
126 #define USE_RANGEFINDER_HCSR04_I2C
128 #define USE_VCP
129 #define VBUS_SENSING_PIN PC5
130 #define VBUS_SENSING_ENABLED
132 #define USE_UART1
133 #define UART1_RX_PIN PA10
134 #define UART1_TX_PIN PA9
136 #define USE_UART2
137 #define UART2_RX_PIN NONE
138 #define UART2_TX_PIN PA2
140 #define USE_UART3
141 #define UART3_RX_PIN PB11
142 #define UART3_TX_PIN PB10
144 #define USE_UART4
145 #define UART4_RX_PIN PA1
146 #define UART4_TX_PIN NONE
148 #define USE_UART6
149 #define UART6_RX_PIN PC7
150 #define UART6_TX_PIN PC6
152 #define USE_SOFTSERIAL1
153 #define SOFTSERIAL_1_RX_PIN NONE
154 #define SOFTSERIAL_1_TX_PIN PA9 // Clash with UART1_TX, needed for S.Port
156 #define SERIAL_PORT_COUNT 7 // VCP, USART1, USART2, USART3, USART4, USART6, SOFTSERIAL1
158 #define USE_SPI
160 #define USE_SPI_DEVICE_1
161 #define SPI1_NSS_PIN PA4
162 #define SPI1_SCK_PIN PA5
163 #define SPI1_MISO_PIN PA6
164 #define SPI1_MOSI_PIN PA7
166 #define USE_SPI_DEVICE_2
167 #define SPI2_NSS_PIN PB12
168 #define SPI2_SCK_PIN PB13
169 #define SPI2_MISO_PIN PB14
170 #define SPI2_MOSI_PIN PB15
172 #define USE_SPI_DEVICE_3
173 #define SPI3_NSS_PIN PA15
174 #define SPI3_SCK_PIN PC10
175 #define SPI3_MISO_PIN PC11
176 #define SPI3_MOSI_PIN PC12
178 #define USE_OSD
179 #define USE_MAX7456
180 #define MAX7456_SPI_BUS BUS_SPI3
181 #define MAX7456_CS_PIN PA15
183 #define USE_FLASHFS
184 #define USE_FLASH_M25P16
185 #define M25P16_CS_PIN PB12
186 #define M25P16_SPI_BUS BUS_SPI2
187 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
189 #define USE_ADC
190 #define ADC_CHANNEL_1_PIN PC1
191 #define ADC_CHANNEL_2_PIN PC2
192 #define ADC_CHANNEL_3_PIN PA0
194 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_1
195 #define VBAT_ADC_CHANNEL ADC_CHN_2
196 #define RSSI_ADC_CHANNEL ADC_CHN_3
198 #define SENSORS_SET (SENSOR_ACC | SENSOR_BARO)
200 #define USE_LED_STRIP
201 #define WS2811_PIN PB6
202 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST0_HANDLER
203 #define WS2811_DMA_STREAM DMA1_Stream0
204 #define WS2811_DMA_CHANNEL DMA_Channel_2
206 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX | FEATURE_VBAT | FEATURE_OSD | FEATURE_CURRENT_METER | FEATURE_SOFTSERIAL | FEATURE_TELEMETRY)
207 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
208 #define SERIALRX_PROVIDER SERIALRX_SBUS
209 #define DISABLE_RX_PWM_FEATURE
211 #define TELEMETRY_UART SERIAL_PORT_SOFTSERIAL1
212 #define SERIALRX_UART SERIAL_PORT_USART1
213 #define SMARTAUDIO_UART SERIAL_PORT_USART4
215 //Default values for OmnibusF4V6,calib values for FireworksV2
216 #if !defined(OMNIBUSF4V6)
217 #define CURRENT_METER_SCALE 175
218 #define CURRENT_METER_OFFSET 326
219 #endif
221 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
223 // Number of available PWM outputs
224 #define MAX_PWM_OUTPUT_PORTS 8
225 #define TARGET_MOTOR_COUNT 6
227 #define TARGET_IO_PORTA 0xffff
228 #define TARGET_IO_PORTB 0xffff
229 #define TARGET_IO_PORTC 0xffff
230 #define TARGET_IO_PORTD 0xffff
232 #if defined(OMNIBUSF4V6)
233 #define PCA9685_I2C_BUS BUS_I2C1
234 #else
235 #define PCA9685_I2C_BUS BUS_I2C2
236 #endif