Removed feature SDCARD and BLACKBOX
[betaflight.git] / src / main / target / SPRACINGF3MINI / target.h
blobea3cd18c6d4e4148d41ffcf605e2f2591dcf88a0
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 #ifdef TINYBEEF3
21 #define TARGET_BOARD_IDENTIFIER "TBF3"
23 #define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT
25 #define LED0 PB8
26 #else
27 #define TARGET_BOARD_IDENTIFIER "SRFM"
29 #define CONFIG_FASTLOOP_PREFERRED_ACC ACC_NONE
31 #define LED0 PB3
32 #endif
34 #define BEEPER PC15
35 #define BEEPER_INVERTED
37 #define USE_EXTI
38 #define MPU_INT_EXTI PC13
39 #define USE_MPU_DATA_READY_SIGNAL
40 #define ENSURE_MPU_DATA_READY_IS_LOW
42 #define GYRO
43 #define ACC
45 #ifdef TINYBEEF3
46 #define EXTI15_10_CALLBACK_HANDLER_COUNT 1 // MPU_INT
48 #define USE_GYRO_SPI_MPU6500
49 #define GYRO_MPU6500_ALIGN CW270_DEG
51 #define USE_ACC_SPI_MPU6500
52 #define ACC_MPU6500_ALIGN CW270_DEG
53 #else
54 #define EXTI15_10_CALLBACK_HANDLER_COUNT 2 // MPU_INT, SDCardDetect
56 #define USE_MAG_DATA_READY_SIGNAL
57 #define ENSURE_MAG_DATA_READY_IS_HIGH
59 #define USE_GYRO_MPU6500
60 #define GYRO_MPU6500_ALIGN CW180_DEG
62 #define USE_ACC_MPU6500
63 #define ACC_MPU6500_ALIGN CW180_DEG
65 #define BARO
66 #define USE_BARO_BMP280
68 #define MAG
69 #define USE_MPU9250_MAG // Enables bypass configuration
70 #define USE_MAG_AK8975
71 #define USE_MAG_HMC5883 // External
72 #define MAG_AK8975_ALIGN CW90_DEG_FLIP
73 #endif
75 //#define SONAR
76 //#define SONAR_ECHO_PIN PB1
77 //#define SONAR_TRIGGER_PIN PB0
79 #define BRUSHED_ESC_AUTODETECT
81 #define USE_VCP
82 #define USE_UART1
83 #define USE_UART2
84 #define USE_UART3
86 #ifdef TINYBEEF3
87 #define SERIAL_PORT_COUNT 4
88 #else
89 #define USB_DETECT_PIN PB5
91 #define USE_SOFTSERIAL1
92 #define USE_SOFTSERIAL2
93 #define SERIAL_PORT_COUNT 6
94 #endif
96 #define USE_ESCSERIAL
97 #define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1
99 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
101 #define UART1_TX_PIN PA9
102 #define UART1_RX_PIN PA10
104 #define UART2_TX_PIN PA14 // PA14 / SWCLK
105 #define UART2_RX_PIN PA15
107 #define UART3_TX_PIN PB10 // PB10 (AF7)
108 #define UART3_RX_PIN PB11 // PB11 (AF7)
110 #ifndef TINYBEEF3
111 #define SOFTSERIAL1_RX_PIN PA0 // PA0 / PAD3
112 #define SOFTSERIAL1_TX_PIN PA1 // PA1 / PAD4
113 #endif
115 #define SONAR_SOFTSERIAL1_EXCLUSIVE
117 #define USE_SPI
119 #ifdef TINYBEEF3
120 #define USE_SPI_DEVICE_1 // PB9,3,4,5 on AF5 SPI1 (MPU)
122 #define SPI1_NSS_PIN PB9
123 #define SPI1_SCK_PIN PB3
124 #define SPI1_MISO_PIN PB4
125 #define SPI1_MOSI_PIN PB5
127 #define MPU6500_CS_PIN SPI1_NSS_PIN
128 #define MPU6500_SPI_INSTANCE SPI1
129 #else
130 #define USE_I2C
131 #define USE_I2C_DEVICE_1
132 #define I2C_DEVICE (I2CDEV_1)
134 #define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5
136 #define SPI2_NSS_PIN PB12
137 #define SPI2_SCK_PIN PB13
138 #define SPI2_MISO_PIN PB14
139 #define SPI2_MOSI_PIN PB15
141 #define USE_SDCARD
142 #define USE_SDCARD_SPI2
144 #define SDCARD_DETECT_INVERTED
146 #define SDCARD_DETECT_PIN PC14
147 #define SDCARD_SPI_INSTANCE SPI2
148 #define SDCARD_SPI_CS_PIN SPI2_NSS_PIN
150 // SPI2 is on the APB1 bus whose clock runs at 36MHz. Divide to under 400kHz for init:
151 #define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 128
152 // Divide to under 25MHz for normal operation:
153 #define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 2
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
157 #define SDCARD_DMA_CHANNEL_TX_COMPLETE_FLAG DMA1_FLAG_TC5
159 // Performance logging for SD card operations:
160 // #define AFATFS_USE_INTROSPECTIVE_LOGGING
162 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
163 #endif
165 #define BOARD_HAS_VOLTAGE_DIVIDER
166 #define USE_ADC
167 #define ADC_INSTANCE ADC2
168 #define VBAT_ADC_PIN PA4
169 #define CURRENT_METER_ADC_PIN PA5
170 #define RSSI_ADC_PIN PB2
172 #define TRANSPONDER
174 #define REDUCE_TRANSPONDER_CURRENT_DRAW_WHEN_USB_CABLE_PRESENT
176 #define DEFAULT_RX_FEATURE FEATURE_RX_PPM
178 #ifndef TINYBEEF3
180 #define BUTTONS
181 #define BUTTON_A_PIN PB1
182 #define BUTTON_B_PIN PB0
184 #define BINDPLUG_PIN BUTTON_B_PIN
185 #endif
187 #define SPEKTRUM_BIND_PIN UART2_RX_PIN
189 #define TARGET_IO_PORTA 0xffff
190 #define TARGET_IO_PORTB 0xffff
191 #define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15))
192 #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4))
194 #define USABLE_TIMER_CHANNEL_COUNT 12 // 8 Outputs; PPM; LED Strip; 2 additional PWM pins also on UART3 RX/TX pins.
195 #ifdef TINYBEEF3
196 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(8) | TIM_N(15))
197 #else
198 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(15) | TIM_N(16) |TIM_N(17))
199 #endif