Create release.yml
[betaflight.git] / src / main / target / SPRACINGF3MINI / target.h
blob28490e0624c59a20a6c54d5ab15fd15877f33cb7
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 #define LED0_PIN PB3
36 #endif
38 #define USE_BEEPER
39 #define BEEPER_PIN PC15
40 #define BEEPER_INVERTED
42 #define USE_EXTI
43 #define USE_GYRO_EXTI
44 #define GYRO_1_EXTI_PIN PC13
45 #define USE_MPU_DATA_READY_SIGNAL
46 #define ENSURE_MPU_DATA_READY_IS_LOW
48 #define USE_GYRO
49 #define USE_ACC
51 #ifdef TINYBEEF3
53 #define USE_GYRO_SPI_MPU6500
54 #define GYRO_1_ALIGN CW270_DEG
56 #define USE_ACC_SPI_MPU6500
57 #else
59 #define USE_MAG_DATA_READY_SIGNAL
60 #define ENSURE_MAG_DATA_READY_IS_HIGH
62 #define USE_GYRO_MPU6500
63 #define GYRO_1_ALIGN CW180_DEG
65 #define USE_ACC_MPU6500
67 #define USE_BARO
68 #define USE_BARO_BMP280
70 #define USE_MAG
71 #define USE_MPU9250_MAG // Enables bypass configuration
72 #define USE_MAG_AK8975
73 #define USE_MAG_HMC5883 // External
74 #define USE_MAG_QMC5883
75 #define MAG_AK8975_ALIGN CW90_DEG_FLIP
76 #endif
78 //#define USE_RANGEFINDER
79 //#define USE_RANGEFINDER_HCSR04
80 //#define RANGEFINDER_HCSR04_ECHO_PIN PB1
81 //#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0
83 #define USE_VCP
84 #define USE_UART2
86 #ifdef TINYBEEF3
87 #define SERIAL_PORT_COUNT 2
88 #else
89 #define USE_UART1
90 #define USE_UART3
92 #define USB_DETECT_PIN PB5
94 #define USE_SOFTSERIAL1
95 #define USE_SOFTSERIAL2
96 #define SERIAL_PORT_COUNT 6
97 #endif
99 #define USE_ESCSERIAL
100 #ifdef TINYBEEF3
101 #define ESCSERIAL_TIMER_TX_PIN PA15 // (Hardware=0)
102 #else
103 #if defined(SPRACINGF3MINI_REV) && (SPRACINGF3MINI_REV <= 1)
104 #define ESCSERIAL_TIMER_TX_PIN PB5 // (Hardware=0)
105 #else
106 #define ESCSERIAL_TIMER_TX_PIN PB4 // (Hardware=0)
107 #endif
108 #endif
110 #define UART1_TX_PIN PA9
111 #define UART1_RX_PIN PA10
113 #define UART2_TX_PIN PA14 // PA14 / SWCLK
114 #define UART2_RX_PIN PA15
116 #define UART3_TX_PIN PB10 // PB10 (AF7)
117 #define UART3_RX_PIN PB11 // PB11 (AF7)
119 #ifndef TINYBEEF3
120 #define SOFTSERIAL1_RX_PIN PA0 // PA0 / PAD3
121 #define SOFTSERIAL1_TX_PIN PA1 // PA1 / PAD4
122 #endif
124 #define USE_SPI
126 #ifdef TINYBEEF3
127 #define USE_SPI_DEVICE_1 // PB9,3,4,5 on AF5 SPI1 (MPU)
129 #define SPI1_NSS_PIN PB9
130 #define SPI1_SCK_PIN PB3
131 #define SPI1_MISO_PIN PB4
132 #define SPI1_MOSI_PIN PB5
134 #define GYRO_1_CS_PIN SPI1_NSS_PIN
135 #define GYRO_1_SPI_INSTANCE SPI1
136 #else
137 #define USE_I2C
138 #define USE_I2C_DEVICE_1
139 #define I2C_DEVICE (I2CDEV_1)
141 #define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5
143 #define SPI2_NSS_PIN PB12
144 #define SPI2_SCK_PIN PB13
145 #define SPI2_MISO_PIN PB14
146 #define SPI2_MOSI_PIN PB15
148 #define USE_SDCARD
149 #define USE_SDCARD_SPI
150 #define SDCARD_DETECT_INVERTED
151 #define SDCARD_DETECT_PIN PC14
152 #define SDCARD_SPI_INSTANCE SPI2
153 #define SDCARD_SPI_CS_PIN SPI2_NSS_PIN
155 // Note, this is the same DMA channel as UART1_RX. Luckily we don't use DMA for USART Rx.
156 #define SDCARD_DMA_CHANNEL_TX DMA1_Channel5
158 // Performance logging for SD card operations:
159 // #define AFATFS_USE_INTROSPECTIVE_LOGGING
161 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
162 #endif
164 #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
165 #define USE_ADC
166 #define ADC_INSTANCE ADC2
167 #define VBAT_ADC_PIN PA4
168 #define CURRENT_METER_ADC_PIN PA5
169 #define RSSI_ADC_PIN PB2
171 #define USE_TRANSPONDER
173 #define REDUCE_TRANSPONDER_CURRENT_DRAW_WHEN_USB_CABLE_PRESENT
175 #define DEFAULT_RX_FEATURE FEATURE_RX_PPM
177 #ifndef TINYBEEF3
179 #define USE_BUTTONS
180 #define BUTTON_A_PIN PB1
181 #define BUTTON_B_PIN PB0
183 #define BINDPLUG_PIN BUTTON_B_PIN
184 #endif
186 #define TARGET_IO_PORTA 0xffff
187 #define TARGET_IO_PORTB 0xffff
188 #define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15))
189 #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4))
191 #define USABLE_TIMER_CHANNEL_COUNT 12 // 8 Outputs; PPM; LED Strip; 2 additional PWM pins also on UART3 RX/TX pins.
192 #ifdef TINYBEEF3
193 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(8) | TIM_N(15))
194 #else
195 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(15) | TIM_N(16) |TIM_N(17))
196 #endif