From 776b6a7254214be71855e883f6d33f2e69784e20 Mon Sep 17 00:00:00 2001 From: Minderring <1701213518@sz.edu.pku.cn> Date: Sat, 21 Nov 2026 18:25:30 +0800 Subject: [PATCH] Add MicoAir743-Lite and MicoAir743v3 flight controller targets --- docs/boards/MicoAir743-Lite-and-V3.md | 58 ++++++ src/main/target/MICOAIR743LITE/CMakeLists.txt | 1 + src/main/target/MICOAIR743LITE/config.c | 28 +++ src/main/target/MICOAIR743LITE/target.c | 48 +++++ src/main/target/MICOAIR743LITE/target.h | 126 +++++++++++ src/main/target/MICOAIR743V3/CMakeLists.txt | 2 + src/main/target/MICOAIR743V3/config.c | 39 ++++ src/main/target/MICOAIR743V3/target.c | 49 +++++ src/main/target/MICOAIR743V3/target.h | 195 ++++++++++++++++++ 9 files changed, 546 insertions(+) create mode 100644 docs/boards/MicoAir743-Lite-and-V3.md create mode 100644 src/main/target/MICOAIR743LITE/CMakeLists.txt create mode 100644 src/main/target/MICOAIR743LITE/config.c create mode 100644 src/main/target/MICOAIR743LITE/target.c create mode 100644 src/main/target/MICOAIR743LITE/target.h create mode 100644 src/main/target/MICOAIR743V3/CMakeLists.txt create mode 100644 src/main/target/MICOAIR743V3/config.c create mode 100644 src/main/target/MICOAIR743V3/target.c create mode 100644 src/main/target/MICOAIR743V3/target.h diff --git a/docs/boards/MicoAir743-Lite-and-V3.md b/docs/boards/MicoAir743-Lite-and-V3.md new file mode 100644 index 00000000000..cbe9e6501fe --- /dev/null +++ b/docs/boards/MicoAir743-Lite-and-V3.md @@ -0,0 +1,58 @@ +# MicoAir743-Lite and MicoAir743v3 + +The manufacturer manuals include connector diagrams and MCU pin assignments. + +- [MicoAir743-Lite manual](https://micoair.com/en/docs/flight-controller/micoair743/micoair743-lite-flight-controller-manual) +- [MicoAir743v3 manual](https://micoair.com/en/docs/flight-controller/micoair743/micoair743v3-flight-controller) + +Both boards use an STM32H743 and an SPA06 barometer. Blackbox logs to microSD by default. + +| Target | Board | IMU | Compass | Analog OSD | DroneCAN | +| --- | --- | --- | --- | --- | --- | +| `MICOAIR743LITE` | MicoAir743-Lite | ICM45686 | External, I2C1 | None | — | +| `MICOAIR743V3` | MicoAir743v3 | BMI088 or ICM45686 | Onboard IST8310, I2C2 | AT7456E | CAN1 | +| `MICOAIR743V3_EXTMAG` | MicoAir743v3 | BMI088 or ICM45686 | External, I2C1 | AT7456E | CAN1 | + +On V3, `gyro_to_use = 0` selects the BMI088 and `gyro_to_use = 1` selects the ICM45686. Save and reboot after changing it, then calibrate the selected accelerometer and verify the model orientation. With the EXTMAG target, set the external compass alignment for its mounting orientation. + +## Default ports + +The UART numbers match the board markings. + +| Port | Default INAV function | Connection | +| --- | --- | --- | +| USB | MSP | USB Type-C, Configurator | +| UART1 | MSP, 115200 baud | TX1/RX1 | +| UART2 | MSP DisplayPort OSD | Digital VTX connector | +| UART3 | GPS | GPS connector, TX3/RX3 | +| UART4 | Unassigned | TX4/RX4 | +| UART5 | Unassigned (Lite only) | Lite TX5/RX5 | +| UART6 | Serial receiver, SBUS | TX6/RX6 | +| UART7 | ESC telemetry | RX7 only | +| UART8 | MSP, 115200 baud | Internal Bluetooth module | + +For CRSF/ELRS, select the corresponding serial receiver protocol and connect receiver TX to RX6 and receiver RX to TX6. On V3, the DJI-VTX and receiver connectors share RX6. Connect only one receiver output to this signal. + +On V3, the VTX (Analog) and DJI-VTX connectors share TX2. Choose either DisplayPort or analog VTX serial control for UART2. + +## Outputs and LED strip + +| Timer | Lite outputs | V3 outputs | +| --- | --- | --- | +| TIM1 | M1–M4 | M1–M4 | +| TIM3 | M5–M8 | M5–M6 | +| TIM15 | M9–M10 | M9–M10 | +| TIM4 | M11–M12 and the LED/PWM15 pad | M7–M8 and the LED/PWM11 pad | +| TIM12 | M13–M14 | — | + +M10 is PWM-only on both boards. M13 and M14 are also PWM-only on Lite. Outputs on the same timer need compatible protocols and rates, so use PWM for the M9/M10 timer group when M10 is required. + +`LED_STRIP` is disabled by default. Enabling it reserves TIM4, making Lite M11/M12 or V3 M7/M8 unavailable for motor/servo outputs. Keep it disabled when those outputs are needed. The buzzer uses a separate GPIO and does not reserve this timer. + +Motor and servo assignment depends on the selected mixer and timer output modes. Check each physical output against the Configurator assignment before use. + +## V3 camera and VTX power + +The VTX (Analog), DJI-VTX, and FPV Camera connectors share a switched 9 V supply. With default settings and main power connected, the supply starts ON. + +To control this supply, assign an AUX range to USER1 (PINIO1) in the Modes tab. **Activating USER1 turns the 9 V supply off for all three connectors, including the camera. Deactivating USER1 restores power.** diff --git a/src/main/target/MICOAIR743LITE/CMakeLists.txt b/src/main/target/MICOAIR743LITE/CMakeLists.txt new file mode 100644 index 00000000000..b433e158387 --- /dev/null +++ b/src/main/target/MICOAIR743LITE/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32h743xi(MICOAIR743LITE) diff --git a/src/main/target/MICOAIR743LITE/config.c b/src/main/target/MICOAIR743LITE/config.c new file mode 100644 index 00000000000..6d462891d69 --- /dev/null +++ b/src/main/target/MICOAIR743LITE/config.c @@ -0,0 +1,28 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include "platform.h" + +#include "io/serial.h" + +void targetConfiguration(void) +{ + serialFindPortConfiguration(SERIAL_PORT_USART2)->functionMask = FUNCTION_MSP_OSD; + serialFindPortConfiguration(SERIAL_PORT_USART3)->functionMask = FUNCTION_GPS; + serialFindPortConfiguration(SERIAL_PORT_USART7)->functionMask = FUNCTION_ESCSERIAL; + serialFindPortConfiguration(SERIAL_PORT_USART8)->functionMask = FUNCTION_MSP; // Bluetooth +} diff --git a/src/main/target/MICOAIR743LITE/target.c b/src/main/target/MICOAIR743LITE/target.c new file mode 100644 index 00000000000..3a1d93af2c3 --- /dev/null +++ b/src/main/target/MICOAIR743LITE/target.c @@ -0,0 +1,48 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include + +#include "platform.h" + +#include "drivers/bus.h" +#include "drivers/io.h" +#include "drivers/pwm_mapping.h" +#include "drivers/sensor.h" +#include "drivers/timer.h" + +BUSDEV_REGISTER_SPI(busdev_icm45686, DEVHW_ICM45686, ICM45686_SPI_BUS, ICM45686_CS_PIN, ICM45686_EXTI_PIN, DEVFLAGS_NONE, IMU_ICM45686_ALIGN); + +timerHardware_t timerHardware[] = { + DEF_TIM(TIM1, CH4, PE14, TIM_USE_OUTPUT_AUTO, 0, 0), // M1 + DEF_TIM(TIM1, CH3, PE13, TIM_USE_OUTPUT_AUTO, 0, 1), // M2 + DEF_TIM(TIM1, CH2, PE11, TIM_USE_OUTPUT_AUTO, 0, 2), // M3 + DEF_TIM(TIM1, CH1, PE9, TIM_USE_OUTPUT_AUTO, 0, 3), // M4 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 4), // M5 + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 5), // M6 + DEF_TIM(TIM3, CH2, PA7, TIM_USE_OUTPUT_AUTO, 0, 6), // M7 + DEF_TIM(TIM3, CH1, PA6, TIM_USE_OUTPUT_AUTO, 0, 7), // M8 + DEF_TIM(TIM15, CH1, PE5, TIM_USE_OUTPUT_AUTO, 0, 13), // M9 + DEF_TIM(TIM15, CH2, PE6, TIM_USE_OUTPUT_AUTO, 0, 0), // M10: PWM only + DEF_TIM(TIM4, CH1, PD12, TIM_USE_OUTPUT_AUTO, 0, 10), // M11 + DEF_TIM(TIM4, CH2, PD13, TIM_USE_OUTPUT_AUTO, 0, 11), // M12 + DEF_TIM(TIM12, CH1, PB14, TIM_USE_OUTPUT_AUTO, 0, 0), // M13: PWM only + DEF_TIM(TIM12, CH2, PB15, TIM_USE_OUTPUT_AUTO, 0, 0), // M14: PWM only + DEF_TIM(TIM4, CH3, PD14, TIM_USE_LED, 0, 9), // LED pad +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/MICOAIR743LITE/target.h b/src/main/target/MICOAIR743LITE/target.h new file mode 100644 index 00000000000..3e751c07483 --- /dev/null +++ b/src/main/target/MICOAIR743LITE/target.h @@ -0,0 +1,126 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#pragma once + +#define TARGET_BOARD_IDENTIFIER "M7LT" +#define USBD_PRODUCT_STRING "MICOAIR743LITE" +#define VBUS_SENSING_PIN PA8 + +#define LED0 PE3 +#define LED1 PE4 +#define LED2 PE2 + +#define USE_LED_STRIP +#define WS2811_PIN PD14 +#define BEEPER PD15 +#define BEEPER_INVERTED + +// The Lite has one IMU and no SPI OSD chip. +#define USE_SPI +#define USE_SPI_DEVICE_3 +#define SPI3_SCK_PIN PB3 +#define SPI3_MISO_PIN PB4 +#define SPI3_MOSI_PIN PD6 +#define USE_IMU_ICM45686 +#define USE_TARGET_IMU_HARDWARE_DESCRIPTORS +#define ICM45686_SPI_BUS BUS_SPI3 +#define ICM45686_CS_PIN PD4 +#define ICM45686_EXTI_PIN PD5 +#define IMU_ICM45686_ALIGN CW90_DEG + +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define I2C1_SCL PB8 +#define I2C1_SDA PB9 +#define USE_I2C_DEVICE_2 +#define I2C2_SCL PB10 +#define I2C2_SDA PB11 + +// SPA06 is polled over the internal bus; external sensors use I2C1. +#define USE_BARO +#define USE_BARO_DPS310 +#define DPS310_I2C_BUS BUS_I2C2 +#define DPS310_I2C_ADDR 0x77 +#define DEFAULT_I2C_BUS BUS_I2C1 +#define USE_MAG +#define USE_MAG_ALL +#define MAG_I2C_BUS DEFAULT_I2C_BUS + +#define USE_VCP +#define USE_UART1 +#define UART1_TX_PIN PA9 +#define UART1_RX_PIN PA10 +#define USE_UART2 +#define UART2_TX_PIN PA2 +#define UART2_RX_PIN PA3 +#define USE_UART3 +#define UART3_TX_PIN PD8 +#define UART3_RX_PIN PD9 +#define USE_UART4 +#define UART4_TX_PIN PA0 +#define UART4_RX_PIN PA1 +#define USE_UART5 +#define UART5_TX_PIN PB6 +#define UART5_RX_PIN PB5 +#define USE_UART6 +#define UART6_TX_PIN PC6 +#define UART6_RX_PIN PC7 +#define USE_UART7 +#define UART7_RX_PIN PE7 // ESC telemetry; TX is not connected. +#define USE_UART8 +#define UART8_TX_PIN PE1 +#define UART8_RX_PIN PE0 +#define SERIAL_PORT_COUNT 9 + +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS +#define SERIALRX_UART SERIAL_PORT_USART6 + +#define USE_SDCARD +#define USE_SDCARD_SDIO +#define SDCARD_SDIO_DEVICE SDIODEV_1 +#define SDCARD_SDIO_4BIT +#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT + +#define USE_ADC +#define ADC_INSTANCE ADC1 +#define ADC_CHANNEL_1_PIN PC0 +#define ADC_CHANNEL_2_PIN PC1 +#define VBAT_ADC_CHANNEL ADC_CHN_1 +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2 +#define VBAT_SCALE_DEFAULT 2112 +#define CURRENT_METER_SCALE 249 // 40.2 A/V expressed in 0.1 mV/A + +#define USE_RANGEFINDER +#define USE_RANGEFINDER_MSP +#define USE_OPFLOW +#define USE_OPFLOW_MSP + +// Leave the optional LED strip disabled so TIM4 is available for M11/M12. +#define DEFAULT_FEATURES (FEATURE_VBAT | FEATURE_CURRENT_METER | FEATURE_OSD | FEATURE_TELEMETRY) +#define USE_DSHOT +#define USE_ESC_SENSOR +#define USE_SERIAL_4WAY_BLHELI_INTERFACE + +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD 0xffff +#define TARGET_IO_PORTE 0xffff + +#define MAX_PWM_OUTPUT_PORTS 14 diff --git a/src/main/target/MICOAIR743V3/CMakeLists.txt b/src/main/target/MICOAIR743V3/CMakeLists.txt new file mode 100644 index 00000000000..8d84cc6f72a --- /dev/null +++ b/src/main/target/MICOAIR743V3/CMakeLists.txt @@ -0,0 +1,2 @@ +target_stm32h743xi(MICOAIR743V3) +target_stm32h743xi(MICOAIR743V3_EXTMAG) diff --git a/src/main/target/MICOAIR743V3/config.c b/src/main/target/MICOAIR743V3/config.c new file mode 100644 index 00000000000..f1d07f122df --- /dev/null +++ b/src/main/target/MICOAIR743V3/config.c @@ -0,0 +1,39 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include +#include "platform.h" + +#include "fc/fc_msp_box.h" +#include "io/piniobox.h" +#include "io/serial.h" +#include "sensors/compass.h" + +void targetConfiguration(void) +{ +#ifndef MICOAIR743V3_EXTMAG + compassConfigMutable()->mag_align = CW90_DEG; +#endif + + // Use identifiers: V3 has no UART5, unlike MICOAIR743V2. + serialFindPortConfiguration(SERIAL_PORT_USART2)->functionMask = FUNCTION_MSP_OSD; + serialFindPortConfiguration(SERIAL_PORT_USART3)->functionMask = FUNCTION_GPS; + serialFindPortConfiguration(SERIAL_PORT_USART7)->functionMask = FUNCTION_ESCSERIAL; + serialFindPortConfiguration(SERIAL_PORT_USART8)->functionMask = FUNCTION_MSP; // Bluetooth + + pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1; // VTX power control +} diff --git a/src/main/target/MICOAIR743V3/target.c b/src/main/target/MICOAIR743V3/target.c new file mode 100644 index 00000000000..c4e48d0caad --- /dev/null +++ b/src/main/target/MICOAIR743V3/target.c @@ -0,0 +1,49 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include + +#include "platform.h" + +#include "drivers/bus.h" +#include "drivers/io.h" +#include "drivers/pwm_mapping.h" +#include "drivers/sensor.h" +#include "drivers/timer.h" + +// BMI088 accelerometer and gyro must use the same selection tag. +BUSDEV_REGISTER_SPI_TAG(busdev_bmi088_gyro, DEVHW_BMI088_GYRO, BMI088_SPI_BUS, BMI088_GYRO_CS_PIN, BMI088_GYRO_EXTI_PIN, 0, DEVFLAGS_NONE, IMU_BMI088_ALIGN); +BUSDEV_REGISTER_SPI_TAG(busdev_bmi088_acc, DEVHW_BMI088_ACC, BMI088_SPI_BUS, BMI088_ACC_CS_PIN, BMI088_ACC_EXTI_PIN, 0, DEVFLAGS_NONE, IMU_BMI088_ALIGN); +BUSDEV_REGISTER_SPI_TAG(busdev_icm45686, DEVHW_ICM45686, ICM45686_SPI_BUS, ICM45686_CS_PIN, ICM45686_EXTI_PIN, 1, DEVFLAGS_NONE, IMU_ICM45686_ALIGN); + +timerHardware_t timerHardware[] = { + DEF_TIM(TIM1, CH4, PE14, TIM_USE_OUTPUT_AUTO, 0, 0), // M1 + DEF_TIM(TIM1, CH3, PE13, TIM_USE_OUTPUT_AUTO, 0, 1), // M2 + DEF_TIM(TIM1, CH2, PE11, TIM_USE_OUTPUT_AUTO, 0, 2), // M3 + DEF_TIM(TIM1, CH1, PE9, TIM_USE_OUTPUT_AUTO, 0, 3), // M4 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 4), // M5 + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 5), // M6 + DEF_TIM(TIM4, CH1, PD12, TIM_USE_OUTPUT_AUTO, 0, 6), // M7 + DEF_TIM(TIM4, CH2, PD13, TIM_USE_OUTPUT_AUTO, 0, 7), // M8 + DEF_TIM(TIM15, CH1, PE5, TIM_USE_OUTPUT_AUTO, 0, 13), // M9: DMA2 Stream5, independent of M1 + DEF_TIM(TIM15, CH2, PE6, TIM_USE_OUTPUT_AUTO, 0, 0), // M10: PWM only (no channel DMA) + + DEF_TIM(TIM4, CH3, PD14, TIM_USE_LED, 0, 9), // LED strip, or an extra output when LED_STRIP is disabled + // PD15 remains a GPIO beeper and must not be claimed as a TIM4 output. +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/MICOAIR743V3/target.h b/src/main/target/MICOAIR743V3/target.h new file mode 100644 index 00000000000..0cb7f9df1be --- /dev/null +++ b/src/main/target/MICOAIR743V3/target.h @@ -0,0 +1,195 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#pragma once + +#define TARGET_BOARD_IDENTIFIER "M7V3" + +#define USBD_PRODUCT_STRING "MICOAIR743V3" +#define VBUS_SENSING_PIN PA8 + +// LEDs +#define LED0 PE3 +#define LED1 PE4 +#define LED2 PE2 + +#define USE_LED_STRIP +#define WS2811_PIN PD14 + +// Beeper +#define BEEPER PD15 +#define BEEPER_INVERTED +// GPIO beeper: TIM4 is shared with M7/M8 and the LED strip. + +// SPI1: AT7456E OSD +#define USE_SPI +#define USE_SPI_DEVICE_1 + +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +#define USE_MAX7456 +#define MAX7456_SPI_BUS BUS_SPI1 +#define MAX7456_CS_PIN PB12 + +// Select one complete IMU: gyro_to_use=0 for BMI088, 1 for ICM45686. +#define USE_DUAL_GYRO +#define USE_TARGET_IMU_HARDWARE_DESCRIPTORS + +// SPI2: BMI088 IMU +#define USE_SPI_DEVICE_2 + +#define SPI2_SCK_PIN PD3 +#define SPI2_MISO_PIN PC2 +#define SPI2_MOSI_PIN PC3 + +#define USE_IMU_BMI088 +#define IMU_BMI088_ALIGN CW270_DEG +#define BMI088_SPI_BUS BUS_SPI2 +#define BMI088_GYRO_CS_PIN PD5 +#define BMI088_GYRO_EXTI_PIN PC15 +#define BMI088_ACC_CS_PIN PD4 +#define BMI088_ACC_EXTI_PIN PC14 + +// SPI3: ICM45686 IMU +#define USE_SPI_DEVICE_3 + +#define SPI3_SCK_PIN PC10 +#define SPI3_MISO_PIN PC11 +#define SPI3_MOSI_PIN PC12 + +#define USE_IMU_ICM45686 +#define IMU_ICM45686_ALIGN CW90_DEG +#define ICM45686_SPI_BUS BUS_SPI3 +#define ICM45686_CS_PIN PA15 +#define ICM45686_EXTI_PIN PD2 + +// UARTs +#define USE_VCP + +#define USE_UART1 +#define UART1_RX_PIN PA10 +#define UART1_TX_PIN PA9 + +#define USE_UART2 +#define UART2_RX_PIN PA3 +#define UART2_TX_PIN PA2 + +#define USE_UART3 +#define UART3_RX_PIN PD9 +#define UART3_TX_PIN PD8 + +#define USE_UART4 +#define UART4_RX_PIN PA1 +#define UART4_TX_PIN PA0 + +#define USE_UART6 +#define UART6_RX_PIN PC7 +#define UART6_TX_PIN PC6 + +#define USE_UART7 +#define UART7_RX_PIN PE7 // ESC telemetry; TX is not exposed. + +#define USE_UART8 +#define UART8_RX_PIN PE0 +#define UART8_TX_PIN PE1 + +#define SERIAL_PORT_COUNT 8 + +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS +#define SERIALRX_UART SERIAL_PORT_USART6 + +#define USE_DRONECAN +#define CAN1_RX PB8 +#define CAN1_TX PB9 + +// I2C1: external connector; I2C2: onboard SPA06 and IST8310 +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define USE_I2C_DEVICE_2 + +#define I2C1_SCL PB6 +#define I2C1_SDA PB7 +#define I2C2_SCL PB10 +#define I2C2_SDA PB11 + +// SPA06-003 uses the DPS310-compatible 0x11 device path and 21-byte coefficients. +// The I2C address is fixed at decimal 119 (0x77). +#define USE_BARO +#define USE_BARO_DPS310 +#define DPS310_I2C_BUS BUS_I2C2 +#define DPS310_I2C_ADDR 0x77 + +#define USE_MAG +#ifdef MICOAIR743V3_EXTMAG +// External compass connector; probe all supported compass drivers on I2C1. +#define USE_MAG_ALL +#define MAG_I2C_BUS BUS_I2C1 +#else +// Onboard IST8310 at 0x0E; the driver probes both supported addresses. +#define USE_MAG_IST8310 +#define MAG_I2C_BUS BUS_I2C2 +#endif + +// MSP optical-flow and rangefinder support +#define USE_RANGEFINDER +#define USE_RANGEFINDER_MSP +#define USE_OPFLOW +#define USE_OPFLOW_MSP + +// SDMMC2: PB14/PB15/PB3/PB4, clock PD6, command PD7 +#define USE_SDCARD +#define USE_SDCARD_SDIO +#define SDCARD_SDIO_DEVICE SDIODEV_2 +#define SDCARD_SDIO_4BIT +#define SDCARD_SDIO2_CK_ALT +#define SDCARD_SDIO2_CMD_ALT +#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT + +// ADC +#define USE_ADC +#define ADC_INSTANCE ADC1 +#define ADC_CHANNEL_1_PIN PC0 +#define ADC_CHANNEL_2_PIN PC1 +#define VBAT_ADC_CHANNEL ADC_CHN_1 +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2 +#define VBAT_SCALE_DEFAULT 2112 +// INAV uses 0.1 mV/A: 10000 / 40.2 A/V, rounded to the nearest integer. +#define CURRENT_METER_SCALE 249 + +// VTX power enable +#define USE_PINIO +#define USE_PINIOBOX +#define PINIO1_PIN PE15 + +// Enabling LED_STRIP reserves TIM4 and makes M7/M8 unavailable. +#define DEFAULT_FEATURES (FEATURE_VBAT | FEATURE_CURRENT_METER | FEATURE_OSD | FEATURE_TELEMETRY) + +#define USE_DSHOT +#define USE_ESC_SENSOR +#define USE_SERIAL_4WAY_BLHELI_INTERFACE + +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD 0xffff +#define TARGET_IO_PORTE 0xffff + +// M1-M10; the PWM driver counts the WS2811 pad separately. +#define MAX_PWM_OUTPUT_PORTS 10