From 13db4749d52ba83facdf48563657386600f427fc Mon Sep 17 00:00:00 2001 From: hakrc1 Date: Sun, 7 Apr 2024 17:35:33 +0800 Subject: [PATCH 1/9] add a new target BLADE_F4 --- src/main/target/BLADE_F4/CMakeLists.txt | 1 + src/main/target/BLADE_F4/config.c | 28 ++++ src/main/target/BLADE_F4/target.c | 37 +++++ src/main/target/BLADE_F4/target.h | 179 ++++++++++++++++++++++++ 4 files changed, 245 insertions(+) create mode 100644 src/main/target/BLADE_F4/CMakeLists.txt create mode 100644 src/main/target/BLADE_F4/config.c create mode 100644 src/main/target/BLADE_F4/target.c create mode 100644 src/main/target/BLADE_F4/target.h diff --git a/src/main/target/BLADE_F4/CMakeLists.txt b/src/main/target/BLADE_F4/CMakeLists.txt new file mode 100644 index 00000000000..4a1557112b5 --- /dev/null +++ b/src/main/target/BLADE_F4/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32f405xg(BLADE_F4) diff --git a/src/main/target/BLADE_F4/config.c b/src/main/target/BLADE_F4/config.c new file mode 100644 index 00000000000..b963bfbfa59 --- /dev/null +++ b/src/main/target/BLADE_F4/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 +#include + +#include "fc/fc_msp_box.h" +#include "io/piniobox.h" + +void targetConfiguration(void) +{ + pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1; + pinioBoxConfigMutable()->permanentId[1] = BOX_PERMANENT_ID_USER2; +} diff --git a/src/main/target/BLADE_F4/target.c b/src/main/target/BLADE_F4/target.c new file mode 100644 index 00000000000..a44aabc0142 --- /dev/null +++ b/src/main/target/BLADE_F4/target.c @@ -0,0 +1,37 @@ +/* + * 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 + +#include "drivers/io.h" +#include "drivers/timer.h" + +timerHardware_t timerHardware[] = { + DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 1), // S1_OUT D2_ST4 + DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S2_OUT D2_ST7 + DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 1), // S3_OUT D2_ST1 + DEF_TIM(TIM1, CH2, PA9, TIM_USE_OUTPUT_AUTO, 0, 1), // S4_OUT D2_ST2 + DEF_TIM(TIM1, CH3, PA10, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT D2_ST6 + DEF_TIM(TIM3, CH1, PB4, TIM_USE_OUTPUT_AUTO, 0, 0), // S6_OUT D1_ST4 + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S7_OUT D1_ST7 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S8_OUT D1_ST2 + + DEF_TIM(TIM2, CH2, PB3, TIM_USE_LED, 0, 0), // D1_ST6 +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/BLADE_F4/target.h b/src/main/target/BLADE_F4/target.h new file mode 100644 index 00000000000..91e1b4e5305 --- /dev/null +++ b/src/main/target/BLADE_F4/target.h @@ -0,0 +1,179 @@ +/* + * 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 "RUSH" +#define USBD_PRODUCT_STRING "BLADE_F4" + +#define USE_TARGET_CONFIG + +/*** Indicators ***/ +#define LED0 PC15 +#define LED1 PC14 +#define BEEPER PC13 +#define BEEPER_INVERTED + +/*** SPI/I2C bus ***/ +#define USE_SPI +#define USE_SPI_DEVICE_1 +#define SPI1_NSS_PIN PA4 +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +#define USE_SPI_DEVICE_2 +#define SPI2_NSS_PIN PB12 +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PB14 +#define SPI2_MOSI_PIN PB15 +#define SPI2_FLASH_PIN PA15 + + +#define USE_SPI_DEVICE_3 +#define SPI3_SCK_PIN PC10 +#define SPI3_MISO_PIN PC11 +#define SPI3_MOSI_PIN PB5 + +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define I2C1_SCL PB8 +#define I2C1_SDA PB9 + + +/*** IMU sensors ***/ + +// MPU6000 +#define USE_IMU_MPU6000 +#define IMU_MPU6000_ALIGN CW270_DEG +#define MPU6000_SPI_BUS BUS_SPI1 +#define MPU6000_CS_PIN SPI1_NSS_PIN + + +// ICM42605/ICM42688P +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN CW270_DEG +#define ICM42605_SPI_BUS BUS_SPI1 +#define ICM42605_CS_PIN SPI1_NSS_PIN + +//BMI270 +#define USE_IMU_BMI270 +#define IMU_BMI270_ALIGN CW270_DEG +#define BMI270_SPI_BUS BUS_SPI1 +#define BMI270_CS_PIN SPI1_NSS_PIN + + +/*** OSD ***/ +#define USE_MAX7456 +#define MAX7456_SPI_BUS BUS_SPI2 +#define MAX7456_CS_PIN SPI2_NSS_PIN + +/*** Onboard flash ***/ +#define USE_FLASHFS +#define USE_FLASH_M25P16 +#define M25P16_CS_PIN SPI2_FLASH_PIN +#define M25P16_SPI_BUS BUS_SPI2 + +// *** PINIO *** + +#define USE_PINIO +#define USE_PINIOBOX +#define PINIO1_PIN PC2 +#define PINIO2_PIN PC5 + +/*** Serial ports ***/ +#define USE_VCP +#define USE_UART_INVERTER + +#define USE_UART1 +#define UART1_RX_PIN PB7 +#define UART1_TX_PIN PB6 + +#define USE_UART2 +#define UART2_RX_PIN PA3 +#define UART2_TX_PIN PA2 +#define INVERTER_PIN_UART2_RX PC0 + +#define USE_UART3 +#define UART3_RX_PIN PB11 +#define UART3_TX_PIN PB10 + +#define USE_UART4 +#define UART4_RX_PIN PA1 +#define UART4_TX_PIN PA0 + +#define USE_UART5 +#define UART5_RX_PIN PD2 +#define UART5_TX_PIN PC12 + +#define USE_UART6 +#define UART6_RX_PIN PC7 +#define UART6_TX_PIN PC6 + +#define SERIAL_PORT_COUNT 7 + +/*** BARO & MAG ***/ +#define USE_BARO +#define BARO_I2C_BUS BUS_I2C1 +#define USE_BARO_BMP280 +#define USE_BARO_SPL06 +#define USE_BARO_DPS310 + +#define USE_MAG +#define MAG_I2C_BUS BUS_I2C1 +#define USE_MAG_ALL + +/*** ADC ***/ +#define USE_ADC +#define ADC_CHANNEL_1_PIN PC1 +#define ADC_CHANNEL_2_PIN PC3 + + +#define VBAT_ADC_CHANNEL ADC_CHN_1 +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2 + + +/*** LED STRIP ***/ +#define USE_LED_STRIP +#define WS2811_PIN PB3 + +/*** Default settings ***/ +#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS +#define CURRENT_METER_SCALE 250 + + +#define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_OSD | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TELEMETRY | FEATURE_SOFTSERIAL ) + +/*** Timer/PWM output ***/ +#define USE_SERIAL_4WAY_BLHELI_INTERFACE +#define MAX_PWM_OUTPUT_PORTS 8 +#define USE_DSHOT +#define USE_ESC_SENSOR + +// ********** Optical Flow and Lidar ************** +#define USE_RANGEFINDER +#define USE_RANGEFINDER_MSP +#define USE_OPFLOW +#define USE_OPFLOW_MSP + +/*** Used pins ***/ +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD (BIT(2)) From 2177ef6224f51363994b1e8976c5c8f7c8559e52 Mon Sep 17 00:00:00 2001 From: hakrc1 Date: Sun, 7 Apr 2024 17:47:22 +0800 Subject: [PATCH 2/9] add new target BLADE_PRO_H7 --- src/main/target/BLADE_PRO_H7/CMakeLists.txt | 1 + src/main/target/BLADE_PRO_H7/config.c | 32 +++ src/main/target/BLADE_PRO_H7/target.c | 70 ++++++ src/main/target/BLADE_PRO_H7/target.h | 233 ++++++++++++++++++++ 4 files changed, 336 insertions(+) create mode 100644 src/main/target/BLADE_PRO_H7/CMakeLists.txt create mode 100644 src/main/target/BLADE_PRO_H7/config.c create mode 100644 src/main/target/BLADE_PRO_H7/target.c create mode 100644 src/main/target/BLADE_PRO_H7/target.h diff --git a/src/main/target/BLADE_PRO_H7/CMakeLists.txt b/src/main/target/BLADE_PRO_H7/CMakeLists.txt new file mode 100644 index 00000000000..37321c43054 --- /dev/null +++ b/src/main/target/BLADE_PRO_H7/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32h743xi(BLADE_PRO_H7) diff --git a/src/main/target/BLADE_PRO_H7/config.c b/src/main/target/BLADE_PRO_H7/config.c new file mode 100644 index 00000000000..1065971614a --- /dev/null +++ b/src/main/target/BLADE_PRO_H7/config.c @@ -0,0 +1,32 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight 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. + * + * Cleanflight 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 Cleanflight. If not, see . + */ + +#include + +#include "platform.h" + +#include "fc/fc_msp_box.h" +#include "fc/config.h" + +#include "io/piniobox.h" + +void targetConfiguration(void) +{ + pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1; + pinioBoxConfigMutable()->permanentId[1] = BOX_PERMANENT_ID_USER2; + beeperConfigMutable()->pwmMode = true; +} diff --git a/src/main/target/BLADE_PRO_H7/target.c b/src/main/target/BLADE_PRO_H7/target.c new file mode 100644 index 00000000000..1aeb2ef3a9d --- /dev/null +++ b/src/main/target/BLADE_PRO_H7/target.c @@ -0,0 +1,70 @@ +/* + * 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/timer.h" +#include "drivers/pinio.h" +#include "drivers/sensor.h" + +BUSDEV_REGISTER_SPI_TAG(busdev_mpu6000_1, DEVHW_MPU6000, MPU6000_SPI_BUS_1, MPU6000_CS_PIN_1, MPU6000_EXTI_PIN_1, DEVFLAGS_NONE, 0, IMU_MPU6000_ALIGN_1); +BUSDEV_REGISTER_SPI_TAG(busdev_mpu6000_2, DEVHW_MPU6000, MPU6000_SPI_BUS_2, MPU6000_CS_PIN_2, MPU6000_EXTI_PIN_2, DEVFLAGS_NONE, 1, IMU_MPU6000_ALIGN_2); + +BUSDEV_REGISTER_SPI_TAG(busdev_icm42688_1, DEVHW_ICM42605, ICM42605_SPI_BUS_1, ICM42605_CS_PIN_1, ICM42605_EXTI_PIN_1, DEVFLAGS_NONE, 0, IMU_ICM42605_ALIGN_1); +BUSDEV_REGISTER_SPI_TAG(busdev_icm42688_2, DEVHW_ICM42605, ICM42605_SPI_BUS_2, ICM42605_CS_PIN_2, ICM42605_EXTI_PIN_2, DEVFLAGS_NONE, 1, IMU_ICM42605_ALIGN_2); + +BUSDEV_REGISTER_SPI_TAG(busdev_bmi270_1, DEVHW_BMI270, BMI270_SPI_BUS_1, BMI270_CS_PIN_1, BMI270_EXTI_PIN_1, DEVFLAGS_NONE, 0, IMU_BMI270_ALIGN_1); +BUSDEV_REGISTER_SPI_TAG(busdev_bmi270_2, DEVHW_BMI270, BMI270_SPI_BUS_2, BMI270_CS_PIN_2, BMI270_EXTI_PIN_2, DEVFLAGS_NONE, 1, IMU_BMI270_ALIGN_2); + +timerHardware_t timerHardware[] = { +// DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 +// DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 1), // S2 +// DEF_TIM(TIM5, CH1, PA0, TIM_USE_OUTPUT_AUTO, 0, 2), // S3 +// DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 3), // S4 + + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S2 + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 1), // S1 + DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 2), // S4 + DEF_TIM(TIM5, CH1, PA0, TIM_USE_OUTPUT_AUTO, 0, 3), // S3 + + DEF_TIM(TIM5, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 4), // S5 + DEF_TIM(TIM5, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 5), // S6 + DEF_TIM(TIM4, CH1, PD12, TIM_USE_OUTPUT_AUTO, 0, 6), // S7 + DEF_TIM(TIM4, CH2, PD13, TIM_USE_OUTPUT_AUTO, 0, 7), // S8 + + DEF_TIM(TIM15, CH1, PE5, TIM_USE_OUTPUT_AUTO, 0, 0), // S11 + DEF_TIM(TIM15, CH2, PE6, TIM_USE_OUTPUT_AUTO, 0, 0), // S12 DMA_NONE + DEF_TIM(TIM4, CH4, PD15, TIM_USE_OUTPUT_AUTO, 0, 0), // S10 DMA_NONE + DEF_TIM(TIM4, CH3, PD14, TIM_USE_OUTPUT_AUTO, 0, 0), // S9 + + +// DEF_TIM(TIM4, CH3, PD14, TIM_USE_OUTPUT_AUTO, 0, 0), // S9 +// DEF_TIM(TIM4, CH4, PD15, TIM_USE_OUTPUT_AUTO, 0, 0), // S10 DMA_NONE +// DEF_TIM(TIM15, CH1, PE5, TIM_USE_OUTPUT_AUTO, 0, 0), // S11 +// DEF_TIM(TIM15, CH2, PE6, TIM_USE_OUTPUT_AUTO, 0, 0), // S12 DMA_NONE + + DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 9), // LED_2812 + DEF_TIM(TIM2, CH1, PA15, TIM_USE_BEEPER, 0, 0), // BEEPER PWM + +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/BLADE_PRO_H7/target.h b/src/main/target/BLADE_PRO_H7/target.h new file mode 100644 index 00000000000..5c95457d6f3 --- /dev/null +++ b/src/main/target/BLADE_PRO_H7/target.h @@ -0,0 +1,233 @@ +/* + * 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 "RUSH" +#define USBD_PRODUCT_STRING "BLADE_PRO_H7" + +#define USE_TARGET_CONFIG + +#define LED0 PE3 +#define LED1 PE4 + +#define BEEPER PA15 +#define BEEPER_INVERTED +#define BEEPER_PWM_FREQUENCY 2500 + +// *************** IMU generic *********************** +#define USE_DUAL_GYRO +#define USE_TARGET_IMU_HARDWARE_DESCRIPTORS +// *************** SPI1 IMU1 MPU6000 && BMI270 && ICM42688P **************** +#define USE_SPI +#define USE_SPI_DEVICE_1 +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PD7 + +#define SPI1_NSS_PIN PC15 +#define SPI1_EXTI_PIN PB2 + +// MPU6000 +#define USE_IMU_MPU6000 +#define IMU_MPU6000_ALIGN_1 CW180_DEG +#define MPU6000_SPI_BUS_1 BUS_SPI1 +#define MPU6000_CS_PIN_1 SPI1_NSS_PIN +#define MPU6000_EXTI_PIN_1 SPI1_EXTI_PIN + +// ICM42605/ICM42688P +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN_1 CW180_DEG +#define ICM42605_SPI_BUS_1 BUS_SPI1 +#define ICM42605_CS_PIN_1 SPI1_NSS_PIN +#define ICM42605_EXTI_PIN_1 SPI1_EXTI_PIN + +//BMI270 +#define USE_IMU_BMI270 +#define IMU_BMI270_ALIGN_1 CW180_DEG +#define BMI270_SPI_BUS_1 BUS_SPI1 +#define BMI270_CS_PIN_1 SPI1_NSS_PIN +#define BMI270_EXTI_PIN_1 SPI1_EXTI_PIN + +// *************** SPI4 IMU2 BMI270 ************** +#define USE_SPI_DEVICE_4 +#define SPI4_SCK_PIN PE12 +#define SPI4_MISO_PIN PE13 +#define SPI4_MOSI_PIN PE14 + +#define SPI4_NSS_PIN PE11 +#define SPI4_EXTI_PIN PE15 + +// MPU6000 +#define USE_IMU_MPU6000 +#define IMU_MPU6000_ALIGN_2 CW270_DEG +#define MPU6000_SPI_BUS_2 BUS_SPI1 +#define MPU6000_CS_PIN_2 SPI4_NSS_PIN +#define MPU6000_EXTI_PIN_2 SPI4_EXTI_PIN + +// ICM42605/ICM42688P +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN_2 CW270_DEG +#define ICM42605_SPI_BUS_2 BUS_SPI1 +#define ICM42605_CS_PIN_2 SPI4_NSS_PIN +#define ICM42605_EXTI_PIN_2 SPI4_EXTI_PIN + +//BMI270 +#define USE_IMU_BMI270 +#define IMU_BMI270_ALIGN_2 CW270_DEG +#define BMI270_SPI_BUS_2 BUS_SPI1 +#define BMI270_CS_PIN_2 SPI4_NSS_PIN +#define BMI270_EXTI_PIN_2 SPI4_EXTI_PIN + +// *************** SPI2 OSD *********************** +#define USE_SPI_DEVICE_2 +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PB14 +#define SPI2_MOSI_PIN PB15 + +#define USE_MAX7456 +#define MAX7456_SPI_BUS BUS_SPI2 +#define MAX7456_CS_PIN PB12 + +// *************** SPI3 FLASH *********************** +#define USE_SPI_DEVICE_3 + +#define SPI3_NSS_PIN PE2 +#define SPI3_SCK_PIN PB3 +#define SPI3_MISO_PIN PB4 +#define SPI3_MOSI_PIN PB5 + +#define SPI3_SCK_AF GPIO_AF6_SPI3 +#define SPI3_MISO_AF GPIO_AF6_SPI3 +#define SPI3_MOSI_AF GPIO_AF7_SPI3 + +#define W25N01G_SPI_BUS BUS_SPI3 +#define W25N01G_CS_PIN SPI3_NSS_PIN + +#define USE_BLACKBOX +#define USE_FLASHFS +#define USE_FLASH_W25N01G +#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT + +#define USE_FLASHFS +#define USE_FLASH_M25P16 +#define M25P16_CS_PIN SPI3_NSS_PIN +#define M25P16_SPI_BUS BUS_SPI3 + +// *************** I2C /Baro/Mag ********************* +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define I2C1_SCL PB6 +#define I2C1_SDA PB7 + +#define USE_I2C_DEVICE_2 +#define I2C2_SCL PB10 +#define I2C2_SDA PB11 + +#define USE_BARO +#define BARO_I2C_BUS BUS_I2C2 +#define USE_BARO_BMP280 +#define USE_BARO_MS5611 +#define USE_BARO_DPS310 +#define USE_BARO_SPL06 + +#define USE_MAG +#define MAG_I2C_BUS BUS_I2C1 +#define USE_MAG_ALL + +#define TEMPERATURE_I2C_BUS BUS_I2C2 +#define PITOT_I2C_BUS BUS_I2C2 + +#define USE_RANGEFINDER +#define RANGEFINDER_I2C_BUS BUS_I2C2 + + +// *************** UART ***************************** +#define USE_VCP + +#define USE_UART1 +#define UART1_TX_PIN PA9 +#define UART1_RX_PIN PA10 + +#define USE_UART2 +#define UART2_TX_PIN PD5 +#define UART2_RX_PIN PD6 + +#define USE_UART3 +#define UART3_TX_PIN PD8 +#define UART3_RX_PIN PD9 + +#define USE_UART4 +#define UART4_TX_PIN PB9 +#define UART4_RX_PIN PB8 + +#define USE_UART6 +#define UART6_TX_PIN PC6 +#define UART6_RX_PIN PC7 + +#define USE_UART7 +#define UART7_TX_PIN PE8 +#define UART7_RX_PIN PE7 + +#define USE_UART8 +#define UART8_TX_PIN PE1 +#define UART8_RX_PIN PE0 + +#define SERIAL_PORT_COUNT 7 + +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS + +// *************** ADC ***************************** +#define USE_ADC +#define ADC_INSTANCE ADC1 + +#define ADC_CHANNEL_1_PIN PC0 //ADC123 VBAT1 +#define ADC_CHANNEL_2_PIN PC1 //ADC123 CURR1 +#define ADC_CHANNEL_3_PIN PC5 //ADC12 RSSI +#define ADC_CHANNEL_4_PIN PC4 //ADC12 AirS + +#define VBAT_ADC_CHANNEL ADC_CHN_1 +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2 +#define RSSI_ADC_CHANNEL ADC_CHN_3 +#define AIRSPEED_ADC_CHANNEL ADC_CHN_4 + +// *************** PINIO *************************** +#define USE_PINIO +#define USE_PINIOBOX +#define PINIO1_PIN PD10 // VTX power switcher +#define PINIO2_PIN PD11 // 2xCamera switcher + +// *************** LEDSTRIP ************************ +#define USE_LED_STRIP +#define WS2811_PIN PA8 + +#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX) +#define CURRENT_METER_SCALE 250 + +#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 15 +#define USE_DSHOT +#define USE_ESC_SENSOR From 295fa4e1dcda6b6c591cc92f9a1d8110339cb2c9 Mon Sep 17 00:00:00 2001 From: hakrc1 Date: Mon, 8 Apr 2024 09:14:44 +0800 Subject: [PATCH 3/9] deal serial conut --- src/main/target/BLADE_PRO_H7/target.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/target/BLADE_PRO_H7/target.h b/src/main/target/BLADE_PRO_H7/target.h index 5c95457d6f3..3a35511b759 100644 --- a/src/main/target/BLADE_PRO_H7/target.h +++ b/src/main/target/BLADE_PRO_H7/target.h @@ -188,7 +188,7 @@ #define UART8_TX_PIN PE1 #define UART8_RX_PIN PE0 -#define SERIAL_PORT_COUNT 7 +#define SERIAL_PORT_COUNT 8 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL #define SERIALRX_PROVIDER SERIALRX_SBUS From 8c4d8b4e4f54eff0d939336d457d201f601dea17 Mon Sep 17 00:00:00 2001 From: Sensei Date: Sun, 24 May 2026 11:27:41 -0500 Subject: [PATCH 4/9] Rename MAX to FIXED_VALUE and update description --- docs/Mixer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Mixer.md b/docs/Mixer.md index 1e3cc1369e2..6d5fa2528f0 100644 --- a/docs/Mixer.md +++ b/docs/Mixer.md @@ -82,7 +82,7 @@ Each servo mixing rule has the following parameters: | 26 | Stabilized PITCH- | Clipped between -1000 and 0 | | 27 | Stabilized YAW+ | Clipped between 0 and 1000 | | 28 | Stabilized YAW- | Clipped between -1000 and 0 | -| 29 | MAX | Constant value of 500 | +| 29 | FIXED_VALUE (MAX) | Fixed percentage of total range | The `smix reset` command removes all the existing motor mixing rules. @@ -103,4 +103,4 @@ Other usages can be: * automatic parachute deployment * VTOL and especially tail-sitters that require change in mixings during flight mode transition * crowbar airbrakes -* any kind of servo mixings that should be changed during flight \ No newline at end of file +* any kind of servo mixings that should be changed during flight From 653e6aa70b060e46c02f37a98f9889b485bb9034 Mon Sep 17 00:00:00 2001 From: Sensei Date: Sun, 24 May 2026 11:28:34 -0500 Subject: [PATCH 5/9] Correct FIXED_VALUE to FIXED-VALUE in Mixer.md --- docs/Mixer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Mixer.md b/docs/Mixer.md index 6d5fa2528f0..eb2901295a3 100644 --- a/docs/Mixer.md +++ b/docs/Mixer.md @@ -82,7 +82,7 @@ Each servo mixing rule has the following parameters: | 26 | Stabilized PITCH- | Clipped between -1000 and 0 | | 27 | Stabilized YAW+ | Clipped between 0 and 1000 | | 28 | Stabilized YAW- | Clipped between -1000 and 0 | -| 29 | FIXED_VALUE (MAX) | Fixed percentage of total range | +| 29 | FIXED-VALUE (MAX) | Fixed percentage of total range | The `smix reset` command removes all the existing motor mixing rules. From 99974d3e63e4c05e73d42006fff5c98c134f06b7 Mon Sep 17 00:00:00 2001 From: Sensei Date: Mon, 25 May 2026 12:30:11 -0500 Subject: [PATCH 6/9] Change TARGET_BOARD_IDENTIFIER to 'BLF4' and update features --- src/main/target/BLADE_F4/target.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/target/BLADE_F4/target.h b/src/main/target/BLADE_F4/target.h index 91e1b4e5305..71cf76cc0cf 100644 --- a/src/main/target/BLADE_F4/target.h +++ b/src/main/target/BLADE_F4/target.h @@ -17,7 +17,7 @@ #pragma once -#define TARGET_BOARD_IDENTIFIER "RUSH" +#define TARGET_BOARD_IDENTIFIER "BLF4" #define USBD_PRODUCT_STRING "BLADE_F4" #define USE_TARGET_CONFIG @@ -158,7 +158,7 @@ #define CURRENT_METER_SCALE 250 -#define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_OSD | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TELEMETRY | FEATURE_SOFTSERIAL ) +#define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_OSD | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TELEMETRY ) /*** Timer/PWM output ***/ #define USE_SERIAL_4WAY_BLHELI_INTERFACE From 3cf414adaf854d492a43443d7cc12d0519fca1be Mon Sep 17 00:00:00 2001 From: Sensei Date: Mon, 25 May 2026 12:31:04 -0500 Subject: [PATCH 7/9] Clean up timer definitions in target.c Removed commented-out timer definitions and adjusted the order of active timer definitions. --- src/main/target/BLADE_PRO_H7/target.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/main/target/BLADE_PRO_H7/target.c b/src/main/target/BLADE_PRO_H7/target.c index 1aeb2ef3a9d..28745e92017 100644 --- a/src/main/target/BLADE_PRO_H7/target.c +++ b/src/main/target/BLADE_PRO_H7/target.c @@ -36,10 +36,6 @@ BUSDEV_REGISTER_SPI_TAG(busdev_bmi270_1, DEVHW_BMI270, BMI270_SPI_BUS_1, B BUSDEV_REGISTER_SPI_TAG(busdev_bmi270_2, DEVHW_BMI270, BMI270_SPI_BUS_2, BMI270_CS_PIN_2, BMI270_EXTI_PIN_2, DEVFLAGS_NONE, 1, IMU_BMI270_ALIGN_2); timerHardware_t timerHardware[] = { -// DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 -// DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 1), // S2 -// DEF_TIM(TIM5, CH1, PA0, TIM_USE_OUTPUT_AUTO, 0, 2), // S3 -// DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 3), // S4 DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S2 DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 1), // S1 @@ -56,12 +52,6 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM4, CH4, PD15, TIM_USE_OUTPUT_AUTO, 0, 0), // S10 DMA_NONE DEF_TIM(TIM4, CH3, PD14, TIM_USE_OUTPUT_AUTO, 0, 0), // S9 - -// DEF_TIM(TIM4, CH3, PD14, TIM_USE_OUTPUT_AUTO, 0, 0), // S9 -// DEF_TIM(TIM4, CH4, PD15, TIM_USE_OUTPUT_AUTO, 0, 0), // S10 DMA_NONE -// DEF_TIM(TIM15, CH1, PE5, TIM_USE_OUTPUT_AUTO, 0, 0), // S11 -// DEF_TIM(TIM15, CH2, PE6, TIM_USE_OUTPUT_AUTO, 0, 0), // S12 DMA_NONE - DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 9), // LED_2812 DEF_TIM(TIM2, CH1, PA15, TIM_USE_BEEPER, 0, 0), // BEEPER PWM From ef394365aa20b9242124e33872c715de12233191 Mon Sep 17 00:00:00 2001 From: Sensei Date: Mon, 25 May 2026 12:32:18 -0500 Subject: [PATCH 8/9] Change TARGET_BOARD_IDENTIFIER and SPI bus settings --- src/main/target/BLADE_PRO_H7/target.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/target/BLADE_PRO_H7/target.h b/src/main/target/BLADE_PRO_H7/target.h index 3a35511b759..a341a504863 100644 --- a/src/main/target/BLADE_PRO_H7/target.h +++ b/src/main/target/BLADE_PRO_H7/target.h @@ -18,7 +18,7 @@ #pragma once -#define TARGET_BOARD_IDENTIFIER "RUSH" +#define TARGET_BOARD_IDENTIFIER "BLPH" #define USBD_PRODUCT_STRING "BLADE_PRO_H7" #define USE_TARGET_CONFIG @@ -46,21 +46,21 @@ // MPU6000 #define USE_IMU_MPU6000 #define IMU_MPU6000_ALIGN_1 CW180_DEG -#define MPU6000_SPI_BUS_1 BUS_SPI1 +#define MPU6000_SPI_BUS_1 BUS_SPI4 #define MPU6000_CS_PIN_1 SPI1_NSS_PIN #define MPU6000_EXTI_PIN_1 SPI1_EXTI_PIN // ICM42605/ICM42688P #define USE_IMU_ICM42605 #define IMU_ICM42605_ALIGN_1 CW180_DEG -#define ICM42605_SPI_BUS_1 BUS_SPI1 +#define ICM42605_SPI_BUS_1 BUS_SPI4 #define ICM42605_CS_PIN_1 SPI1_NSS_PIN #define ICM42605_EXTI_PIN_1 SPI1_EXTI_PIN //BMI270 #define USE_IMU_BMI270 #define IMU_BMI270_ALIGN_1 CW180_DEG -#define BMI270_SPI_BUS_1 BUS_SPI1 +#define BMI270_SPI_BUS_1 BUS_SPI4 #define BMI270_CS_PIN_1 SPI1_NSS_PIN #define BMI270_EXTI_PIN_1 SPI1_EXTI_PIN From 11c22f35bb712902b4274f2c72efb24c98b29cd0 Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Sun, 24 May 2026 21:53:50 -0500 Subject: [PATCH 9/9] fix datatype of timerCount --- src/main/fc/fc_msp.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 03a24d8f5c4..f25863b9df1 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -4527,6 +4527,48 @@ bool mspFCProcessInOutCommand(uint16_t cmdMSP, sbuf_t *dst, sbuf_t *src, mspResu *ret = MSP_RESULT_ERROR; } break; + + case MSP2_INAV_QUERY_OUTPUT_ASSIGNMENT: + { + // Build proposed overrides array (defaults to current stored overrides) + uint8_t proposedModes[HARDWARE_TIMER_DEFINITION_COUNT]; + for (int i = 0; i < HARDWARE_TIMER_DEFINITION_COUNT; i++) { + proposedModes[i] = timerOverrides(i)->outputMode; + } + + if (dataSize >= 1) { + uint8_t timerCount = sbufReadU8(src); + // Reject malformed payloads: must be exactly timerCount pairs. + if (timerCount > HARDWARE_TIMER_DEFINITION_COUNT || + sbufBytesRemaining(src) != (int)(timerCount * 2)) { + *ret = MSP_RESULT_ERROR; + break; + } + for (int i = 0; i < timerCount; i++) { + uint8_t timerId = sbufReadU8(src); + uint8_t outputMode = sbufReadU8(src); + if (timerId < HARDWARE_TIMER_DEFINITION_COUNT) { + proposedModes[timerId] = outputMode; + } + } + } + + timMotorServoHardware_t tempOut = {0}; + pwmCalculateAssignment(&tempOut, proposedModes); + + for (int m = 0; m < tempOut.maxTimMotorCount; m++) { + sbufWriteU8(dst, (uint8_t)(tempOut.timMotors[m] - timerHardware)); + sbufWriteU8(dst, OUTPUT_ASSIGNMENT_TYPE_MOTOR); + sbufWriteU8(dst, (uint8_t)(m + 1)); + } + for (int s = 0; s < tempOut.maxTimServoCount; s++) { + sbufWriteU8(dst, (uint8_t)(tempOut.timServos[s] - timerHardware)); + sbufWriteU8(dst, OUTPUT_ASSIGNMENT_TYPE_SERVO); + sbufWriteU8(dst, (uint8_t)(s + 1)); + } + *ret = MSP_RESULT_ACK; + } + break; #endif case MSP_VTXTABLE_POWERLEVEL: {