Merge pull request #11198 from SteveCEvans/sce_rc2
[betaflight.git] / src / main / target / SPRACINGF3 / target.h
blobdef37862a0a8bf98f0fe58393e025022e8faea7b
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 #if defined(RMDO)
24 #define TARGET_BOARD_IDENTIFIER "RMDO"
25 #elif defined(ZCOREF3)
26 #define TARGET_BOARD_IDENTIFIER "ZCF3"
27 #elif defined(FLIP32F3OSD)
28 #define TARGET_BOARD_IDENTIFIER "FLF3"
29 #elif defined(IRCSYNERGYF3)
30 #define TARGET_BOARD_IDENTIFIER "ISF3"
31 #else
32 #define TARGET_BOARD_IDENTIFIER "SRF3"
33 #endif
35 #if defined(ZCOREF3)
37 #define LED0_PIN PB8
38 #else
40 #define LED0_PIN PB3
41 #endif
43 #if !defined(IRCSYNERGYF3)
44 #define USE_BEEPER
45 #define BEEPER_PIN PC15
46 #define BEEPER_INVERTED
47 #endif
49 #define USE_EXTI
50 #define USE_GYRO_EXTI
51 #define GYRO_1_EXTI_PIN PC13
52 #define USE_MPU_DATA_READY_SIGNAL
53 #define ENSURE_MPU_DATA_READY_IS_LOW
55 #define USE_GYRO
57 #define USE_ACC
59 #define USE_BARO
60 #define USE_BARO_BMP280
62 #if defined(FLIP32F3OSD)
63 #define USE_GYRO_MPU6500
64 #define GYRO_1_ALIGN CW270_DEG
66 #define USE_ACC_MPU6500
68 #elif defined(ZCOREF3)
69 #define USE_GYRO_MPU6500
70 #define USE_GYRO_SPI_MPU6500
71 #define GYRO_1_ALIGN CW180_DEG
73 #define USE_ACC_MPU6500
74 #define USE_ACC_SPI_MPU6500
76 #define USE_SPI_DEVICE_1 // PB9,3,4,5 on AF5 SPI1 (MPU)
78 #define SPI1_NSS_PIN PB9
79 #define SPI1_SCK_PIN PB3
80 #define SPI1_MISO_PIN PB4
81 #define SPI1_MOSI_PIN PB5
83 #define GYRO_1_CS_PIN PB9
84 #define GYRO_1_SPI_INSTANCE SPI1
86 #elif defined(IRCSYNERGYF3)
87 #define USE_GYRO_SPI_MPU6000
88 #define GYRO_1_ALIGN CW270_DEG
90 #define USE_ACC_SPI_MPU6000
92 #define GYRO_1_CS_PIN PB12
93 #define GYRO_1_SPI_INSTANCE SPI2
94 #else
95 #define USE_GYRO_MPU6050
96 #define GYRO_1_ALIGN CW270_DEG
98 #define USE_ACC_MPU6050
99 #endif
101 #if defined(FLIP32F3OSD)
102 #define USE_RANGEFINDER
103 #define USE_RANGEFINDER_HCSR04
104 #define RANGEFINDER_HCSR04_TRIGGER_PIN PB0
105 #define RANGEFINDER_HCSR04_ECHO_PIN PB1
107 #elif defined(ZCOREF3)
108 #define USE_MAG_DATA_READY_SIGNAL
109 #define ENSURE_MAG_DATA_READY_IS_HIGH
111 #else //SPRACINGF3
113 #define USE_RANGEFINDER
114 #define USE_RANGEFINDER_HCSR04
115 #define RANGEFINDER_HCSR04_TRIGGER_PIN PB0
116 #define RANGEFINDER_HCSR04_ECHO_PIN PB1
118 #define USE_BARO_MS5611
119 #define USE_BARO_BMP085
121 #define USE_MAG
122 #define USE_MAG_AK8975
123 #define USE_MAG_HMC5883
124 #define USE_MAG_QMC5883
125 #define MAG_HMC5883_ALIGN CW270_DEG
127 #define USE_MAG_DATA_READY_SIGNAL
128 #define ENSURE_MAG_DATA_READY_IS_HIGH
129 #define MAG_INT_EXTI PC14
130 #endif
132 #if !defined(IRCSYNERGYF3)
133 #define USE_FLASHFS
134 #define USE_FLASH_M25P16
135 #endif
137 #define USE_UART1
138 #define USE_UART2
139 #define USE_UART3
140 #define USE_SOFTSERIAL1
141 #define USE_SOFTSERIAL2
143 #define SERIAL_PORT_COUNT 5
145 #if !defined(ZCOREF3)
146 #define SOFTSERIAL1_RX_PIN PB4 // PWM 5
147 #define SOFTSERIAL1_TX_PIN PB5 // PWM 6
149 #define SOFTSERIAL2_RX_PIN PB0 // PWM 7
150 #define SOFTSERIAL2_TX_PIN PB1 // PWM 8
151 #endif
153 #define USE_ESCSERIAL
154 #define ESCSERIAL_TIMER_TX_PIN PA0 // (HARDARE=0,PPM)
156 #define UART1_TX_PIN PA9
157 #define UART1_RX_PIN PA10
159 #define UART2_TX_PIN PA14 // PA14 / SWCLK
160 #define UART2_RX_PIN PA15
162 #define UART3_TX_PIN PB10 // PB10 (AF7)
163 #define UART3_RX_PIN PB11 // PB11 (AF7)
165 #define USE_I2C
166 #define USE_I2C_DEVICE_1
167 #define I2C_DEVICE (I2CDEV_1)
169 #define USE_SPI
170 #define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5
172 #if !defined(IRCSYNERGYF3)
173 #define FLASH_CS_PIN PB12
174 #define FLASH_SPI_INSTANCE SPI2
176 #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
177 #define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
178 #define USE_ADC
179 #define ADC_INSTANCE ADC2
180 #define VBAT_ADC_PIN PA4
181 #define CURRENT_METER_ADC_PIN PA5
182 #define RSSI_ADC_PIN PB2
184 #define USE_OSD
185 #define USE_OSD_OVER_MSP_DISPLAYPORT
186 #define USE_SLOW_MSP_DISPLAYPORT_RATE_WHEN_UNARMED
187 #endif
189 #define USE_MSP_CURRENT_METER
191 #define REMAP_TIM17_DMA
193 // UART1 TX uses DMA1_Channel4, which is also used by dshot on motor 4
194 #if defined(USE_UART1_TX_DMA) && defined(USE_DSHOT)
195 #undef USE_UART1_TX_DMA
196 #endif
198 #if !defined(IRCSYNERGYF3)
199 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
201 #define DEFAULT_RX_FEATURE FEATURE_RX_PPM
202 #define DEFAULT_FEATURES (FEATURE_RSSI_ADC | FEATURE_TELEMETRY)
203 #endif
205 // IO - stm32f303cc in 48pin package
206 #define TARGET_IO_PORTA 0xffff
207 #define TARGET_IO_PORTB 0xffff
208 #define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15))
209 #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(3)|BIT(4))
211 #define USABLE_TIMER_CHANNEL_COUNT 17
212 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(15) | TIM_N(16) | TIM_N(17) )