[FLYWOOF411] add board documentation
[inav/snaewe.git] / src / main / target / MATEKF405 / target.h
blob37e7f78096cdac3978b2dd3a41b819162a72b976
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 #define TARGET_BOARD_IDENTIFIER "MKF4"
22 #define USBD_PRODUCT_STRING "MatekF4"
24 #define LED0 PB9
25 #define LED1 PA14
27 #define BEEPER PC13
28 #define BEEPER_INVERTED
30 // *************** Gyro & ACC **********************
31 #define USE_SPI
32 #define USE_SPI_DEVICE_1
34 #define SPI1_SCK_PIN PA5
35 #define SPI1_MISO_PIN PA6
36 #define SPI1_MOSI_PIN PA7
38 #define MPU6500_CS_PIN PC2
39 #define MPU6500_SPI_BUS BUS_SPI1
41 #define MPU6000_CS_PIN PC2
42 #define MPU6000_SPI_BUS BUS_SPI1
44 #define USE_EXTI
45 #define GYRO_INT_EXTI PC3
46 #define USE_MPU_DATA_READY_SIGNAL
48 #define USE_IMU_MPU6500
49 #define IMU_MPU6500_ALIGN CW180_DEG
51 #define USE_IMU_MPU6000
52 #define IMU_MPU6000_ALIGN CW270_DEG
54 // *************** SD Card **************************
55 #define USE_SDCARD
56 #define USE_SDCARD_SPI
57 #define SDCARD_SPI_BUS BUS_SPI3
58 #define SDCARD_CS_PIN PC1
60 #define USE_SPI_DEVICE_3
61 #define SPI3_SCK_PIN PB3
62 #define SPI3_MISO_PIN PB4
63 #define SPI3_MOSI_PIN PB5
65 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
67 // *************** M25P256 flash ********************
68 #define USE_FLASHFS
69 #define USE_FLASH_M25P16
70 #define M25P16_SPI_BUS BUS_SPI3
71 #define M25P16_CS_PIN PC0
73 // *************** OSD *****************************
74 #define USE_SPI_DEVICE_2
75 #define SPI2_SCK_PIN PB13
76 #define SPI2_MISO_PIN PB14
77 #define SPI2_MOSI_PIN PB15
79 #define USE_OSD
80 #define USE_MAX7456
81 #define MAX7456_SPI_BUS BUS_SPI2
82 #define MAX7456_CS_PIN PB10
84 // *************** UART *****************************
85 #define USE_VCP
86 #define VBUS_SENSING_PIN PB12
87 #define VBUS_SENSING_ENABLED
89 #define USE_UART1
90 #define UART1_RX_PIN PA10
91 #define UART1_TX_PIN PA9
93 #define USE_UART2
94 #define UART2_RX_PIN PA3
95 #define UART2_TX_PIN PA2
97 #define USE_UART3
98 #define UART3_RX_PIN PC11
99 #define UART3_TX_PIN PC10
101 #define USE_UART4
102 #define UART4_RX_PIN PA1
103 #define UART4_TX_PIN PA0
105 #define USE_UART5
106 #define UART5_RX_PIN PD2
107 #define UART5_TX_PIN PC12
109 #define USE_SOFTSERIAL1
110 #define SOFTSERIAL_1_RX_PIN PA1 //RX4
111 #define SOFTSERIAL_1_TX_PIN PA0 //TX4
113 #define USE_SOFTSERIAL2
114 #define SOFTSERIAL_2_RX_PIN PA2 //TX2
115 #define SOFTSERIAL_2_TX_PIN PA2 //TX2
117 #define SERIAL_PORT_COUNT 8
119 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
120 #define SERIALRX_PROVIDER SERIALRX_SBUS
121 #define SERIALRX_UART SERIAL_PORT_USART2
123 // *************** I2C ****************************
124 // SLC clash with WS2812 LED
125 #ifdef MATEKF405OSD
126 // OSD - no native I2C
127 #define USE_I2C
128 #define USE_I2C_DEVICE_EMULATED
129 #define I2C_DEVICE_EMULATED_SHARES_UART3
130 #define SOFT_I2C
131 #define SOFT_I2C_SCL PC10 //TX3 pad
132 #define SOFT_I2C_SDA PC11 //RX3 pad
134 #define DEFAULT_I2C_BUS BUS_I2C_EMULATED
135 #else
136 // AIO / CTR / STD
137 #define USE_I2C
138 #define USE_I2C_DEVICE_1
139 #define I2C1_SCL PB6
140 #define I2C1_SDA PB7
142 #define DEFAULT_I2C_BUS BUS_I2C1
143 #endif
145 #define USE_BARO
146 #define BARO_I2C_BUS DEFAULT_I2C_BUS
147 #define USE_BARO_BMP280
148 #define USE_BARO_MS5611
149 #define USE_BARO_BMP085
150 #define USE_BARO_DPS310
152 #define USE_MAG
153 #define MAG_I2C_BUS DEFAULT_I2C_BUS
154 #define USE_MAG_AK8963
155 #define USE_MAG_AK8975
156 #define USE_MAG_HMC5883
157 #define USE_MAG_QMC5883
158 #define USE_MAG_IST8310
159 #define USE_MAG_IST8308
160 #define USE_MAG_MAG3110
161 #define USE_MAG_LIS3MDL
163 #define TEMPERATURE_I2C_BUS DEFAULT_I2C_BUS
165 #define USE_RANGEFINDER
166 #define USE_RANGEFINDER_MSP
167 #define USE_RANGEFINDER_HCSR04_I2C
168 #define RANGEFINDER_I2C_BUS DEFAULT_I2C_BUS
170 #define PITOT_I2C_BUS DEFAULT_I2C_BUS
172 // *************** ADC *****************************
173 #define USE_ADC
174 #define ADC_INSTANCE ADC1
175 #define ADC1_DMA_STREAM DMA2_Stream0
176 #define ADC_CHANNEL_1_PIN PC5
177 #define ADC_CHANNEL_2_PIN PC4
178 #define ADC_CHANNEL_3_PIN PB1
179 #define VBAT_ADC_CHANNEL ADC_CHN_1
180 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
181 #define RSSI_ADC_CHANNEL ADC_CHN_3
183 #define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TELEMETRY )
184 #define CURRENT_METER_SCALE 179
186 #define USE_LED_STRIP
187 #define WS2811_PIN PA15 // S5 pad for iNav
189 #define USE_SPEKTRUM_BIND
190 #define BIND_PIN PA3 // RX2
192 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
194 #define TARGET_IO_PORTA 0xffff
195 #define TARGET_IO_PORTB 0xffff
196 #define TARGET_IO_PORTC 0xffff
197 #define TARGET_IO_PORTD (BIT(2))
199 #define USE_DSHOT
200 #define USE_ESC_SENSOR
201 #define USE_SERIALSHOT
203 #define MAX_PWM_OUTPUT_PORTS 6
205 #define PCA9685_I2C_BUS DEFAULT_I2C_BUS