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/>.
20 #define TARGET_BOARD_IDENTIFIER "M405"
22 #define USBD_PRODUCT_STRING "MICOAIR405V2"
24 // *************** LED **********************
29 // *************** SPI: Gyro & ACC & BARO & OSD & SDCARD **********************
31 #define USE_SPI_DEVICE_1
32 #define USE_SPI_DEVICE_2
33 #define USE_SPI_DEVICE_3
35 #define SPI1_SCK_PIN PA5
36 #define SPI1_MISO_PIN PA6
37 #define SPI1_MOSI_PIN PA7
39 #define SPI2_SCK_PIN PB13
40 #define SPI2_MISO_PIN PC2
41 #define SPI2_MOSI_PIN PC3
43 #define SPI3_SCK_PIN PC10
44 #define SPI3_MISO_PIN PC11
45 #define SPI3_MOSI_PIN PC12
47 #define USE_IMU_BMI088
48 #define IMU_BMI088_ALIGN CW270_DEG
49 #define BMI088_SPI_BUS BUS_SPI2
50 #define BMI088_GYRO_CS_PIN PC14
51 #define BMI088_ACC_CS_PIN PC13
54 #define USE_BARO_SPL06
55 #define SPL06_SPI_BUS BUS_SPI2
56 #define SPL06_CS_PIN PA4
59 #define MAX7456_SPI_BUS BUS_SPI1
60 #define MAX7456_CS_PIN PB12
64 #define USE_SDCARD_SPI
65 #define SDCARD_SPI_BUS BUS_SPI3
66 #define SDCARD_CS_PIN PC9
67 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
69 // *************** UART *****************************
73 #define UART1_RX_PIN PA10
74 #define UART1_TX_PIN PA9
77 #define UART2_RX_PIN PA3
78 #define UART2_TX_PIN PA2
81 #define UART3_RX_PIN PB11
82 #define UART3_TX_PIN PB10
85 #define UART4_RX_PIN PA1
86 #define UART4_TX_PIN PA0
89 #define UART5_RX_PIN PD2
90 #define UART5_TX_PIN NONE
93 #define UART6_RX_PIN PC7
94 #define UART6_TX_PIN PC6
95 #define INVERTER_PIN_UART6_RX PC15
97 #define SERIAL_PORT_COUNT 7 //VCP, UART1, UART2, UART3, UART4, UART5, UART6
99 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
100 #define SERIALRX_PROVIDER SERIALRX_SBUS
101 #define SERIALRX_UART SERIAL_PORT_USART6
102 #define USE_UART_INVERTER
104 // *************** I2C ****************************
106 #define USE_I2C_DEVICE_1
109 #define DEFAULT_I2C_BUS BUS_I2C1
112 #define MAG_I2C_BUS DEFAULT_I2C_BUS
115 // *************** ENABLE OPTICAL FLOW & RANGEFINDER *****************************
116 #define USE_RANGEFINDER
117 #define USE_RANGEFINDER_MSP
119 #define USE_OPFLOW_MSP
121 // *************** ADC *****************************
123 #define ADC_INSTANCE ADC1
124 #define ADC1_DMA_STREAM DMA2_Stream0
125 #define ADC_CHANNEL_1_PIN PC0
126 #define ADC_CHANNEL_2_PIN PC1
127 #define VBAT_ADC_CHANNEL ADC_CHN_1
128 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
129 #define VBAT_SCALE_DEFAULT 2121
130 #define CURRENT_METER_SCALE 402
132 #define DEFAULT_FEATURES (FEATURE_VBAT | FEATURE_CURRENT_METER | FEATURE_OSD | FEATURE_TELEMETRY)
135 #define USE_ESC_SENSOR
136 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
138 #define TARGET_IO_PORTA 0xffff
139 #define TARGET_IO_PORTB 0xffff
140 #define TARGET_IO_PORTC 0xffff
141 #define TARGET_IO_PORTD (BIT(2))
143 #define MAX_PWM_OUTPUT_PORTS 10