[FLYWOOF411] add board documentation
[inav/snaewe.git] / src / main / target / MATEKF405SE / target.h
blob81681b94f55e904cf308ffd13f62abc1b90515e6
1 /*
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/>.
18 #pragma once
20 #define TARGET_BOARD_IDENTIFIER "MF4S"
21 #define USBD_PRODUCT_STRING "Matek_F405SE"
23 #define LED0 PA14 //Blue
24 #define LED1 PA13 //Green
25 #define BEEPER PC15
26 #define BEEPER_INVERTED
28 // *************** SPI1 Gyro & ACC *******************
29 #define USE_SPI
30 #define USE_SPI_DEVICE_1
32 #define SPI1_SCK_PIN PA5
33 #define SPI1_MISO_PIN PA6
34 #define SPI1_MOSI_PIN PA7
36 #define USE_IMU_MPU6000
37 #define IMU_MPU6000_ALIGN CW270_DEG
38 #define MPU6000_CS_PIN PA4
39 #define MPU6000_SPI_BUS BUS_SPI1
41 #define USE_EXTI
42 #define GYRO_INT_EXTI PC4
43 #define USE_MPU_DATA_READY_SIGNAL
46 // *************** I2C /Baro/Mag *********************
47 #define USE_I2C
48 #define USE_I2C_DEVICE_1
49 #define I2C1_SCL PB8
50 #define I2C1_SDA PB9
52 #define USE_I2C_DEVICE_2
53 #define I2C2_SCL PB10
54 #define I2C2_SDA PB11
56 #define USE_BARO
57 #define BARO_I2C_BUS BUS_I2C1
58 #define USE_BARO_BMP280
59 #define USE_BARO_MS5611
60 #define USE_BARO_BMP085
61 #define USE_BARO_DPS310
63 #define USE_MAG
64 #define MAG_I2C_BUS BUS_I2C2
65 #define USE_MAG_AK8963
66 #define USE_MAG_AK8975
67 #define USE_MAG_HMC5883
68 #define USE_MAG_QMC5883
69 #define USE_MAG_IST8310
70 #define USE_MAG_MAG3110
71 #define USE_MAG_LIS3MDL
73 #define USE_RANGEFINDER
74 #define USE_RANGEFINDER_HCSR04_I2C
75 #define RANGEFINDER_I2C_BUS BUS_I2C2
77 #define PITOT_I2C_BUS BUS_I2C2
79 #define TEMPERATURE_I2C_BUS BUS_I2C2
82 // *************** SPI2 OSD ***************************
83 #define USE_SPI_DEVICE_2
84 #define SPI2_SCK_PIN PB13
85 #define SPI2_MISO_PIN PC2
86 #define SPI2_MOSI_PIN PC3
88 #define USE_OSD
89 #define USE_MAX7456
90 #define MAX7456_CS_PIN PB12
91 #define MAX7456_SPI_BUS BUS_SPI2
93 // *************** SPI3 SD Card ********************
94 #define USE_SDCARD
95 #define USE_SDCARD_SPI
96 #define SDCARD_SPI_BUS BUS_SPI3
97 #define SDCARD_CS_PIN PC14
99 #define USE_SPI_DEVICE_3
100 #define SPI3_SCK_PIN PB3
101 #define SPI3_MISO_PIN PB4
102 #define SPI3_MOSI_PIN PB5
104 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
106 // *************** UART *****************************
107 #define USE_VCP
108 #define VBUS_SENSING_PIN PC13
109 #define VBUS_SENSING_ENABLED
111 #define USE_UART1
112 #define UART1_TX_PIN PA9
113 #define UART1_RX_PIN PA10
115 #define USE_UART2
116 #define UART2_TX_PIN PA2
117 #define UART2_RX_PIN PA3
119 #define USE_UART3
120 #define UART3_TX_PIN PC10
121 #define UART3_RX_PIN PC11
123 #define USE_UART4
124 #define UART4_TX_PIN PA0
125 #define UART4_RX_PIN PA1
127 #define USE_UART5
128 #define UART5_TX_PIN PC12
129 #define UART5_RX_PIN PD2
131 #define USE_UART6
132 #define UART6_TX_PIN PC6
133 #define UART6_RX_PIN PC7
135 #define USE_SOFTSERIAL1 //Frsky SmartPort on TX2 pad
136 #define SOFTSERIAL_1_TX_PIN PA2
137 #define SOFTSERIAL_1_RX_PIN PA2
139 #define SERIAL_PORT_COUNT 8
141 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
142 #define SERIALRX_PROVIDER SERIALRX_SBUS
143 #define SERIALRX_UART SERIAL_PORT_USART2
145 // *************** ADC ***************************
146 #define USE_ADC
147 #define ADC_INSTANCE ADC1
148 #define ADC1_DMA_STREAM DMA2_Stream0
149 #define ADC_CHANNEL_1_PIN PC0
150 #define ADC_CHANNEL_2_PIN PC1
151 #define ADC_CHANNEL_3_PIN PC5
152 #define VBAT_ADC_CHANNEL ADC_CHN_1
153 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
154 #define RSSI_ADC_CHANNEL ADC_CHN_3
156 // *************** LED2812 ************************
157 #define USE_LED_STRIP
158 #define WS2811_PIN PA15
159 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST5_HANDLER
160 #define WS2811_DMA_STREAM DMA1_Stream5
161 #define WS2811_DMA_CHANNEL DMA_Channel_3
163 // *************** OTHERS *************************
164 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_OSD | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TELEMETRY | FEATURE_SOFTSERIAL)
165 #define CURRENT_METER_SCALE 317
167 #define USE_SPEKTRUM_BIND
168 #define BIND_PIN PA3 // RX2
170 #define USE_DSHOT
171 #define USE_ESC_SENSOR
173 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
175 #define TARGET_IO_PORTA 0xffff
176 #define TARGET_IO_PORTB 0xffff
177 #define TARGET_IO_PORTC 0xffff
178 #define TARGET_IO_PORTD (BIT(2))
180 #define MAX_PWM_OUTPUT_PORTS 9
182 #define PCA9685_I2C_BUS BUS_I2C2