From 8588ec68f9caf29a934f0a87aae1687f2afe3e44 Mon Sep 17 00:00:00 2001 From: NotFastEnuf Date: Wed, 22 Jul 2020 09:15:16 -0400 Subject: [PATCH] added icm20608 support and updated bluejayf4 target --- .settings/language.settings.xml | 70 ++++++++++++++++----------------- script/targets.json | 12 ++++++ src/drivers/drv_spi_mpu6xxx.c | 12 +++++- src/targets/bluejayf4/target.h | 10 ++--- 4 files changed, 62 insertions(+), 42 deletions(-) diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 3809f4e10..dd85213c7 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -648,7 +648,7 @@ - + @@ -698,16 +698,16 @@ - + - + - + @@ -747,16 +747,16 @@ - + - + - + @@ -796,16 +796,16 @@ - + - + - + @@ -845,16 +845,16 @@ - + - + - + @@ -894,16 +894,16 @@ - + - + - + @@ -943,16 +943,16 @@ - + - + - + @@ -992,16 +992,16 @@ - + - + - + @@ -1041,16 +1041,16 @@ - + - + - + @@ -1090,16 +1090,16 @@ - + - + - + @@ -1139,16 +1139,16 @@ - + - + - + @@ -1305,16 +1305,16 @@ - + - + - + @@ -1370,7 +1370,7 @@ - + diff --git a/script/targets.json b/script/targets.json index c8cf5d4cb..bdbe50590 100644 --- a/script/targets.json +++ b/script/targets.json @@ -236,5 +236,17 @@ } } ] + }, + { + "name": "bluejayf4", + "configurations": [ + { + "name": "brushless.serial", + "defines": { + "BRUSHLESS_TARGET": "", + "RX_UNIFIED_SERIAL": "" + } + } + ] } ] \ No newline at end of file diff --git a/src/drivers/drv_spi_mpu6xxx.c b/src/drivers/drv_spi_mpu6xxx.c index 2891d9c9b..a70757f54 100644 --- a/src/drivers/drv_spi_mpu6xxx.c +++ b/src/drivers/drv_spi_mpu6xxx.c @@ -25,6 +25,14 @@ #endif #endif +#if defined(ICM20608_SPI_PORT) && defined(ICM20608_NSS) +#define MPU6XXX_SPI_PORT ICM20608_SPI_PORT +#define MPU6XXX_NSS ICM20608_NSS +#ifdef ICM20608_INT +#define MPU6XXX_INT ICM20608_INT +#endif +#endif + #define PORT spi_port_defs[MPU6XXX_SPI_PORT] #define SCLK_PIN gpio_pin_defs[PORT.sck] #define MISO_PIN gpio_pin_defs[PORT.miso] @@ -129,7 +137,7 @@ void spi_MPU6XXX_reinit_slow(void) { SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; -#if defined(ICM20601_SPI_PORT) //5.25mhz SPI +#if defined(ICM20601_SPI_PORT) || defined(ICM20608_SPI_PORT) //5.25mhz SPI SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8; #else #if defined(ICM20602_SPI_PORT) //10mhz SPI @@ -157,7 +165,7 @@ void spi_MPU6XXX_reinit_fast(void) { SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; -#if defined(ICM20601_SPI_PORT) //5.25mhz SPI +#if defined(ICM20601_SPI_PORT) || defined(ICM20608_SPI_PORT) //5.25mhz SPI SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8; #else #if defined(ICM20602_SPI_PORT) //10mhz SPI diff --git a/src/targets/bluejayf4/target.h b/src/targets/bluejayf4/target.h index 2026483f6..a94bdc82a 100644 --- a/src/targets/bluejayf4/target.h +++ b/src/targets/bluejayf4/target.h @@ -31,15 +31,15 @@ #define FPV_PORT GPIOA //GYRO -#define MPU6XXX_SPI_PORT SPI_PORT1 -#define MPU6XXX_NSS PIN_C4 -#define MPU6XXX_INT PIN_C5 +#define ICM20608_SPI_PORT SPI_PORT1 +#define ICM20608_NSS PIN_C4 +#define ICM20608_INT PIN_C5 #define USE_DUMMY_I2C -#define GYRO_ID_1 0x68 +#define GYRO_ID_1 0xAF #define GYRO_ID_2 0x73 #define GYRO_ID_3 0x78 #define GYRO_ID_4 0x71 -#define SENSOR_ROTATE_90_CCW +#define SENSOR_ROTATE_90_CW //RADIO #define USART6_INVERTER_PIN PIN_B15