Fixed conditionals for 4 way ESC boot loader.
[betaflight.git] / src / main / target / SPRACINGF3MINI / target.h
blob195fa613b6ff2c6d78faee0c1c4d7a69dd9bf827
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 #ifdef TINYBEEF3
24 #define TARGET_BOARD_IDENTIFIER "TBF3"
27 #define LED0_PIN PB8
28 #else
29 #define TARGET_BOARD_IDENTIFIER "SRFM"
31 #ifndef SPRACINGF3MINI_REV
32 #define SPRACINGF3MINI_REV 2
33 #endif
35 // Removed to make the firmware fit into flash (in descending order of priority):
36 //#undef USE_GYRO_OVERFLOW_CHECK
37 //#undef USE_GYRO_LPF2
39 //#undef USE_ITERM_RELAX
40 //#undef USE_RC_SMOOTHING_FILTER
42 //#undef USE_MSP_DISPLAYPORT
43 //#undef USE_MSP_OVER_TELEMETRY
45 #undef USE_HUFFMAN
46 #undef USE_PINIO
47 #undef USE_PINIOBOX
49 #undef USE_TELEMETRY_HOTT
50 #undef USE_TELEMETRY_MAVLINK
51 #undef USE_TELEMETRY_LTM
52 #undef USE_SERIALRX_XBUS
53 #undef USE_SERIALRX_SUMH
54 #undef USE_PWM
56 #undef USE_BOARD_INFO
57 #undef USE_EXTENDED_CMS_MENUS
58 #undef USE_RTC_TIME
59 #undef USE_RX_MSP
60 #undef USE_ESC_SENSOR_INFO
62 #define LED0_PIN PB3
63 #endif
65 #define USE_BEEPER
66 #define BEEPER_PIN PC15
67 #define BEEPER_INVERTED
69 #define USE_EXTI
70 #define USE_GYRO_EXTI
71 #define GYRO_1_EXTI_PIN PC13
72 #define USE_MPU_DATA_READY_SIGNAL
73 #define ENSURE_MPU_DATA_READY_IS_LOW
75 #define USE_GYRO
76 #define USE_ACC
78 #ifdef TINYBEEF3
80 #define USE_GYRO_SPI_MPU6500
81 #define GYRO_1_ALIGN CW270_DEG
83 #define USE_ACC_SPI_MPU6500
84 #define ACC_1_ALIGN CW270_DEG
85 #else
87 #define USE_MAG_DATA_READY_SIGNAL
88 #define ENSURE_MAG_DATA_READY_IS_HIGH
90 #define USE_GYRO_MPU6500
91 #define GYRO_1_ALIGN CW180_DEG
93 #define USE_ACC_MPU6500
94 #define ACC_1_ALIGN CW180_DEG
96 #define USE_BARO
97 #define USE_BARO_BMP280
99 #define USE_MAG
100 #define USE_MPU9250_MAG // Enables bypass configuration
101 #define USE_MAG_AK8975
102 #define USE_MAG_HMC5883 // External
103 #define USE_MAG_QMC5883
104 #define MAG_AK8975_ALIGN CW90_DEG_FLIP
105 #endif
107 //#define USE_RANGEFINDER
108 //#define USE_RANGEFINDER_HCSR04
109 //#define RANGEFINDER_HCSR04_ECHO_PIN PB1
110 //#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0
112 #define USE_VCP
113 #define USE_UART2
115 #ifdef TINYBEEF3
116 #define SERIAL_PORT_COUNT 2
117 #else
118 #define USE_UART1
119 #define USE_UART3
121 #define USB_DETECT_PIN PB5
123 #define USE_SOFTSERIAL1
124 #define USE_SOFTSERIAL2
125 #define SERIAL_PORT_COUNT 6
126 #endif
128 #define USE_ESCSERIAL
129 #ifdef TINYBEEF3
130 #define ESCSERIAL_TIMER_TX_PIN PA15 // (Hardware=0)
131 #else
132 #if defined(SPRACINGF3MINI_REV) && (SPRACINGF3MINI_REV <= 1)
133 #define ESCSERIAL_TIMER_TX_PIN PB5 // (Hardware=0)
134 #else
135 #define ESCSERIAL_TIMER_TX_PIN PB4 // (Hardware=0)
136 #endif
137 #endif
139 #define UART1_TX_PIN PA9
140 #define UART1_RX_PIN PA10
142 #define UART2_TX_PIN PA14 // PA14 / SWCLK
143 #define UART2_RX_PIN PA15
145 #define UART3_TX_PIN PB10 // PB10 (AF7)
146 #define UART3_RX_PIN PB11 // PB11 (AF7)
148 #ifndef TINYBEEF3
149 #define SOFTSERIAL1_RX_PIN PA0 // PA0 / PAD3
150 #define SOFTSERIAL1_TX_PIN PA1 // PA1 / PAD4
151 #endif
153 #define RANGEFINDER_HCSR04_SOFTSERIAL1_EXCLUSIVE
155 #define USE_SPI
157 #ifdef TINYBEEF3
158 #define USE_SPI_DEVICE_1 // PB9,3,4,5 on AF5 SPI1 (MPU)
160 #define SPI1_NSS_PIN PB9
161 #define SPI1_SCK_PIN PB3
162 #define SPI1_MISO_PIN PB4
163 #define SPI1_MOSI_PIN PB5
165 #define GYRO_1_CS_PIN SPI1_NSS_PIN
166 #define GYRO_1_SPI_INSTANCE SPI1
167 #else
168 #define USE_I2C
169 #define USE_I2C_DEVICE_1
170 #define I2C_DEVICE (I2CDEV_1)
172 #define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5
174 #define SPI2_NSS_PIN PB12
175 #define SPI2_SCK_PIN PB13
176 #define SPI2_MISO_PIN PB14
177 #define SPI2_MOSI_PIN PB15
179 #define USE_SDCARD
180 #define USE_SDCARD_SPI
181 #define SDCARD_DETECT_INVERTED
182 #define SDCARD_DETECT_PIN PC14
183 #define SDCARD_SPI_INSTANCE SPI2
184 #define SDCARD_SPI_CS_PIN SPI2_NSS_PIN
186 // Note, this is the same DMA channel as UART1_RX. Luckily we don't use DMA for USART Rx.
187 #define SDCARD_DMA_CHANNEL_TX DMA1_Channel5
189 // Performance logging for SD card operations:
190 // #define AFATFS_USE_INTROSPECTIVE_LOGGING
192 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
193 #endif
195 #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
196 #define USE_ADC
197 #define ADC_INSTANCE ADC2
198 #define VBAT_ADC_PIN PA4
199 #define CURRENT_METER_ADC_PIN PA5
200 #define RSSI_ADC_PIN PB2
202 #define USE_TRANSPONDER
204 #define REDUCE_TRANSPONDER_CURRENT_DRAW_WHEN_USB_CABLE_PRESENT
206 #define DEFAULT_RX_FEATURE FEATURE_RX_PPM
208 #ifndef TINYBEEF3
210 #define USE_BUTTONS
211 #define BUTTON_A_PIN PB1
212 #define BUTTON_B_PIN PB0
214 #define BINDPLUG_PIN BUTTON_B_PIN
215 #endif
217 #define TARGET_IO_PORTA 0xffff
218 #define TARGET_IO_PORTB 0xffff
219 #define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15))
220 #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4))
222 #define USABLE_TIMER_CHANNEL_COUNT 12 // 8 Outputs; PPM; LED Strip; 2 additional PWM pins also on UART3 RX/TX pins.
223 #ifdef TINYBEEF3
224 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(8) | TIM_N(15))
225 #else
226 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(15) | TIM_N(16) |TIM_N(17))
227 #endif