Set blackbox file handler to NULL after closing file
[inav.git] / src / main / target / MATEKF405 / target.h
blob667cd2b3fa899032a3650bdfc93d2b2a80085da8
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_IMU_MPU6500
45 #define IMU_MPU6500_ALIGN CW180_DEG
47 #define USE_IMU_MPU6000
48 #define IMU_MPU6000_ALIGN CW270_DEG
50 // *************** SD Card **************************
51 #define USE_SDCARD
52 #define USE_SDCARD_SPI
53 #define SDCARD_SPI_BUS BUS_SPI3
54 #define SDCARD_CS_PIN PC1
56 #define USE_SPI_DEVICE_3
57 #define SPI3_SCK_PIN PB3
58 #define SPI3_MISO_PIN PB4
59 #define SPI3_MOSI_PIN PB5
61 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
63 // *************** M25P256 flash ********************
64 #define USE_FLASHFS
65 #define USE_FLASH_M25P16
66 #define M25P16_SPI_BUS BUS_SPI3
67 #define M25P16_CS_PIN PC0
69 // *************** OSD *****************************
70 #define USE_SPI_DEVICE_2
71 #define SPI2_SCK_PIN PB13
72 #define SPI2_MISO_PIN PB14
73 #define SPI2_MOSI_PIN PB15
75 #define USE_MAX7456
76 #define MAX7456_SPI_BUS BUS_SPI2
77 #define MAX7456_CS_PIN PB10
79 // *************** UART *****************************
80 #define USE_VCP
81 #define VBUS_SENSING_PIN PB12
82 #define VBUS_SENSING_ENABLED
84 #define USE_UART1
85 #define UART1_RX_PIN PA10
86 #define UART1_TX_PIN PA9
88 #define USE_UART2
89 #define UART2_RX_PIN PA3
90 #define UART2_TX_PIN PA2
92 #define USE_UART3
93 #define UART3_RX_PIN PC11
94 #define UART3_TX_PIN PC10
96 #define USE_UART4
97 #define UART4_RX_PIN PA1
98 #define UART4_TX_PIN PA0
100 #define USE_UART5
101 #define UART5_RX_PIN PD2
102 #define UART5_TX_PIN PC12
104 #define USE_SOFTSERIAL1
105 #define SOFTSERIAL_1_RX_PIN PA1 //RX4
106 #define SOFTSERIAL_1_TX_PIN PA0 //TX4
108 #define USE_SOFTSERIAL2
109 #define SOFTSERIAL_2_RX_PIN PA2 //TX2
110 #define SOFTSERIAL_2_TX_PIN PA2 //TX2
112 #define SERIAL_PORT_COUNT 8
114 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
115 #define SERIALRX_PROVIDER SERIALRX_SBUS
116 #define SERIALRX_UART SERIAL_PORT_USART2
118 // *************** I2C ****************************
119 // SLC clash with WS2812 LED
120 #ifdef MATEKF405OSD
121 // OSD - no native I2C
122 #define USE_I2C
123 #define USE_I2C_DEVICE_EMULATED
124 #define I2C_DEVICE_EMULATED_SHARES_UART3
125 #define SOFT_I2C
126 #define SOFT_I2C_SCL PC10 //TX3 pad
127 #define SOFT_I2C_SDA PC11 //RX3 pad
129 #define DEFAULT_I2C_BUS BUS_I2C_EMULATED
130 #else
131 // AIO / CTR / STD
132 #define USE_I2C
133 #define USE_I2C_DEVICE_1
134 #define I2C1_SCL PB6
135 #define I2C1_SDA PB7
137 #define DEFAULT_I2C_BUS BUS_I2C1
138 #endif
140 #define USE_BARO
141 #define BARO_I2C_BUS DEFAULT_I2C_BUS
142 #define USE_BARO_BMP280
143 #define USE_BARO_MS5611
144 #define USE_BARO_BMP085
145 #define USE_BARO_DPS310
146 #define USE_BARO_SPL06
148 #define USE_MAG
149 #define MAG_I2C_BUS DEFAULT_I2C_BUS
150 #define USE_MAG_ALL
152 #define TEMPERATURE_I2C_BUS DEFAULT_I2C_BUS
154 #define USE_RANGEFINDER
155 #define USE_RANGEFINDER_MSP
156 #define RANGEFINDER_I2C_BUS DEFAULT_I2C_BUS
158 #define PITOT_I2C_BUS DEFAULT_I2C_BUS
160 // *************** ADC *****************************
161 #define USE_ADC
162 #define ADC_INSTANCE ADC1
163 #define ADC1_DMA_STREAM DMA2_Stream0
164 #define ADC_CHANNEL_1_PIN PC5
165 #define ADC_CHANNEL_2_PIN PC4
166 #define ADC_CHANNEL_3_PIN PB1
167 #define VBAT_ADC_CHANNEL ADC_CHN_1
168 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
169 #define RSSI_ADC_CHANNEL ADC_CHN_3
171 #define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TELEMETRY )
172 #define CURRENT_METER_SCALE 179
174 #define USE_LED_STRIP
175 #define WS2811_PIN PA15 // S5 pad for INAV
177 #define USE_SPEKTRUM_BIND
178 #define BIND_PIN PA3 // RX2
180 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
182 #define TARGET_IO_PORTA 0xffff
183 #define TARGET_IO_PORTB 0xffff
184 #define TARGET_IO_PORTC 0xffff
185 #define TARGET_IO_PORTD (BIT(2))
187 #define USE_DSHOT
188 #define USE_ESC_SENSOR
190 #define MAX_PWM_OUTPUT_PORTS 6