2 * This file is part of INAV.
4 * INAV 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 * INAV 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 INAV. If not, see <http://www.gnu.org/licenses/>.
20 #define TARGET_BOARD_IDENTIFIER "MF4S"
21 #define USBD_PRODUCT_STRING "Matek_F405SE"
23 // ******** Board LEDs **********************
24 #define LED0 PA14 //Blue
25 #define LED1 PA13 //Green
27 // ******* Beeper ***********
29 #define BEEPER_INVERTED
31 // *************** SPI1 Gyro & ACC *******************
33 #define USE_SPI_DEVICE_1
35 #define SPI1_SCK_PIN PA5
36 #define SPI1_MISO_PIN PA6
37 #define SPI1_MOSI_PIN PA7
40 #define USE_IMU_MPU6000
41 #define IMU_MPU6000_ALIGN CW270_DEG
42 #define MPU6000_CS_PIN PA4
43 #define MPU6000_SPI_BUS BUS_SPI1
46 #define USE_IMU_ICM42605
47 #define IMU_ICM42605_ALIGN CW0_DEG_FLIP
48 #define ICM42605_CS_PIN PA4
49 #define ICM42605_SPI_BUS BUS_SPI1
51 // *************** I2C /Baro/Mag *********************
53 #define USE_I2C_DEVICE_1
57 #define USE_I2C_DEVICE_2
62 #define BARO_I2C_BUS BUS_I2C1
63 #define USE_BARO_BMP280
64 #define USE_BARO_MS5611
65 #define USE_BARO_BMP085
66 #define USE_BARO_DPS310
67 #define USE_BARO_SPL06
70 #define MAG_I2C_BUS BUS_I2C2
73 #define USE_RANGEFINDER
74 #define USE_RANGEFINDER_US42
75 #define RANGEFINDER_I2C_BUS BUS_I2C2
76 #define PITOT_I2C_BUS BUS_I2C2
77 #define TEMPERATURE_I2C_BUS BUS_I2C2
80 // *************** SPI2 OSD ***************************
81 #define USE_SPI_DEVICE_2
82 #define SPI2_SCK_PIN PB13
83 #define SPI2_MISO_PIN PC2
84 #define SPI2_MOSI_PIN PC3
87 #define MAX7456_CS_PIN PB12
88 #define MAX7456_SPI_BUS BUS_SPI2
90 // *************** SPI3 SD Card ********************
92 #define USE_SDCARD_SPI
93 #define SDCARD_SPI_BUS BUS_SPI3
94 #define SDCARD_CS_PIN PC14
96 #define USE_SPI_DEVICE_3
97 #define SPI3_SCK_PIN PB3
98 #define SPI3_MISO_PIN PB4
99 #define SPI3_MOSI_PIN PB5
101 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
103 // *************** UART *****************************
105 #define VBUS_SENSING_PIN PC13
106 #define VBUS_SENSING_ENABLED
109 #define UART1_TX_PIN PA9
110 #define UART1_RX_PIN PA10
113 #define UART2_TX_PIN PA2
114 #define UART2_RX_PIN PA3
117 #define UART3_TX_PIN PC10
118 #define UART3_RX_PIN PC11
121 #define UART4_TX_PIN PA0
122 #define UART4_RX_PIN PA1
125 #define UART5_TX_PIN PC12
126 #define UART5_RX_PIN PD2
128 #ifndef MATEKF405SE_PINIO
130 #define UART6_TX_PIN PC6
131 #define UART6_RX_PIN PC7
134 #define USE_SOFTSERIAL1 //Frsky SmartPort on TX2 pad
135 #define SOFTSERIAL_1_TX_PIN PA2
136 #define SOFTSERIAL_1_RX_PIN PA2
138 #ifdef MATEKF405SE_PINIO
139 #define SERIAL_PORT_COUNT 7
141 #define SERIAL_PORT_COUNT 8
144 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
145 #define SERIALRX_PROVIDER SERIALRX_SBUS
146 #define SERIALRX_UART SERIAL_PORT_USART2
148 // *************** ADC ***************************
150 #define ADC_INSTANCE ADC1
151 #define ADC1_DMA_STREAM DMA2_Stream0
152 #define ADC_CHANNEL_1_PIN PC0
153 #define ADC_CHANNEL_2_PIN PC1
154 #define ADC_CHANNEL_3_PIN PC5
155 #define VBAT_ADC_CHANNEL ADC_CHN_1
156 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
157 #define RSSI_ADC_CHANNEL ADC_CHN_3
159 // *************** LED2812 ************************
160 #define USE_LED_STRIP
161 #define WS2811_PIN PA15
162 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST5_HANDLER
163 #define WS2811_DMA_STREAM DMA1_Stream5
164 #define WS2811_DMA_CHANNEL DMA_Channel_3
166 // *************** PINIO ***************************
167 #ifdef MATEKF405SE_PINIO
170 #define PINIO1_PIN PC6 // USER 1
171 #define PINIO2_PIN PC7 // USER 2
174 // *************** OTHERS *************************
175 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_OSD | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TELEMETRY | FEATURE_SOFTSERIAL)
176 #define CURRENT_METER_SCALE 317
178 #define USE_SPEKTRUM_BIND
179 #define BIND_PIN PA3 // RX2
182 #define USE_ESC_SENSOR
183 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
185 #define TARGET_IO_PORTA 0xffff
186 #define TARGET_IO_PORTB 0xffff
187 #define TARGET_IO_PORTC 0xffff
188 #define TARGET_IO_PORTD (BIT(2))
190 #define MAX_PWM_OUTPUT_PORTS 9