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/>.
20 #define TARGET_BOARD_IDENTIFIER "SRFM"
22 #define CONFIG_FASTLOOP_PREFERRED_ACC ACC_NONE
24 // early prototype had slightly different pin mappings.
25 //#define SPRACINGF3MINI_MKII_REVA
30 #define BEEPER_INVERTED
32 #define USABLE_TIMER_CHANNEL_COUNT 12 // 8 Outputs; PPM; LED Strip; 2 additional PWM pins also on UART3 RX/TX pins.
34 #define EXTI15_10_CALLBACK_HANDLER_COUNT 2 // MPU_INT, SDCardDetect
37 #define MPU_INT_EXTI PC13
38 #define USE_MPU_DATA_READY_SIGNAL
39 #define ENSURE_MPU_DATA_READY_IS_LOW
41 #define USE_MAG_DATA_READY_SIGNAL
42 #define ENSURE_MAG_DATA_READY_IS_HIGH
46 //#define USE_FAKE_GYRO
47 #define USE_GYRO_MPU6500
50 //#define USE_FAKE_ACC
51 #define USE_ACC_MPU6500
53 #define ACC_MPU6500_ALIGN CW180_DEG
54 #define GYRO_MPU6500_ALIGN CW180_DEG
57 #define USE_BARO_BMP280
60 #define USE_MPU9250_MAG // Enables bypass configuration
61 #define USE_MAG_AK8975
62 #define USE_MAG_HMC5883 // External
64 #define MAG_AK8975_ALIGN CW90_DEG_FLIP
67 #define SONAR_ECHO_PIN PB1
68 #define SONAR_TRIGGER_PIN PB0
71 #define USB_CABLE_DETECTION
73 #define USB_DETECT_PIN PB5
79 #define USE_SOFTSERIAL1
80 #define SERIAL_PORT_COUNT 5
83 #define UART1_TX_PIN GPIO_Pin_9 // PA9
84 #define UART1_RX_PIN GPIO_Pin_10 // PA10
85 #define UART1_GPIO GPIOA
86 #define UART1_GPIO_AF GPIO_AF_7
87 #define UART1_TX_PINSOURCE GPIO_PinSource9
88 #define UART1_RX_PINSOURCE GPIO_PinSource10
91 #define UART2_TX_PIN GPIO_Pin_14 // PA14 / SWCLK
92 #define UART2_RX_PIN GPIO_Pin_15 // PA15
93 #define UART2_GPIO GPIOA
94 #define UART2_GPIO_AF GPIO_AF_7
95 #define UART2_TX_PINSOURCE GPIO_PinSource14
96 #define UART2_RX_PINSOURCE GPIO_PinSource15
99 #define UART3_TX_PIN GPIO_Pin_10 // PB10 (AF7)
100 #define UART3_RX_PIN GPIO_Pin_11 // PB11 (AF7)
101 #define UART3_GPIO_AF GPIO_AF_7
102 #define UART3_GPIO GPIOB
103 #define UART3_TX_PINSOURCE GPIO_PinSource10
104 #define UART3_RX_PINSOURCE GPIO_PinSource11
107 #define SOFTSERIAL_1_TIMER TIM2
108 #define SOFTSERIAL_1_TIMER_RX_HARDWARE 9 // PA0 / PAD3
109 #define SOFTSERIAL_1_TIMER_TX_HARDWARE 10 // PA1 / PAD4
112 #define I2C_DEVICE (I2CDEV_1) // PB6/SCL, PB7/SDA
115 #define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5
117 #define SPI2_NSS_PIN PB12
118 #define SPI2_SCK_PIN PB13
119 #define SPI2_MISO_PIN PB14
120 #define SPI2_MOSI_PIN PB15
123 #define USE_SDCARD_SPI2
125 #define SDCARD_DETECT_INVERTED
127 #define SDCARD_DETECT_PIN PC14
128 #define SDCARD_SPI_INSTANCE SPI2
129 #define SDCARD_SPI_CS_PIN SPI2_NSS_PIN
131 // SPI2 is on the APB1 bus whose clock runs at 36MHz. Divide to under 400kHz for init:
132 #define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 128
133 // Divide to under 25MHz for normal operation:
134 #define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 2
136 // Note, this is the same DMA channel as USART1_RX. Luckily we don't use DMA for USART Rx.
137 #define SDCARD_DMA_CHANNEL_TX DMA1_Channel5
138 #define SDCARD_DMA_CHANNEL_TX_COMPLETE_FLAG DMA1_FLAG_TC5
140 // Performance logging for SD card operations:
141 // #define AFATFS_USE_INTROSPECTIVE_LOGGING
144 #define BOARD_HAS_VOLTAGE_DIVIDER
147 #define ADC_INSTANCE ADC2
148 #define ADC_DMA_CHANNEL DMA2_Channel1
149 #define ADC_AHB_PERIPHERAL RCC_AHBPeriph_DMA2
151 #define VBAT_ADC_GPIO GPIOA
152 #define VBAT_ADC_GPIO_PIN GPIO_Pin_4
153 #define VBAT_ADC_CHANNEL ADC_Channel_1
155 #define CURRENT_METER_ADC_GPIO GPIOA
156 #define CURRENT_METER_ADC_GPIO_PIN GPIO_Pin_5
157 #define CURRENT_METER_ADC_CHANNEL ADC_Channel_2
159 #define RSSI_ADC_GPIO GPIOB
160 #define RSSI_ADC_GPIO_PIN GPIO_Pin_2
161 #define RSSI_ADC_CHANNEL ADC_Channel_12
164 #define LED_STRIP_TIMER TIM1
166 #define WS2811_GPIO GPIOA
167 #define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOA
168 #define WS2811_GPIO_AF GPIO_AF_6
169 #define WS2811_PIN GPIO_Pin_8
170 #define WS2811_PIN_SOURCE GPIO_PinSource8
171 #define WS2811_TIMER TIM1
172 #define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM1
173 #define WS2811_DMA_CHANNEL DMA1_Channel2
174 #define WS2811_IRQ DMA1_Channel2_IRQn
175 #define WS2811_DMA_TC_FLAG DMA1_FLAG_TC2
176 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH2_HANDLER
180 #define TRANSPONDER_GPIO GPIOA
181 #define TRANSPONDER_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOA
182 #define TRANSPONDER_GPIO_AF GPIO_AF_6
183 #define TRANSPONDER_PIN GPIO_Pin_8
184 #define TRANSPONDER_PIN_SOURCE GPIO_PinSource8
185 #define TRANSPONDER_TIMER TIM1
186 #define TRANSPONDER_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM1
187 #define TRANSPONDER_DMA_CHANNEL DMA1_Channel2
188 #define TRANSPONDER_IRQ DMA1_Channel2_IRQn
189 #define TRANSPONDER_DMA_TC_FLAG DMA1_FLAG_TC2
190 #define TRANSPONDER_DMA_HANDLER_IDENTIFER DMA1_CH2_HANDLER
192 #define REDUCE_TRANSPONDER_CURRENT_DRAW_WHEN_USB_CABLE_PRESENT
194 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
195 #define DEFAULT_RX_FEATURE FEATURE_RX_PPM
198 #define BUTTON_A_PORT GPIOB
199 #define BUTTON_A_PIN Pin_1
200 #define BUTTON_B_PORT GPIOB
201 #define BUTTON_B_PIN Pin_0
203 #define SPEKTRUM_BIND
205 #define BIND_PIN PB11
207 #define HARDWARE_BIND_PLUG
208 #define BINDPLUG_PIN PB0
210 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
212 #define TARGET_IO_PORTA 0xffff
213 #define TARGET_IO_PORTB 0xffff
214 #define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15))
215 #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4))
217 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(15) | TIM_N(16) |TIM_N(17))