Add Winbond 25Q128 flash driver
[betaflight.git] / src / main / target / SPRACINGH7NANO / target.h
blob2188ffbdad03d63ddafda5efd9644d047b6e68d5
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 #define TARGET_BOARD_IDENTIFIER "SP7N"
24 #define USBD_PRODUCT_STRING "SPRacingH7NANO"
26 #define USE_TARGET_CONFIG
28 #define USE_SPRACING_PERSISTENT_RTC_WORKAROUND
30 #define LED0_PIN PE3
32 #define USE_BEEPER
33 #define BEEPER_PIN PD7
34 #define BEEPER_INVERTED
36 // Force two buttons to look at the single button so config reset on button works
37 #define USE_BUTTONS
38 #define BUTTON_A_PIN PE4
39 #define BUTTON_A_PIN_INVERTED // Active high
40 #define BUTTON_B_PIN PE4
41 #define BUTTON_B_PIN_INVERTED // Active high
43 #define USE_QUADSPI
44 #define USE_QUADSPI_DEVICE_1
46 #define QUADSPI1_SCK_PIN PB2
48 #define QUADSPI1_BK1_IO0_PIN PD11
49 #define QUADSPI1_BK1_IO1_PIN PD12
50 #define QUADSPI1_BK1_IO2_PIN PE2
51 #define QUADSPI1_BK1_IO3_PIN PD13
52 #define QUADSPI1_BK1_CS_PIN NONE
54 #define QUADSPI1_BK2_IO0_PIN PE7
55 #define QUADSPI1_BK2_IO1_PIN PE8
56 #define QUADSPI1_BK2_IO2_PIN PE9
57 #define QUADSPI1_BK2_IO3_PIN PE10
58 #define QUADSPI1_BK2_CS_PIN PB10
60 #define QUADSPI1_MODE QUADSPI_MODE_BK2_ONLY
61 #define QUADSPI1_CS_FLAGS (QUADSPI_BK1_CS_NONE | QUADSPI_BK2_CS_SOFTWARE | QUADSPI_CS_MODE_SEPARATE)
63 #define USE_FLASH_CHIP
64 #define CONFIG_IN_EXTERNAL_FLASH
65 //#define CONFIG_IN_SDCARD
66 //#define CONFIG_IN_RAM
67 #if !defined(CONFIG_IN_RAM) && !defined(CONFIG_IN_SDCARD) && !defined(CONFIG_IN_EXTERNAL_FLASH)
68 #error "EEPROM storage location not defined"
69 #endif
71 #define USE_UART
73 #define USE_UART1
74 #define UART1_RX_PIN PB15
75 #define UART1_TX_PIN PB14
77 #define USE_UART2
78 #define UART2_RX_PIN NONE
79 #define UART2_TX_PIN PD5 // TX pin is bidirectional.
81 #define USE_UART3
82 #define UART3_RX_PIN PD9
83 #define UART3_TX_PIN PD8
85 #define USE_UART4
86 #define UART4_RX_PIN PD0
87 #define UART4_TX_PIN PD1
89 #define USE_UART5
90 #define UART5_RX_PIN PB5
91 #define UART5_TX_PIN PB13
93 #define USE_UART6
94 #define UART6_RX_PIN PC7 // aka M7
95 #define UART6_TX_PIN PC6 // aka M8
97 #define USE_UART8
98 #define UART8_RX_PIN PE0
99 #define UART8_TX_PIN PE1
101 #define USE_VCP
102 #define USE_USB_ID
104 #define SERIAL_PORT_COUNT 8
106 #define USE_SPI
108 #define USE_SPI_DEVICE_2
109 #define SPI2_SCK_PIN PD3
110 #define SPI2_MISO_PIN PC2
111 #define SPI2_MOSI_PIN PC3
112 #define SPI2_NSS_PIN PB12
114 #define USE_SPI_DEVICE_3
115 #define SPI3_SCK_PIN PB3
116 #define SPI3_MISO_PIN PB4
117 #define SPI3_MOSI_PIN PD6
118 #define SPI3_NSS_PIN PA15
120 #define USE_SPI_DEVICE_4
121 #define SPI4_SCK_PIN PE12
122 #define SPI4_MISO_PIN PE13
123 #define SPI4_MOSI_PIN PE14
124 #define SPI4_NSS_PIN PE11
126 #define USE_I2C
127 #define USE_I2C_DEVICE_1
128 #define I2C1_SCL PB8
129 #define I2C1_SDA PB9
130 #define I2C_DEVICE (I2CDEV_1)
132 #define USE_I2C_DEVICE_4 // Shared with motor outputs 5/6
133 #define I2C4_SCL PB6
134 #define I2C4_SDA PB7
136 #define USE_MAG
137 #define USE_MAG_HMC5883
138 #define USE_MAG_QMC5883
140 #define USE_BARO
141 #define USE_BARO_BMP388
142 #define USE_BARO_BMP280
143 #define USE_BARO_MS5611
145 #define USE_GYRO
146 #define USE_GYRO_SPI_MPU6500
147 #define USE_MULTI_GYRO
148 #undef USE_GYRO_REGISTER_DUMP
150 #define USE_EXTI
151 #define USE_GYRO_EXTI
152 #define GYRO_1_EXTI_PIN PE15
153 #define GYRO_2_EXTI_PIN PD4
154 #define USE_MPU_DATA_READY_SIGNAL
155 #define ENSURE_MPU_DATA_READY_IS_LOW
158 #define GYRO_1_CS_PIN SPI2_NSS_PIN
159 #define GYRO_1_SPI_INSTANCE SPI2
161 #define GYRO_2_CS_PIN SPI3_NSS_PIN
162 #define GYRO_2_SPI_INSTANCE SPI3
164 #define USE_ACC
165 #define USE_ACC_SPI_MPU6500
167 #define GYRO_1_ALIGN CW0_DEG_FLIP
168 #define GYRO_2_ALIGN CW0_DEG_FLIP
170 #define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_1
172 #define USE_FLASHFS
173 #define USE_FLASH_TOOLS
174 #define USE_FLASH_W25N01G
175 #define FLASH_QUADSPI_INSTANCE QUADSPI
177 // SD card not present on hardware, but pins are reserved.
178 //#define USE_SDCARD
179 #ifdef USE_SDCARD
180 #define SDCARD_DETECT_PIN PD10
181 #define SDCARD_DETECT_INVERTED
182 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
183 #else
184 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
185 #endif
188 #define USE_TRANSPONDER
190 // MAX7456 not present on hardware, but pins are reserved and available on stacking connector.
191 #define USE_MAX7456
192 #define MAX7456_SPI_INSTANCE SPI4
193 #define MAX7456_SPI_CS_PIN SPI4_NSS_PIN
195 #ifdef USE_DMA_SPEC
196 //#define UART1_TX_DMA_OPT 0
197 //#define UART2_TX_DMA_OPT 1
198 //#define UART3_TX_DMA_OPT 2
199 //#define UART4_TX_DMA_OPT 3
200 //#define UART5_TX_DMA_OPT 4
201 //#define UART6_TX_DMA_OPT 5
202 //#define UART7_TX_DMA_OPT 6
203 //#define UART8_TX_DMA_OPT 7
204 #define ADC1_DMA_OPT 8
205 #define ADC3_DMA_OPT 9
206 //#define ADC2_DMA_OPT 10 // ADC2 not used.
207 #else
208 #define ADC1_DMA_STREAM DMA2_Stream0
209 #define ADC3_DMA_STREAM DMA2_Stream1
210 //#define ADC2_DMA_STREAM DMA2_Stream2 // ADC2 not used.
211 #endif
213 #define USE_ADC
214 #define USE_ADC_INTERNAL // ADC3
216 #define RSSI_ADC_PIN PC4 // ADC123
217 #define VBAT_ADC_PIN PC1 // ADC12
218 #define CURRENT_METER_ADC_PIN PC0 // ADC123
219 #define EXTERNAL1_ADC_PIN PC5 // ADC12
221 #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
222 #define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
224 #define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
225 #define DEFAULT_FEATURES (FEATURE_TRANSPONDER | FEATURE_RSSI_ADC | FEATURE_TELEMETRY | FEATURE_OSD | FEATURE_LED_STRIP)
227 #define TARGET_IO_PORTA 0xffff
228 #define TARGET_IO_PORTB 0xffff
229 #define TARGET_IO_PORTC 0xffff
230 #define TARGET_IO_PORTD 0xffff
231 #define TARGET_IO_PORTE 0xffff
232 #define TARGET_IO_PORTF 0xffff
233 #define TARGET_IO_PORTG 0xffff
235 #define USABLE_TIMER_CHANNEL_COUNT 19
237 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(5) | TIM_N(8) | TIM_N(12) | TIM_N(15) )