Fix KISSCC orientation // Remove unsupported softserial
[betaflight.git] / src / main / target / SPRACINGF3 / target.h
blob644e81e7aa5f2f405425750f2a2d1404ef1cdaf4
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 #if defined(RMDO)
21 #define TARGET_BOARD_IDENTIFIER "RMDO"
22 #elif defined(ZCOREF3)
23 #define TARGET_BOARD_IDENTIFIER "ZCF3"
24 #elif defined(FLIP32F3OSD)
25 #define TARGET_BOARD_IDENTIFIER "FLF3"
26 #else
27 #define TARGET_BOARD_IDENTIFIER "SRF3"
28 #endif
30 #if defined(ZCOREF3)
31 #define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT
33 #define LED0 PB8
34 #else
35 #define CONFIG_FASTLOOP_PREFERRED_ACC ACC_NONE
37 #define LED0 PB3
38 #endif
40 #if defined(ZCOREF3)
41 #define EXTI15_10_CALLBACK_HANDLER_COUNT 1
42 #elif defined(FLIP32F3OSD)
43 #define EXTI_CALLBACK_HANDLER_COUNT 2 // MPU data ready and MAG data ready
44 #endif
46 #define BEEPER PC15
47 #define BEEPER_INVERTED
49 #define USE_EXTI
50 #define MPU_INT_EXTI PC13
51 #define USE_MPU_DATA_READY_SIGNAL
52 #define ENSURE_MPU_DATA_READY_IS_LOW
54 #define GYRO
56 #define ACC
58 #define BARO
59 #define USE_BARO_BMP280
61 #if defined(FLIP32F3OSD)
62 #define USE_GYRO_MPU6500
63 #define GYRO_MPU6500_ALIGN CW270_DEG
65 #define USE_ACC_MPU6500
66 #define ACC_MPU6500_ALIGN CW270_DEG
68 #elif defined(ZCOREF3)
69 #define GYRO
70 #define USE_GYRO_MPU6500
71 #define USE_GYRO_SPI_MPU6500
72 #define GYRO_MPU6500_ALIGN CW180_DEG
74 #define ACC
75 #define USE_ACC_MPU6500
76 #define USE_ACC_SPI_MPU6500
77 #define ACC_MPU6500_ALIGN CW180_DEG
79 #define USE_SPI_DEVICE_1 // PB9,3,4,5 on AF5 SPI1 (MPU)
81 #define SPI1_NSS_PIN PB9
82 #define SPI1_SCK_PIN PB3
83 #define SPI1_MISO_PIN PB4
84 #define SPI1_MOSI_PIN PB5
86 #define MPU6500_CS_PIN PB9
87 #define MPU6500_SPI_INSTANCE SPI1
89 #else
90 #define USE_GYRO_MPU6050
91 #define GYRO_MPU6050_ALIGN CW270_DEG
93 #define USE_ACC_MPU6050
94 #define ACC_MPU6050_ALIGN CW270_DEG
95 #endif
97 #if defined(FLIP32F3OSD)
98 #define SONAR
99 #define SONAR_TRIGGER_PIN PB0
100 #define SONAR_ECHO_PIN PB1
102 #elif defined(RMDO)
103 #undef USE_GPS
105 #elif defined(ZCOREF3)
106 #define USE_MAG_DATA_READY_SIGNAL
107 #define ENSURE_MAG_DATA_READY_IS_HIGH
109 #else //SPRACINGF3
110 #define USE_BARO_MS5611
111 #define USE_BARO_BMP085
113 #define MAG
114 #define USE_MAG_AK8975
115 #define USE_MAG_HMC5883
116 #define MAG_HMC5883_ALIGN CW270_DEG
118 #define USE_MAG_DATA_READY_SIGNAL
119 #define ENSURE_MAG_DATA_READY_IS_HIGH
120 #define MAG_INT_EXTI PC14
121 #endif
123 #define USE_FLASHFS
124 #define USE_FLASH_M25P16
126 #define USE_UART1
127 #define USE_UART2
128 #define USE_UART3
130 #if defined(ZCOREF3)
131 #define SERIAL_PORT_COUNT 3
133 #else
134 #define USE_SOFTSERIAL1
135 #define USE_SOFTSERIAL2
136 #define SERIAL_PORT_COUNT 5
138 #define SOFTSERIAL_1_TIMER TIM3
139 #define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5
140 #define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
141 #define SOFTSERIAL_2_TIMER TIM3
142 #define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7
143 #define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8
144 #define SONAR_SOFTSERIAL2_EXCLUSIVE
145 #endif
147 #define USE_ESCSERIAL
148 #define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1
150 #define UART1_TX_PIN PA9
151 #define UART1_RX_PIN PA10
153 #define UART2_TX_PIN PA14 // PA14 / SWCLK
154 #define UART2_RX_PIN PA15
156 #define UART3_TX_PIN PB10 // PB10 (AF7)
157 #define UART3_RX_PIN PB11 // PB11 (AF7)
159 #define USE_I2C
160 #define I2C_DEVICE (I2CDEV_1) // PB6/SCL, PB7/SDA
162 #define USE_SPI
163 #define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5
165 #define M25P16_CS_PIN PB12
166 #define M25P16_SPI_INSTANCE SPI2
168 #define BOARD_HAS_VOLTAGE_DIVIDER
169 #define USE_ADC
170 #define ADC_INSTANCE ADC2
171 #define VBAT_ADC_PIN PA4
172 #define CURRENT_METER_ADC_PIN PA5
173 #define RSSI_ADC_PIN PB2
175 #define USE_ESC_SENSOR
176 #define REMAP_TIM17_DMA
178 // UART1 TX uses DMA1_Channel4, which is also used by dshot on motor 4
179 #if defined(USE_UART1_TX_DMA) && defined(USE_DSHOT)
180 #undef USE_UART1_TX_DMA
181 #endif
183 #define LED_STRIP
185 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
187 #define DEFAULT_RX_FEATURE FEATURE_RX_PPM
188 #define DEFAULT_FEATURES (FEATURE_TRANSPONDER | FEATURE_BLACKBOX | FEATURE_RSSI_ADC | FEATURE_CURRENT_METER | FEATURE_TELEMETRY)
190 #define SPEKTRUM_BIND
191 // USART3,
192 #define BIND_PIN PB11
194 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
196 // IO - stm32f303cc in 48pin package
197 #define TARGET_IO_PORTA 0xffff
198 #define TARGET_IO_PORTB 0xffff
199 #define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15))
200 #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(3)|BIT(4))
202 #define USABLE_TIMER_CHANNEL_COUNT 17
203 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(15) | TIM_N(16) | TIM_N(17) )