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 "SBF4"
21 #define USBD_PRODUCT_STRING "SpeedyBeeF4"
26 #define BEEPER_INVERTED
28 #define SENSORS_SET (SENSOR_ACC | SENSOR_MAG | SENSOR_BARO)
31 #define USE_IMU_MPU6000
32 #define MPU6000_CS_PIN PB11
33 #define MPU6000_SPI_BUS BUS_SPI1
34 #define IMU_MPU6000_ALIGN CW0_DEG
38 #define USE_SPI_DEVICE_1
39 #define SPI1_SCK_PIN PA5
40 #define SPI1_MISO_PIN PA6
41 #define SPI1_MOSI_PIN PA7
43 #define USE_SPI_DEVICE_2
44 #define SPI2_NSS_PIN PB12
45 #define SPI2_SCK_PIN PB13
46 #define SPI2_MISO_PIN PB14
47 #define SPI2_MOSI_PIN PB15
49 #define USE_SPI_DEVICE_3
50 #define SPI3_SCK_PIN PB3
51 #define SPI3_MISO_PIN PB4
52 #define SPI3_MOSI_PIN PB5
54 #define I2C_DEVICE (I2CDEV_1)
55 #define UG2864_I2C_BUS BUS_I2C1
58 #define USE_I2C_DEVICE_1
62 /*** Onboard flash ***/
63 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
64 #define M25P16_CS_PIN PC0
65 #define M25P16_SPI_BUS BUS_SPI3
67 #define USE_FLASH_M25P16
71 #define MAX7456_SPI_BUS BUS_SPI2
72 #define MAX7456_CS_PIN PB10
74 /*** Serial ports ***/
76 #define VBUS_SENSING_PIN PB12
77 #define VBUS_SENSING_ENABLED
80 #define UART1_RX_PIN PA10
81 #define UART1_TX_PIN PA9
84 #define UART2_RX_PIN PA3
85 #define UART2_TX_PIN PA2
88 #define UART3_RX_PIN PC11
89 #define UART3_TX_PIN PC10
92 #define UART4_RX_PIN PA1
93 #define UART4_TX_PIN PA0
96 #define UART5_RX_PIN PD2
97 #define UART5_TX_PIN PC12
99 #if defined(SPEEDYBEEF4_SFTSRL1)
100 #define USE_SOFTSERIAL1
101 #define SOFTSERIAL_1_RX_PIN PA15 // S5
102 #define SOFTSERIAL_1_TX_PIN PB8 // S7
104 #define SERIAL_PORT_COUNT 7
106 #elif defined(SPEEDYBEEF4_SFTSRL2)
107 #define USE_SOFTSERIAL1
108 #define SOFTSERIAL_1_RX_PIN PA15 // S5
109 #define SOFTSERIAL_1_TX_PIN PB8 // S7
110 #define USE_SOFTSERIAL2
111 #define SOFTSERIAL_2_RX_PIN PA8 // S6
112 #define SOFTSERIAL_2_TX_PIN PA4 // DAC
114 #define SERIAL_PORT_COUNT 8
117 #define SERIAL_PORT_COUNT 6
122 #define BARO_I2C_BUS BUS_I2C1
123 #define USE_BARO_BMP085
124 #define USE_BARO_BMP280
125 #define USE_BARO_MS5611
128 #define MAG_I2C_BUS BUS_I2C1
133 #define ADC_CHANNEL_1_PIN PC1
134 #define ADC_CHANNEL_2_PIN PC2
135 #define ADC_CHANNEL_3_PIN PC3
137 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_1
138 #define VBAT_ADC_CHANNEL ADC_CHN_2
139 #define RSSI_ADC_CHANNEL ADC_CHN_3
143 /*** Default settings ***/
144 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_CURRENT_METER | FEATURE_BLACKBOX | FEATURE_VBAT | FEATURE_OSD)
145 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
146 #define SERIALRX_PROVIDER SERIALRX_SBUS
147 #define CURRENT_METER_SCALE 166
149 /*** Timer/PWM output ***/
150 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
151 #define MAX_PWM_OUTPUT_PORTS 7
153 #define USE_ESC_SENSOR
156 #define TARGET_IO_PORTA 0xffff
157 #define TARGET_IO_PORTB 0xffff
158 #define TARGET_IO_PORTC 0xffff
159 #define TARGET_IO_PORTD (BIT(2))
161 #define RANGEFINDER_I2C_BUS BUS_I2C1