From b0d59946166a0b35e22ad8b4872e3f924364e315 Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Tue, 9 Apr 2024 08:52:36 -0500 Subject: [PATCH] [targets] MATEKRXF411/CRAZYBEEF4 add BMI270 ICM42688P --- src/main/target/BETAFLIGHTF4/target.h | 28 +++++++++---- src/main/target/BETAFLIGHTF4/target.mk | 1 + src/main/target/MATEKF411RX/target.h | 58 ++++++++++++++++++-------- src/main/target/MATEKF411RX/target.mk | 10 +++-- 4 files changed, 67 insertions(+), 30 deletions(-) diff --git a/src/main/target/BETAFLIGHTF4/target.h b/src/main/target/BETAFLIGHTF4/target.h index c3508959a8..2c46a633a5 100644 --- a/src/main/target/BETAFLIGHTF4/target.h +++ b/src/main/target/BETAFLIGHTF4/target.h @@ -20,8 +20,11 @@ #pragma once -#define TARGET_BOARD_IDENTIFIER "BFF4" -#define USBD_PRODUCT_STRING "BetaFlightF4" +#define TARGET_MANUFACTURER_IDENTIFIER "FPVM" +#define USBD_PRODUCT_STRING "BETAFLIGHTF4" + +#define FC_TARGET_MCU STM32F405 // not used in EmuF +#define TARGET_BOARD_IDENTIFIER "S405" // generic ID #define LED0_PIN PB5 @@ -32,18 +35,24 @@ // PC13 used as inverter select GPIO for UART2 #define INVERTER_PIN_UART2 PC13 -#define MPU6000_CS_PIN PA4 -#define MPU6000_SPI_INSTANCE SPI1 - #define USE_ACC #define USE_ACC_SPI_MPU6000 -#define GYRO_MPU6000_ALIGN CW180_DEG #define USE_GYRO #define USE_GYRO_SPI_MPU6000 -#define ACC_MPU6000_ALIGN CW180_DEG +#define MPU6000_CS_PIN PA4 +#define MPU6000_SPI_INSTANCE SPI1 + +#define ACC_MPU6000_ALIGN CW180_DEG +#define GYRO_MPU6000_ALIGN CW180_DEG +#define MPU6000_CS_PIN PA4 +#define MPU6000_SPI_INSTANCE SPI1 +#define ACC_BMI270_ALIGN CW180_DEG +#define GYRO_BMI270_ALIGN CW180_DEG +#define BMI270_CS_PIN PA4 +#define BMI270_SPI_INSTANCE SPI1 // MPU6000 interrupts #define USE_EXTI @@ -122,6 +131,9 @@ #define I2C2_SCL NONE // PB10, UART3_TX #define I2C2_SDA NONE // PB11, UART3_RX #define I2C_DEVICE (I2CDEV_2) +#define MAG_I2C_INSTANCE (I2CDEV_2) +#define BARO_I2C_INSTANCE (I2CDEV_2) +#define DASHBOARD_I2C_INSTANCE (I2CDEV_2) #define USE_ADC #define CURRENT_METER_ADC_PIN PC1 @@ -133,7 +145,7 @@ #define SBUS_TELEMETRY_UART SERIAL_PORT_USART2 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT -#define DEFAULT_FEATURES ( FEATURE_TELEMETRY | FEATURE_OSD ) +#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY | FEATURE_AIRMODE | FEATURE_RX_SERIAL) #define TARGET_IO_PORTA (0xffff & ~(BIT(14)|BIT(13))) #define TARGET_IO_PORTB (0xffff & ~(BIT(2))) diff --git a/src/main/target/BETAFLIGHTF4/target.mk b/src/main/target/BETAFLIGHTF4/target.mk index ca33021603..cd44e934c4 100644 --- a/src/main/target/BETAFLIGHTF4/target.mk +++ b/src/main/target/BETAFLIGHTF4/target.mk @@ -5,6 +5,7 @@ FEATURES += VCP ONBOARDFLASH TARGET_SRC = \ drivers/accgyro/accgyro_mpu.c \ drivers/accgyro/accgyro_spi_mpu6000.c \ + drivers/accgyro/accgyro_spi_bmi270.c \ drivers/barometer/barometer_bmp280.c \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_hmc5883l.c \ diff --git a/src/main/target/MATEKF411RX/target.h b/src/main/target/MATEKF411RX/target.h index 25b100780c..832ad67e72 100644 --- a/src/main/target/MATEKF411RX/target.h +++ b/src/main/target/MATEKF411RX/target.h @@ -21,19 +21,22 @@ #pragma once #if defined(CRAZYBEEF4FR) -#define TARGET_BOARD_IDENTIFIER "C4FR" -#define USBD_PRODUCT_STRING "CrazyBee F4 FR" +#define TARGET_MANUFACTURER_IDENTIFIER "HAMO" +#define USBD_PRODUCT_STRING "CRAZYBEEF4FR" #elif defined(CRAZYBEEF4FS) -#define TARGET_BOARD_IDENTIFIER "C4FS" -#define USBD_PRODUCT_STRING "CrazyBee F4 FS" +#define TARGET_MANUFACTURER_IDENTIFIER "HAMO" +#define USBD_PRODUCT_STRING "CRAZYBEEF4FS" #elif defined(CRAZYBEEF4DX) -#define TARGET_BOARD_IDENTIFIER "C4DX" -#define USBD_PRODUCT_STRING "CrazyBee F4 DX" +#define TARGET_MANUFACTURER_IDENTIFIER "HAMO" +#define USBD_PRODUCT_STRING "CRAZYBEEF4DX" #else -#define TARGET_BOARD_IDENTIFIER "M41R" -#define USBD_PRODUCT_STRING "MATEKF411RX" +#define TARGET_MANUFACTURER_IDENTIFIER "MTKS" +#define USBD_PRODUCT_STRING "MATEKF411RX" #endif +#define FC_TARGET_MCU STM32F411 // not used in EmuF +#define TARGET_BOARD_IDENTIFIER "S411" // generic ID + #define LED0_PIN PC13 #define USE_BEEPER @@ -43,6 +46,16 @@ #define USE_SPI // *************** SPI1 Gyro & ACC ********************** +#define USE_GYRO +#define USE_GYRO_SPI_MPU6000 +#define USE_GYRO_SPI_ICM20689 +#define USE_GYRO_SPI_ICM42688P +#define USE_ACC +#define USE_ACC_SPI_MPU6000 +#define USE_ACC_SPI_ICM20689 +#define USE_ACC_SPI_ICM42688P +#define USE_ACCGYRO_BMI270 + #define USE_SPI_DEVICE_1 #define SPI1_SCK_PIN PA5 #define SPI1_MISO_PIN PA6 @@ -57,27 +70,36 @@ #define MPU_INT_EXTI PA1 #define USE_MPU_DATA_READY_SIGNAL -#define USE_GYRO -#define USE_GYRO_SPI_MPU6000 -#define USE_GYRO_SPI_ICM20689 +#define ICM42688P_CS_PIN PA4 +#define ICM42688P_SPI_INSTANCE SPI1 + +#define BMI270_CS_PIN PA4 +#define BMI270_SPI_INSTANCE SPI1 #if defined(CRAZYBEEF4FS) || defined(CRAZYBEEF4FR) || defined(CRAZYBEEF4DX) -#define GYRO_MPU6000_ALIGN CW90_DEG +#define GYRO_MPU6000_ALIGN CW90_DEG #define GYRO_ICM20689_ALIGN CW90_DEG +#define GYRO_ICM42688P_ALIGN CW90_DEG +#define GYRO_BMI270_ALIGN CW90_DEG #else -#define GYRO_MPU6000_ALIGN CW180_DEG +#define GYRO_MPU6000_ALIGN CW180_DEG #define GYRO_ICM20689_ALIGN CW180_DEG +#define GYRO_ICM42688P_ALIGN CW180_DEG +#define GYRO_BMI270_ALIGN CW180_DEG #endif -#define USE_ACC -#define USE_ACC_SPI_MPU6000 -#define USE_ACC_SPI_ICM20689 + #if defined(CRAZYBEEF4FS) || defined(CRAZYBEEF4FR) || defined(CRAZYBEEF4DX) -#define ACC_MPU6000_ALIGN CW90_DEG +#define ACC_MPU6000_ALIGN CW90_DEG #define ACC_ICM20689_ALIGN CW90_DEG +#define ACC_ICM42688P_ALIGN CW90_DEG +#define ACC_BMI270_ALIGN CW90_DEG #else -#define ACC_MPU6000_ALIGN CW180_DEG +#define ACC_MPU6000_ALIGN CW180_DEG #define ACC_ICM20689_ALIGN CW180_DEG +#define ACC_ICM42688P_ALIGN CW180_DEG +#define ACC_BMI270_ALIGN CW180_DEG #endif + // *************** SPI2 OSD ***************************** #define USE_SPI_DEVICE_2 #define SPI2_SCK_PIN PB13 diff --git a/src/main/target/MATEKF411RX/target.mk b/src/main/target/MATEKF411RX/target.mk index df79c2e027..e7b567997d 100644 --- a/src/main/target/MATEKF411RX/target.mk +++ b/src/main/target/MATEKF411RX/target.mk @@ -4,14 +4,16 @@ FEATURES += VCP SDCARD TARGET_SRC = \ drivers/accgyro/accgyro_spi_mpu6000.c \ - drivers/accgyro/accgyro_spi_icm20689.c \ + drivers/accgyro/accgyro_spi_icm20689.c \ + drivers/accgyro/accgyro_spi_icm426xx.c \ + drivers/accgyro/accgyro_spi_bmi270.c \ drivers/max7456.c \ drivers/rx/rx_cc2500.c \ - rx/cc2500_common.c \ + rx/cc2500_common.c \ rx/cc2500_frsky_shared.c \ rx/cc2500_frsky_d.c \ - rx/cc2500_frsky_x.c \ - rx/cc2500_redpine.c \ + rx/cc2500_frsky_x.c \ + rx/cc2500_redpine.c \ rx/cc2500_sfhss.c ifeq ($(TARGET), CRAZYBEEF4FS) TARGET_SRC += \