FURYF3: Fix migration to new ADC IO
[betaflight.git] / src / main / target / FURYF3 / target.h
blobb247a4cc89f230ed318db6650b105a171d66341c
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 #define TARGET_BOARD_IDENTIFIER "FURY"
22 #define LED0 PC14
24 #define BEEPER PC15
25 #define BEEPER_INVERTED
27 //#define EXTI_CALLBACK_HANDLER_COUNT 2 // MPU INT, SDCardDetect
28 #define EXTI_CALLBACK_HANDLER_COUNT 1 // MPU INT
30 #define USE_MPU_DATA_READY_SIGNAL
31 #define ENSURE_MPU_DATA_READY_IS_LOW
33 #define GYRO
34 #define USE_GYRO_SPI_MPU6000
35 #define GYRO_MPU6000_ALIGN CW180_DEG // changedkb 270
36 #define USE_GYRO_MPU6500
37 #define USE_GYRO_SPI_MPU6500
38 #define GYRO_MPU6500_ALIGN CW90_DEG // changedkb 270
40 #define ACC
41 #define USE_ACC_SPI_MPU6000
42 #define ACC_MPU6000_ALIGN CW180_DEG // changedkb 270
43 #define USE_ACC_MPU6500
44 #define USE_ACC_SPI_MPU6500
45 #define ACC_MPU6500_ALIGN CW90_DEG // changedkb 270
47 #define MPU6000_CS_GPIO_CLK_PERIPHERAL RCC_AHBPeriph_GPIOA
48 #define MPU6000_CS_GPIO GPIOA
49 #define MPU6000_CS_PIN GPIO_Pin_4
50 #define MPU6000_SPI_INSTANCE SPI1
52 #define MPU6500_CS_GPIO_CLK_PERIPHERAL RCC_AHBPeriph_GPIOA
53 #define MPU6500_CS_GPIO GPIOA
54 #define MPU6500_CS_PIN GPIO_Pin_4
55 #define MPU6500_SPI_INSTANCE SPI1
57 #define MAG
58 #define USE_MAG_AK8975
59 #define USE_MAG_HMC5883
60 #define USE_MAG_MAG3110
62 #define BARO
63 #define USE_BARO_MS5611
64 #define USE_BARO_BMP280
66 #define USE_SPI
67 #define USE_SPI_DEVICE_1
68 #define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5
70 #define SPI2_GPIO GPIOB
71 #define SPI2_GPIO_PERIPHERAL RCC_AHBPeriph_GPIOB
72 #define SPI2_NSS_PIN Pin_12
73 #define SPI2_NSS_PIN_SOURCE GPIO_PinSource12
74 #define SPI2_SCK_PIN Pin_13
75 #define SPI2_SCK_PIN_SOURCE GPIO_PinSource13
76 #define SPI2_MISO_PIN Pin_14
77 #define SPI2_MISO_PIN_SOURCE GPIO_PinSource14
78 #define SPI2_MOSI_PIN Pin_15
79 #define SPI2_MOSI_PIN_SOURCE GPIO_PinSource15
81 #ifdef FURYF3_SPIFLASH
82 #define USE_FLASHFS
83 #undef BEEPER_INVERTED
84 #else
85 #define USE_SDCARD
86 #endif
88 #ifdef USE_FLASHFS
89 #define USE_FLASH_M25P16
90 #define M25P16_CS_GPIO GPIOB
91 #define M25P16_CS_PIN GPIO_Pin_12
92 #define M25P16_SPI_INSTANCE SPI2
93 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
94 #endif
96 #ifdef USE_SDCARD
97 #define USE_SDCARD_SPI2
99 #define SDCARD_DETECT_INVERTED
101 #define SDCARD_DETECT_PIN GPIO_Pin_2
102 #define SDCARD_DETECT_EXTI_LINE EXTI_Line2
103 #define SDCARD_DETECT_EXTI_PIN_SOURCE EXTI_PinSource2
104 #define SDCARD_DETECT_GPIO_PORT GPIOB
105 #define SDCARD_DETECT_GPIO_CLK RCC_AHBPeriph_GPIOB
106 #define SDCARD_DETECT_EXTI_PORT_SOURCE EXTI_PortSourceGPIOB
107 #define SDCARD_DETECT_EXTI_IRQn EXTI15_10_IRQn
109 #define SDCARD_SPI_INSTANCE SPI2
110 #define SDCARD_SPI_CS_GPIO SPI2_GPIO
111 #define SDCARD_SPI_CS_PIN SPI2_NSS_PIN
113 // SPI2 is on the APB1 bus whose clock runs at 36MHz. Divide to under 400kHz for init:
114 #define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 128
115 // Divide to under 25MHz for normal operation:
116 #define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 2
118 // Note, this is the same DMA channel as USART1_RX. Luckily we don't use DMA for USART Rx.
119 #define SDCARD_DMA_CHANNEL_TX DMA1_Channel5
120 #define SDCARD_DMA_CHANNEL_TX_COMPLETE_FLAG DMA1_FLAG_TC5
121 #endif
123 #define USABLE_TIMER_CHANNEL_COUNT 8
125 #define USB_IO
127 #define USE_VCP
128 #define USE_USART1
129 #define USE_USART2
130 #define USE_USART3
131 #define USE_SOFTSERIAL1
132 #define SERIAL_PORT_COUNT 5
134 #ifndef UART1_GPIO
135 #define UART1_TX_PIN GPIO_Pin_9 // PA9
136 #define UART1_RX_PIN GPIO_Pin_10 // PA10
137 #define UART1_GPIO GPIOA
138 #define UART1_GPIO_AF GPIO_AF_7
139 #define UART1_TX_PINSOURCE GPIO_PinSource9
140 #define UART1_RX_PINSOURCE GPIO_PinSource10
141 #endif
143 #define UART2_TX_PIN GPIO_Pin_14 // PA14
144 #define UART2_RX_PIN GPIO_Pin_15 // PA15
145 #define UART2_GPIO GPIOA
146 #define UART2_GPIO_AF GPIO_AF_7
147 #define UART2_TX_PINSOURCE GPIO_PinSource14
148 #define UART2_RX_PINSOURCE GPIO_PinSource15
150 #ifndef UART3_GPIO
151 #define UART3_TX_PIN GPIO_Pin_10 // PB10 (AF7)
152 #define UART3_RX_PIN GPIO_Pin_11 // PB11 (AF7)
153 #define UART3_GPIO_AF GPIO_AF_7
154 #define UART3_GPIO GPIOB
155 #define UART3_TX_PINSOURCE GPIO_PinSource10
156 #define UART3_RX_PINSOURCE GPIO_PinSource11
157 #endif
159 #define SOFTSERIAL_1_TIMER TIM3
160 #define SOFTSERIAL_1_TIMER_RX_HARDWARE 1
161 #define SOFTSERIAL_1_TIMER_TX_HARDWARE 2
163 #define USE_I2C
164 #define I2C_DEVICE (I2CDEV_1) // SDA (PB9/AF4), SCL (PB8/AF4)
166 #define I2C1_SCL_GPIO GPIOB
167 #define I2C1_SCL_GPIO_AF GPIO_AF_4
168 #define I2C1_SCL_PIN GPIO_Pin_8
169 #define I2C1_SCL_PIN_SOURCE GPIO_PinSource8
170 #define I2C1_SCL_CLK_SOURCE RCC_AHBPeriph_GPIOB
171 #define I2C1_SDA_GPIO GPIOB
172 #define I2C1_SDA_GPIO_AF GPIO_AF_4
173 #define I2C1_SDA_PIN GPIO_Pin_9
174 #define I2C1_SDA_PIN_SOURCE GPIO_PinSource9
175 #define I2C1_SDA_CLK_SOURCE RCC_AHBPeriph_GPIOB
177 #define BOARD_HAS_VOLTAGE_DIVIDER
178 #define USE_ADC
179 #define ADC_INSTANCE ADC1
180 #define VBAT_ADC_PIN PA0
181 #define RSSI_ADC_PIN PA1
182 #define CURRENT_METER_ADC_PIN PA2
184 #define SONAR
185 #define SONAR_TRIGGER_PIN Pin_0 // RC_CH7 (PB0) - only 3.3v ( add a 1K Ohms resistor )
186 #define SONAR_TRIGGER_GPIO GPIOB
187 #define SONAR_ECHO_PIN Pin_1 // RC_CH8 (PB1) - only 3.3v ( add a 1K Ohms resistor )
188 #define SONAR_ECHO_GPIO GPIOB
189 #define SONAR_EXTI_LINE EXTI_Line1
190 #define SONAR_EXTI_PIN_SOURCE EXTI_PinSource1
191 #define SONAR_EXTI_IRQN EXTI1_IRQn
193 #define LED_STRIP
194 #define LED_STRIP_TIMER TIM1
196 #define USE_LED_STRIP_ON_DMA1_CHANNEL2
197 #define WS2811_GPIO GPIOA
198 #define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOA
199 #define WS2811_GPIO_AF GPIO_AF_6
200 #define WS2811_PIN GPIO_Pin_8
201 #define WS2811_PIN_SOURCE GPIO_PinSource8
202 #define WS2811_TIMER TIM1
203 #define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM1
204 #define WS2811_DMA_CHANNEL DMA1_Channel2
205 #define WS2811_IRQ DMA1_Channel2_IRQn
206 #define WS2811_DMA_TC_FLAG DMA1_FLAG_TC2
207 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH2_HANDLER
209 #define NAV
210 #define NAV_AUTO_MAG_DECLINATION
211 #define NAV_GPS_GLITCH_DETECTION
213 #define DEFAULT_RX_FEATURE FEATURE_RX_PPM
214 #define DEFAULT_FEATURES FEATURE_BLACKBOX
216 #define SPEKTRUM_BIND
217 // USART3,
218 #define BIND_PORT GPIOB
219 #define BIND_PIN Pin_11
221 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
223 // IO - stm32f303cc in 48pin package
224 #define TARGET_IO_PORTA 0xffff
225 #define TARGET_IO_PORTB 0xffff
226 #define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15))
227 #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(3)|BIT(4))
229 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(16) |TIM_N(17))
231 #define TIMER_APB1_PERIPHERALS (RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM4)
232 #define TIMER_APB2_PERIPHERALS (RCC_APB2Periph_TIM1 | RCC_APB2Periph_TIM16 | RCC_APB2Periph_TIM17)
233 #define TIMER_AHB_PERIPHERALS (RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB)