emuflight / EmuFlight

EmuFlight is flight controller software (firmware) used to fly multi-rotor craft.
GNU General Public License v3.0
458 stars 115 forks source link

[TARGET REQUEST] GEPRCF411_AIO (BMI270 version) #929

Closed atomicflag closed 1 year ago

atomicflag commented 1 year ago

Vendor/Model GEPRCF411_AIO
GEP-F411-35A AIO (F411 FC 35A 2-6S 8bits BLS ESC 25.5mm)
https://geprc.com/product/gep-f411-35a-aio-f411-fc-35a-2-6s-8bits-bls-esc-25-5mm/

This target already exists in Emuflight but as luck would have it I have an updated board with BMI270 IMU. See manufacturer's changelog: image

I managed to get a working FW from 20230606_HDZero+master+ICM426+BMI270 branch by copying relevant parts from other targets. I don't know what I'm doing but the quad flies :shrug:

Here's what I changed:

diff --git a/src/main/target/GEPRCF411_AIO/target.h b/src/main/target/GEPRCF411_AIO/target.h
index 2ebb2a9..ba262c6 100644
--- a/src/main/target/GEPRCF411_AIO/target.h
+++ b/src/main/target/GEPRCF411_AIO/target.h
@@ -38,27 +38,23 @@
 #define SPI1_MISO_PIN           PA6
 #define SPI1_MOSI_PIN           PA7

-#define MPU6000_CS_PIN          PA4
-#define MPU6000_SPI_INSTANCE    SPI1
-
-#define MPU6500_CS_PIN          PA4
-#define MPU6500_SPI_INSTANCE    SPI1
-
 #define USE_EXTI
-#define MPU_INT_EXTI            PA1
-#define USE_MPU_DATA_READY_SIGNAL

 #define USE_GYRO
-#define USE_GYRO_SPI_MPU6000
-#define GYRO_MPU6000_ALIGN      CW180_DEG
 #define USE_ACC
-#define USE_ACC_SPI_MPU6000
-#define ACC_MPU6000_ALIGN       CW180_DEG
-
-#define USE_GYRO_SPI_MPU6500
-#define GYRO_MPU6500_ALIGN      CW180_DEG
-#define USE_ACC_SPI_MPU6500
-#define ACC_MPU6500_ALIGN       CW180_DEG
+#define USE_ACCGYRO_BMI270
+#define USE_SPI_GYRO
+#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_1
+#define ACC_BMI270_ALIGN         CW270_DEG_FLIP
+#define GYRO_BMI270_ALIGN     CW270_DEG_FLIP
+#define BMI270_CS_PIN         PA4
+#define BMI270_SPI_INSTANCE      SPI1
+
+#define GYRO_1_ALIGN         CW180_DEG
+#define ACC_1_ALIGN          CW180_DEG
+#define GYRO_1_CS_PIN        PA4
+#define GYRO_1_EXTI_PIN      PA1
+#define GYRO_1_SPI_INSTANCE  SPI1

 // *************** Baro **************************
 #define USE_I2C
diff --git a/src/main/target/GEPRCF411_AIO/target.mk b/src/main/target/GEPRCF411_AIO/target.mk
index 21fb3eb..5f2d32a 100644
--- a/src/main/target/GEPRCF411_AIO/target.mk
+++ b/src/main/target/GEPRCF411_AIO/target.mk
@@ -2,10 +2,7 @@ F411_TARGETS    += $(TARGET)
 FEATURES        += VCP ONBOARDFLASH

 TARGET_SRC = \
-                       drivers/accgyro/accgyro_mpu.c \
-                       drivers/accgyro/accgyro_spi_mpu6500.c \
-            drivers/accgyro/accgyro_mpu6500.c \
-            drivers/accgyro/accgyro_spi_mpu6000.c \
+            drivers/accgyro/accgyro_spi_bmi270.c \
             drivers/barometer/barometer_bmp085.c \
             drivers/barometer/barometer_bmp280.c \
             drivers/barometer/barometer_ms5611.c \
nerdCopter commented 1 year ago

yep, that would do it :muscle: . could have kept the mpu6000 & mpu6500 as well. adding the bmi270 stuff.