Set blackbox file handler to NULL after closing file
[inav.git] / src / main / target / MATEKF405CAN / target.h
blobd12b5e3e1a321bcddb2c8fb54e42c9629dad4253
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 "MF4C"
21 #define USBD_PRODUCT_STRING "Matek_F405CAN"
23 #define LED0 PA14 //Blue
24 #define LED1 PA13 //Green
26 #define BEEPER PA8
27 #define BEEPER_INVERTED
28 #define BEEPER_PWM_FREQUENCY 2500
30 // *************** SPI1 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 USE_IMU_MPU6500
39 #define IMU_MPU6500_ALIGN CW180_DEG_FLIP
40 #define MPU6500_CS_PIN PA4
41 #define MPU6500_SPI_BUS BUS_SPI1
43 // *************** I2C /Baro/Mag *********************
44 #define USE_I2C
45 #define USE_I2C_DEVICE_2
46 #define I2C2_SCL PB10
47 #define I2C2_SDA PB11
49 #define USE_BARO
50 #define BARO_I2C_BUS BUS_I2C2
51 #define USE_BARO_BMP280
52 #define USE_BARO_MS5611
53 #define USE_BARO_DPS310
54 #define USE_BARO_SPL06
56 #define USE_MAG
57 #define MAG_I2C_BUS BUS_I2C2
58 #define USE_MAG_ALL
60 #define USE_RANGEFINDER
61 #define RANGEFINDER_I2C_BUS BUS_I2C2
63 #define PITOT_I2C_BUS BUS_I2C2
64 #define TEMPERATURE_I2C_BUS BUS_I2C2
66 // *************** SPI2 RM3100 **************************
67 #define USE_SPI_DEVICE_2
68 #define SPI2_SCK_PIN PB13
69 #define SPI2_MISO_PIN PB14
70 #define SPI2_MOSI_PIN PB15
72 #define USE_MAG_RM3100
73 #define RM3100_CS_PIN PB12
74 #define RM3100_SPI_BUS BUS_SPI2
76 // *************** SPI3 SD Card ********************
77 #define USE_SDCARD
78 #define USE_SDCARD_SPI
79 #define SDCARD_SPI_BUS BUS_SPI3
80 #define SDCARD_CS_PIN PC14
82 #define USE_SPI_DEVICE_3
83 #define SPI3_SCK_PIN PB3
84 #define SPI3_MISO_PIN PB4
85 #define SPI3_MOSI_PIN PB5
87 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
89 // *************** UART *****************************
90 #define USE_VCP
92 #define USE_UART1
93 #define UART1_TX_PIN PA9
94 #define UART1_RX_PIN PA10
96 #define USE_UART2
97 #define UART2_TX_PIN PA2
98 #define UART2_RX_PIN PA3
100 #define USE_UART3
101 #define UART3_TX_PIN PC10
102 #define UART3_RX_PIN PC11
104 #define USE_UART4
105 #define UART4_TX_PIN PA0
106 #define UART4_RX_PIN PA1
108 #define USE_UART5
109 #define UART5_TX_PIN PC12
110 #define UART5_RX_PIN PD2
112 #define USE_SOFTSERIAL1
113 #define SOFTSERIAL_1_TX_PIN PA2 //TX2 pad
114 #define SOFTSERIAL_1_RX_PIN PA2 //TX2 pad
116 #define SERIAL_PORT_COUNT 7
118 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
119 #define SERIALRX_PROVIDER SERIALRX_SBUS
120 #define SERIALRX_UART SERIAL_PORT_USART2
122 // *************** ADC ***************************
123 #define USE_ADC
124 #define ADC_INSTANCE ADC1
125 #define ADC1_DMA_STREAM DMA2_Stream0
126 #define ADC_CHANNEL_1_PIN PC0
127 #define ADC_CHANNEL_2_PIN PC1
128 #define ADC_CHANNEL_3_PIN PC2
129 #define ADC_CHANNEL_4_PIN PC3
130 #define VBAT_ADC_CHANNEL ADC_CHN_1
131 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
132 #define RSSI_ADC_CHANNEL ADC_CHN_3
133 #define AIRSPEED_ADC_CHANNEL ADC_CHN_4
135 // *************** LED2812 ************************
136 #define USE_LED_STRIP
137 #define WS2811_PIN PA15
138 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST5_HANDLER
139 #define WS2811_DMA_STREAM DMA1_Stream5
140 #define WS2811_DMA_CHANNEL DMA_Channel_3
142 // *************** OTHERS *************************
143 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_GPS | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TELEMETRY | FEATURE_SOFTSERIAL)
144 #define VBAT_SCALE 2100 //1K:20K
146 #define USE_SPEKTRUM_BIND
147 #define BIND_PIN PA3 // RX2
149 #define USE_DSHOT
150 #define USE_ESC_SENSOR
152 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
154 #define TARGET_IO_PORTA 0xffff
155 #define TARGET_IO_PORTB 0xffff
156 #define TARGET_IO_PORTC 0xffff
157 #define TARGET_IO_PORTD (BIT(2))
159 #define MAX_PWM_OUTPUT_PORTS 8