diff --git a/make/source.mk b/make/source.mk index 5fed8a988..ed430360b 100644 --- a/make/source.mk +++ b/make/source.mk @@ -284,6 +284,7 @@ SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \ drivers/compass/compass_ak8975.c \ drivers/compass/compass_fake.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/display_ug2864hsweg01.c \ drivers/inverter.c \ drivers/light_ws2811strip.c \ diff --git a/src/main/drivers/compass/compass_qmc5883l.c b/src/main/drivers/compass/compass_qmc5883l.c new file mode 100644 index 000000000..3c1f13965 --- /dev/null +++ b/src/main/drivers/compass/compass_qmc5883l.c @@ -0,0 +1,142 @@ +/* + * 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 + +#include + +#include "platform.h" + +#ifdef USE_MAG_QMC5883 + +#include "common/axis.h" +#include "common/maths.h" +#include "common/utils.h" + +#include "drivers/bus.h" +#include "drivers/bus_i2c.h" +#include "drivers/bus_i2c_busdev.h" +#include "drivers/sensor.h" +#include "drivers/time.h" + +#include "compass.h" +#include "compass_qmc5883l.h" + +#define QMC5883L_MAG_I2C_ADDRESS 0x0D + +// Registers +#define QMC5883L_REG_CONF1 0x09 +#define QMC5883L_REG_CONF2 0x0A + +// data output rates for 5883L +#define QMC5883L_ODR_10HZ (0x00 << 2) +#define QMC5883L_ODR_50HZ (0x01 << 2) +#define QMC5883L_ODR_100HZ (0x02 << 2) +#define QMC5883L_ODR_200HZ (0x03 << 2) + +// Sensor operation modes +#define QMC5883L_MODE_STANDBY 0x00 +#define QMC5883L_MODE_CONTINUOUS 0x01 + +#define QMC5883L_RNG_2G (0x00 << 4) +#define QMC5883L_RNG_8G (0x01 << 4) + +#define QMC5883L_OSR_512 (0x00 << 6) +#define QMC5883L_OSR_256 (0x01 << 6) +#define QMC5883L_OSR_128 (0x10 << 6) +#define QMC5883L_OSR_64 (0x11 << 6) + +#define QMC5883L_RST 0x80 + +#define QMC5883L_REG_DATA_OUTPUT_X 0x00 +#define QMC5883L_REG_STATUS 0x06 + +#define QMC5883L_REG_ID 0x0D +#define QMC5883_ID_VAL 0xFF + +static bool qmc5883lInit(magDev_t *magDev) +{ + UNUSED(magDev); + + bool ack = true; + busDevice_t *busdev = &magDev->busdev; + + ack = ack && busWriteRegister(busdev, 0x0B, 0x01); + ack = ack && busWriteRegister(busdev, QMC5883L_REG_CONF1, QMC5883L_MODE_CONTINUOUS | QMC5883L_ODR_200HZ | QMC5883L_OSR_512 | QMC5883L_RNG_8G); + + if (!ack) { + return false; + } + + return true; +} + +static bool qmc5883lRead(magDev_t *magDev, int16_t *magData) +{ + uint8_t status; + uint8_t buf[6]; + + // set magData to zero for case of failed read + magData[X] = 0; + magData[Y] = 0; + magData[Z] = 0; + + busDevice_t *busdev = &magDev->busdev; + + bool ack = busReadRegisterBuffer(busdev, QMC5883L_REG_STATUS, &status, 1); + + if (!ack || (status & 0x04) == 0) { + return false; + } + + ack = busReadRegisterBuffer(busdev, QMC5883L_REG_DATA_OUTPUT_X, buf, 6); + if (!ack) { + return false; + } + + magData[X] = (int16_t)(buf[1] << 8 | buf[0]); + magData[Y] = (int16_t)(buf[3] << 8 | buf[2]); + magData[Z] = (int16_t)(buf[5] << 8 | buf[4]); + + return true; +} + +bool qmc5883lDetect(magDev_t *magDev) +{ + + busDevice_t *busdev = &magDev->busdev; + + if (busdev->bustype == BUSTYPE_I2C && busdev->busdev_u.i2c.address == 0) { + busdev->busdev_u.i2c.address = QMC5883L_MAG_I2C_ADDRESS; + } + + // Must write reset first - don't care about the result + busWriteRegister(busdev, QMC5883L_REG_CONF2, QMC5883L_RST); + delay(20); + + uint8_t sig = 0; + bool ack = busReadRegisterBuffer(busdev, QMC5883L_REG_ID, &sig, 1); + if (ack && sig == QMC5883_ID_VAL) { + magDev->init = qmc5883lInit; + magDev->read = qmc5883lRead; + return true; + } + + return false; +} +#endif diff --git a/src/main/drivers/compass/compass_qmc5883l.h b/src/main/drivers/compass/compass_qmc5883l.h new file mode 100644 index 000000000..020078d5e --- /dev/null +++ b/src/main/drivers/compass/compass_qmc5883l.h @@ -0,0 +1,23 @@ +/* + * 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 . + */ + +#pragma once + +#include "drivers/io_types.h" + +bool qmc5883lDetect(magDev_t *magDev); + diff --git a/src/main/interface/settings.c b/src/main/interface/settings.c index 7514b899d..8cd7e9ade 100644 --- a/src/main/interface/settings.c +++ b/src/main/interface/settings.c @@ -116,7 +116,7 @@ const char * const lookupTableBaroHardware[] = { #if defined(USE_SENSOR_NAMES) || defined(USE_MAG) // sync with magSensor_e const char * const lookupTableMagHardware[] = { - "AUTO", "NONE", "HMC5883", "AK8975", "AK8963" + "AUTO", "NONE", "HMC5883", "AK8975", "AK8963", "QMC5883" }; #endif #if defined(USE_SENSOR_NAMES) || defined(USE_RANGEFINDER) diff --git a/src/main/sensors/compass.c b/src/main/sensors/compass.c index 6f78f8c81..f36a0cb84 100644 --- a/src/main/sensors/compass.c +++ b/src/main/sensors/compass.c @@ -34,6 +34,7 @@ #include "drivers/compass/compass_ak8963.h" #include "drivers/compass/compass_fake.h" #include "drivers/compass/compass_hmc5883l.h" +#include "drivers/compass/compass_qmc5883l.h" #include "drivers/io.h" #include "drivers/light_led.h" @@ -83,7 +84,7 @@ void pgResetFn_compassConfig(compassConfig_t *compassConfig) #endif compassConfig->mag_i2c_device = I2C_DEV_TO_CFG(I2CINVALID); compassConfig->mag_i2c_address = 0; -#elif defined(USE_MAG_HMC5883) || defined(USE_MAG_AK8975) || (defined(USE_MAG_AK8963) && !(defined(USE_GYRO_SPI_MPU6500) || defined(USE_GYRO_SPI_MPU9250))) +#elif defined(USE_MAG_HMC5883) || defined(USE_MAG_QMC5883) || defined(USE_MAG_AK8975) || (defined(USE_MAG_AK8963) && !(defined(USE_GYRO_SPI_MPU6500) || defined(USE_GYRO_SPI_MPU9250))) compassConfig->mag_bustype = BUSTYPE_I2C; compassConfig->mag_i2c_device = I2C_DEV_TO_CFG(MAG_I2C_INSTANCE); compassConfig->mag_i2c_address = 0; @@ -180,6 +181,22 @@ bool compassDetect(magDev_t *dev) #endif FALLTHROUGH; + case MAG_QMC5883: +#ifdef USE_MAG_QMC5883 + if (busdev->bustype == BUSTYPE_I2C) { + busdev->busdev_u.i2c.address = compassConfig()->mag_i2c_address; + } + + if (qmc5883lDetect(dev)) { +#ifdef MAG_QMC5883L_ALIGN + dev->magAlign = MAG_QMC5883L_ALIGN; +#endif + magHardware = MAG_QMC5883; + break; + } +#endif + FALLTHROUGH; + case MAG_AK8975: #ifdef USE_MAG_AK8975 if (busdev->bustype == BUSTYPE_I2C) { diff --git a/src/main/sensors/compass.h b/src/main/sensors/compass.h index ec1474430..f112742e0 100644 --- a/src/main/sensors/compass.h +++ b/src/main/sensors/compass.h @@ -30,7 +30,8 @@ typedef enum { MAG_NONE = 1, MAG_HMC5883 = 2, MAG_AK8975 = 3, - MAG_AK8963 = 4 + MAG_AK8963 = 4, + MAG_QMC5883 = 5 } magSensor_e; typedef struct mag_s { diff --git a/src/main/target/ALIENFLIGHTF4/target.h b/src/main/target/ALIENFLIGHTF4/target.h index 94485a711..7c430b92d 100644 --- a/src/main/target/ALIENFLIGHTF4/target.h +++ b/src/main/target/ALIENFLIGHTF4/target.h @@ -53,6 +53,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define USE_MAG_AK8963 #define MAG_AK8963_ALIGN CW180_DEG_FLIP diff --git a/src/main/target/ALIENFLIGHTF4/target.mk b/src/main/target/ALIENFLIGHTF4/target.mk index 18a5e7586..e733398ee 100644 --- a/src/main/target/ALIENFLIGHTF4/target.mk +++ b/src/main/target/ALIENFLIGHTF4/target.mk @@ -7,5 +7,6 @@ TARGET_SRC = \ drivers/barometer/barometer_bmp280.c \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_ak8963.c \ - drivers/compass/compass_hmc5883l.c + drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c diff --git a/src/main/target/ALIENFLIGHTNGF7/target.h b/src/main/target/ALIENFLIGHTNGF7/target.h index a0637dee0..79d00b891 100644 --- a/src/main/target/ALIENFLIGHTNGF7/target.h +++ b/src/main/target/ALIENFLIGHTNGF7/target.h @@ -52,6 +52,7 @@ #define USE_MAG #define USE_MAG_HMC5883 #define USE_MAG_SPI_HMC5883 +#define USE_MAG_QMC5883 #define USE_MAG_AK8963 #define USE_MAG_SPI_AK8963 diff --git a/src/main/target/ALIENFLIGHTNGF7/target.mk b/src/main/target/ALIENFLIGHTNGF7/target.mk index ad0ca8fef..060814652 100644 --- a/src/main/target/ALIENFLIGHTNGF7/target.mk +++ b/src/main/target/ALIENFLIGHTNGF7/target.mk @@ -7,4 +7,5 @@ TARGET_SRC = \ drivers/barometer/barometer_bmp280.c \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_ak8963.c \ - drivers/compass/compass_hmc5883l.c + drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c diff --git a/src/main/target/ANYFCF7/target.h b/src/main/target/ANYFCF7/target.h index 2e98e28b3..dddd68ac6 100644 --- a/src/main/target/ANYFCF7/target.h +++ b/src/main/target/ANYFCF7/target.h @@ -45,6 +45,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define MAG_I2C_INSTANCE (I2CDEV_2) //#define MAG_HMC5883_ALIGN CW270_DEG_FLIP diff --git a/src/main/target/ANYFCF7/target.mk b/src/main/target/ANYFCF7/target.mk index 70d9e7a78..1145bf501 100644 --- a/src/main/target/ANYFCF7/target.mk +++ b/src/main/target/ANYFCF7/target.mk @@ -6,6 +6,7 @@ TARGET_SRC = \ drivers/barometer/barometer_ms5611.c \ drivers/barometer/barometer_bmp280.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/light_ws2811strip.c \ drivers/light_ws2811strip_hal.c \ drivers/max7456.c diff --git a/src/main/target/BETAFLIGHTF4/target.h b/src/main/target/BETAFLIGHTF4/target.h index 9e6312fca..f4bdbd89a 100644 --- a/src/main/target/BETAFLIGHTF4/target.h +++ b/src/main/target/BETAFLIGHTF4/target.h @@ -54,6 +54,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define USE_MAX7456 #define MAX7456_SPI_INSTANCE SPI2 diff --git a/src/main/target/BETAFLIGHTF4/target.mk b/src/main/target/BETAFLIGHTF4/target.mk index 303e78739..0db789447 100644 --- a/src/main/target/BETAFLIGHTF4/target.mk +++ b/src/main/target/BETAFLIGHTF4/target.mk @@ -8,4 +8,5 @@ TARGET_SRC = \ drivers/barometer/barometer_bmp280.c \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/max7456.c diff --git a/src/main/target/BLUEJAYF4/target.h b/src/main/target/BLUEJAYF4/target.h index 98d0acba7..4728a5e1f 100644 --- a/src/main/target/BLUEJAYF4/target.h +++ b/src/main/target/BLUEJAYF4/target.h @@ -62,6 +62,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 //#define USE_MAG_AK8963 #define HMC5883_I2C_INSTANCE I2CDEV_1 diff --git a/src/main/target/BLUEJAYF4/target.mk b/src/main/target/BLUEJAYF4/target.mk index babf74f2a..6b7d592ae 100644 --- a/src/main/target/BLUEJAYF4/target.mk +++ b/src/main/target/BLUEJAYF4/target.mk @@ -5,5 +5,6 @@ TARGET_SRC = \ drivers/accgyro/accgyro_spi_mpu6500.c \ drivers/accgyro/accgyro_mpu6500.c \ drivers/barometer/barometer_ms5611.c \ - drivers/compass/compass_hmc5883l.c + drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c diff --git a/src/main/target/COLIBRI/target.h b/src/main/target/COLIBRI/target.h index 95cbecfbf..cfc0eab85 100644 --- a/src/main/target/COLIBRI/target.h +++ b/src/main/target/COLIBRI/target.h @@ -51,6 +51,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define MAG_HMC5883_ALIGN CW270_DEG_FLIP #define MAG_INT_EXTI PC1 diff --git a/src/main/target/COLIBRI/target.mk b/src/main/target/COLIBRI/target.mk index af8364ed0..6594f8395 100644 --- a/src/main/target/COLIBRI/target.mk +++ b/src/main/target/COLIBRI/target.mk @@ -5,4 +5,5 @@ HSE_VALUE = 16000000 TARGET_SRC = \ drivers/accgyro/accgyro_spi_mpu6000.c \ drivers/barometer/barometer_ms5611.c \ - drivers/compass/compass_hmc5883l.c + drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c diff --git a/src/main/target/COLIBRI_RACE/target.h b/src/main/target/COLIBRI_RACE/target.h index 9000ecbb7..c972fc5bf 100644 --- a/src/main/target/COLIBRI_RACE/target.h +++ b/src/main/target/COLIBRI_RACE/target.h @@ -70,6 +70,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define USE_MAG_AK8963 #define USE_MAG_AK8975 diff --git a/src/main/target/COLIBRI_RACE/target.mk b/src/main/target/COLIBRI_RACE/target.mk index d1288d26a..d9346ed6a 100644 --- a/src/main/target/COLIBRI_RACE/target.mk +++ b/src/main/target/COLIBRI_RACE/target.mk @@ -12,5 +12,6 @@ TARGET_SRC = \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_ak8963.c \ drivers/compass/compass_ak8975.c \ - drivers/compass/compass_hmc5883l.c + drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c diff --git a/src/main/target/F4BY/target.h b/src/main/target/F4BY/target.h index 372f2edac..a433cf05f 100644 --- a/src/main/target/F4BY/target.h +++ b/src/main/target/F4BY/target.h @@ -48,6 +48,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define MAG_HMC5883_ALIGN CW90_DEG #define USE_BARO diff --git a/src/main/target/F4BY/target.mk b/src/main/target/F4BY/target.mk index ec2205cc5..e5c4a67fa 100644 --- a/src/main/target/F4BY/target.mk +++ b/src/main/target/F4BY/target.mk @@ -4,4 +4,5 @@ FEATURES += SDCARD VCP TARGET_SRC = \ drivers/accgyro/accgyro_spi_mpu6000.c \ drivers/barometer/barometer_ms5611.c \ - drivers/compass/compass_hmc5883l.c + drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c diff --git a/src/main/target/KAKUTEF4/target.h b/src/main/target/KAKUTEF4/target.h index 67a349abe..7e9146db2 100644 --- a/src/main/target/KAKUTEF4/target.h +++ b/src/main/target/KAKUTEF4/target.h @@ -63,6 +63,7 @@ #define USE_MAG #define USE_MAG_HMC5883 //External, connect to I2C1 +#define USE_MAG_QMC5883 #define MAG_HMC5883_ALIGN CW180_DEG #define USE_BARO diff --git a/src/main/target/KAKUTEF4/target.mk b/src/main/target/KAKUTEF4/target.mk index 3c8a3885b..8f2f2e734 100644 --- a/src/main/target/KAKUTEF4/target.mk +++ b/src/main/target/KAKUTEF4/target.mk @@ -7,4 +7,5 @@ TARGET_SRC = \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_ak8963.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/max7456.c diff --git a/src/main/target/KAKUTEF7/target.h b/src/main/target/KAKUTEF7/target.h index 48ce3e662..4f6652e29 100644 --- a/src/main/target/KAKUTEF7/target.h +++ b/src/main/target/KAKUTEF7/target.h @@ -156,6 +156,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define MAG_I2C_INSTANCE I2C_DEVICE #define SENSORS_SET (SENSOR_ACC | SENSOR_BARO) diff --git a/src/main/target/KAKUTEF7/target.mk b/src/main/target/KAKUTEF7/target.mk index 270a3d400..27e215329 100644 --- a/src/main/target/KAKUTEF7/target.mk +++ b/src/main/target/KAKUTEF7/target.mk @@ -7,6 +7,7 @@ TARGET_SRC = \ drivers/accgyro/accgyro_spi_mpu6000.c \ drivers/barometer/barometer_bmp280.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/light_ws2811strip.c \ drivers/light_ws2811strip_hal.c \ drivers/max7456.c diff --git a/src/main/target/KROOZX/target.h b/src/main/target/KROOZX/target.h index 808bcd534..7109cad1e 100644 --- a/src/main/target/KROOZX/target.h +++ b/src/main/target/KROOZX/target.h @@ -53,6 +53,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define MAG_HMC5883_ALIGN CW180_DEG #define MAG_I2C_INSTANCE I2CDEV_1 diff --git a/src/main/target/KROOZX/target.mk b/src/main/target/KROOZX/target.mk index a0bf89c18..0c294619c 100644 --- a/src/main/target/KROOZX/target.mk +++ b/src/main/target/KROOZX/target.mk @@ -6,4 +6,5 @@ TARGET_SRC = \ drivers/accgyro/accgyro_spi_mpu6000.c \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/max7456.c diff --git a/src/main/target/MATEKF405/target.h b/src/main/target/MATEKF405/target.h index 8f83bde57..fc56740e2 100644 --- a/src/main/target/MATEKF405/target.h +++ b/src/main/target/MATEKF405/target.h @@ -62,6 +62,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 // *************** Baro ************************** #define USE_I2C diff --git a/src/main/target/MATEKF405/target.mk b/src/main/target/MATEKF405/target.mk index cbb55c9a7..aeedf2ad3 100644 --- a/src/main/target/MATEKF405/target.mk +++ b/src/main/target/MATEKF405/target.mk @@ -9,4 +9,5 @@ TARGET_SRC = \ drivers/barometer/barometer_bmp280.c \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/max7456.c diff --git a/src/main/target/MATEKF722/target.h b/src/main/target/MATEKF722/target.h index 5e2aa1026..72e2f99a2 100644 --- a/src/main/target/MATEKF722/target.h +++ b/src/main/target/MATEKF722/target.h @@ -76,6 +76,7 @@ //*********** Magnetometer / Compass ************* #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 // *************** SD Card ************************** #define USE_SDCARD diff --git a/src/main/target/MATEKF722/target.mk b/src/main/target/MATEKF722/target.mk index 2b9009edf..7934b618a 100644 --- a/src/main/target/MATEKF722/target.mk +++ b/src/main/target/MATEKF722/target.mk @@ -9,4 +9,5 @@ TARGET_SRC = \ drivers/barometer/barometer_bmp280.c \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/max7456.c diff --git a/src/main/target/MICROSCISKY/target.h b/src/main/target/MICROSCISKY/target.h index 2e16f0137..e14ca9193 100644 --- a/src/main/target/MICROSCISKY/target.h +++ b/src/main/target/MICROSCISKY/target.h @@ -60,6 +60,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define MAG_HMC5883_ALIGN CW180_DEG #define USE_UART1 diff --git a/src/main/target/MICROSCISKY/target.mk b/src/main/target/MICROSCISKY/target.mk index b3f98e927..d13b57b32 100644 --- a/src/main/target/MICROSCISKY/target.mk +++ b/src/main/target/MICROSCISKY/target.mk @@ -6,4 +6,5 @@ TARGET_SRC = \ drivers/barometer/barometer_bmp085.c \ drivers/barometer/barometer_bmp280.c \ drivers/barometer/barometer_ms5611.c \ - drivers/compass/compass_hmc5883l.c + drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c diff --git a/src/main/target/MULTIFLITEPICO/target.h b/src/main/target/MULTIFLITEPICO/target.h index 48c0293dd..8acdd0c3d 100644 --- a/src/main/target/MULTIFLITEPICO/target.h +++ b/src/main/target/MULTIFLITEPICO/target.h @@ -48,6 +48,7 @@ #define USE_MAG #define USE_MAG_AK8975 #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define MAG_HMC5883_ALIGN CW270_DEG #define USE_MAG_DATA_READY_SIGNAL diff --git a/src/main/target/MULTIFLITEPICO/target.mk b/src/main/target/MULTIFLITEPICO/target.mk index 9a79fa471..f642917f9 100644 --- a/src/main/target/MULTIFLITEPICO/target.mk +++ b/src/main/target/MULTIFLITEPICO/target.mk @@ -8,4 +8,5 @@ TARGET_SRC = \ drivers/barometer/barometer_bmp085.c \ drivers/barometer/barometer_bmp280.c \ drivers/compass/compass_ak8975.c \ - drivers/compass/compass_hmc5883l.c + drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c diff --git a/src/main/target/NUCLEOF7/target.h b/src/main/target/NUCLEOF7/target.h index bcdf35b8a..f6be817c7 100644 --- a/src/main/target/NUCLEOF7/target.h +++ b/src/main/target/NUCLEOF7/target.h @@ -45,6 +45,7 @@ #define USE_MAG #define USE_FAKE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define MAG_HMC5883_ALIGN CW270_DEG_FLIP #define USE_BARO diff --git a/src/main/target/NUCLEOF7/target.mk b/src/main/target/NUCLEOF7/target.mk index 1ac226fe3..3408bae1b 100644 --- a/src/main/target/NUCLEOF7/target.mk +++ b/src/main/target/NUCLEOF7/target.mk @@ -7,4 +7,5 @@ TARGET_SRC = \ drivers/barometer/barometer_fake.c \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_fake.c \ - drivers/compass/compass_hmc5883l.c + drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c diff --git a/src/main/target/NUCLEOF722/target.h b/src/main/target/NUCLEOF722/target.h index 1eb088081..f27439691 100644 --- a/src/main/target/NUCLEOF722/target.h +++ b/src/main/target/NUCLEOF722/target.h @@ -47,6 +47,7 @@ #define USE_MAG #define USE_FAKE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define MAG_HMC5883_ALIGN CW270_DEG_FLIP #define USE_BARO diff --git a/src/main/target/NUCLEOF722/target.mk b/src/main/target/NUCLEOF722/target.mk index 0d7b8ea1d..0e8eb220b 100644 --- a/src/main/target/NUCLEOF722/target.mk +++ b/src/main/target/NUCLEOF722/target.mk @@ -8,5 +8,6 @@ TARGET_SRC = \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_fake.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/light_ws2811strip.c \ drivers/light_ws2811strip_hal.c diff --git a/src/main/target/OMNIBUSF4/target.h b/src/main/target/OMNIBUSF4/target.h index a64e67562..6d7cc1f2f 100644 --- a/src/main/target/OMNIBUSF4/target.h +++ b/src/main/target/OMNIBUSF4/target.h @@ -107,6 +107,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define MAG_HMC5883_ALIGN CW90_DEG //#define USE_MAG_NAZA // Delete this on next major release diff --git a/src/main/target/OMNIBUSF4/target.mk b/src/main/target/OMNIBUSF4/target.mk index a7a01edc5..89f1781ca 100644 --- a/src/main/target/OMNIBUSF4/target.mk +++ b/src/main/target/OMNIBUSF4/target.mk @@ -8,5 +8,6 @@ TARGET_SRC = \ drivers/barometer/barometer_bmp280.c \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/max7456.c diff --git a/src/main/target/OMNIBUSF7/target.h b/src/main/target/OMNIBUSF7/target.h index 01a04b163..bf54af94c 100644 --- a/src/main/target/OMNIBUSF7/target.h +++ b/src/main/target/OMNIBUSF7/target.h @@ -210,6 +210,7 @@ #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define SENSORS_SET (SENSOR_ACC | SENSOR_BARO) //ADC--------------------------------------- diff --git a/src/main/target/OMNIBUSF7/target.mk b/src/main/target/OMNIBUSF7/target.mk index 6d99b9e98..dc42481aa 100644 --- a/src/main/target/OMNIBUSF7/target.mk +++ b/src/main/target/OMNIBUSF7/target.mk @@ -13,6 +13,7 @@ TARGET_SRC = \ drivers/barometer/barometer_bmp280.c \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/light_ws2811strip.c \ drivers/light_ws2811strip_hal.c \ drivers/max7456.c diff --git a/src/main/target/REVO/target.h b/src/main/target/REVO/target.h index eb8570256..612d2eeea 100644 --- a/src/main/target/REVO/target.h +++ b/src/main/target/REVO/target.h @@ -147,6 +147,7 @@ // Configure MAG and BARO unconditionally. #define USE_MAG #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define MAG_HMC5883_ALIGN CW90_DEG #define USE_BARO diff --git a/src/main/target/REVO/target.mk b/src/main/target/REVO/target.mk index b2104f3c2..b45407a44 100644 --- a/src/main/target/REVO/target.mk +++ b/src/main/target/REVO/target.mk @@ -12,4 +12,5 @@ TARGET_SRC = \ drivers/barometer/barometer_ms5611.c \ drivers/barometer/barometer_bmp085.c \ drivers/barometer/barometer_bmp280.c \ - drivers/compass/compass_hmc5883l.c + drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c diff --git a/src/main/target/SPRACINGF3/target.h b/src/main/target/SPRACINGF3/target.h index d173d6e9c..7c95f5d21 100644 --- a/src/main/target/SPRACINGF3/target.h +++ b/src/main/target/SPRACINGF3/target.h @@ -111,6 +111,7 @@ #define USE_MAG #define USE_MAG_AK8975 #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define MAG_HMC5883_ALIGN CW270_DEG #define USE_MAG_DATA_READY_SIGNAL diff --git a/src/main/target/SPRACINGF3/target.mk b/src/main/target/SPRACINGF3/target.mk index 8095619d0..9ce0e8c69 100644 --- a/src/main/target/SPRACINGF3/target.mk +++ b/src/main/target/SPRACINGF3/target.mk @@ -7,7 +7,8 @@ TARGET_SRC = \ drivers/barometer/barometer_bmp085.c \ drivers/barometer/barometer_bmp280.c \ drivers/compass/compass_ak8975.c \ - drivers/compass/compass_hmc5883l.c + drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c ifeq ($(TARGET), FLIP32F3OSD) TARGET_SRC += \ diff --git a/src/main/target/SPRACINGF3MINI/target.h b/src/main/target/SPRACINGF3MINI/target.h index 8f8d7b402..38f147b9b 100644 --- a/src/main/target/SPRACINGF3MINI/target.h +++ b/src/main/target/SPRACINGF3MINI/target.h @@ -72,6 +72,7 @@ #define USE_MPU9250_MAG // Enables bypass configuration #define USE_MAG_AK8975 #define USE_MAG_HMC5883 // External +#define USE_MAG_QMC5883 #define MAG_AK8975_ALIGN CW90_DEG_FLIP #endif diff --git a/src/main/target/SPRACINGF3MINI/target.mk b/src/main/target/SPRACINGF3MINI/target.mk index 075b712d5..cbf1aa87f 100644 --- a/src/main/target/SPRACINGF3MINI/target.mk +++ b/src/main/target/SPRACINGF3MINI/target.mk @@ -8,6 +8,7 @@ TARGET_SRC = \ drivers/compass/compass_ak8963.c \ drivers/compass/compass_ak8975.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/flash_m25p16.c ifeq ($(TARGET), TINYBEEF3) diff --git a/src/main/target/SPRACINGF4EVO/target.h b/src/main/target/SPRACINGF4EVO/target.h index 82bd325ef..4b3bcb93a 100644 --- a/src/main/target/SPRACINGF4EVO/target.h +++ b/src/main/target/SPRACINGF4EVO/target.h @@ -81,6 +81,7 @@ #define USE_MAG #define USE_MAG_AK8975 #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define USE_VCP #define USE_UART1 diff --git a/src/main/target/SPRACINGF4EVO/target.mk b/src/main/target/SPRACINGF4EVO/target.mk index f53196b6b..86d4303c7 100644 --- a/src/main/target/SPRACINGF4EVO/target.mk +++ b/src/main/target/SPRACINGF4EVO/target.mk @@ -8,6 +8,7 @@ TARGET_SRC = \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_ak8975.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/max7456.c \ drivers/vtx_rtc6705.c diff --git a/src/main/target/SPRACINGF4NEO/target.h b/src/main/target/SPRACINGF4NEO/target.h index 9f3df4bed..7b20ec6fa 100644 --- a/src/main/target/SPRACINGF4NEO/target.h +++ b/src/main/target/SPRACINGF4NEO/target.h @@ -73,6 +73,7 @@ #define USE_MAG #define USE_MAG_AK8975 #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define USE_VCP #define USE_UART1 diff --git a/src/main/target/SPRACINGF4NEO/target.mk b/src/main/target/SPRACINGF4NEO/target.mk index f98d9afc3..94fafc747 100644 --- a/src/main/target/SPRACINGF4NEO/target.mk +++ b/src/main/target/SPRACINGF4NEO/target.mk @@ -8,6 +8,7 @@ TARGET_SRC = \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_ak8975.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/max7456.c \ drivers/transponder_ir.c \ drivers/vtx_rtc6705.c \ diff --git a/src/main/target/STM32F3DISCOVERY/target.h b/src/main/target/STM32F3DISCOVERY/target.h index 7670c647d..c96cae29b 100644 --- a/src/main/target/STM32F3DISCOVERY/target.h +++ b/src/main/target/STM32F3DISCOVERY/target.h @@ -152,6 +152,7 @@ #define USE_MAG_AK8963 #define USE_MAG_AK8975 #define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 #define USE_VCP #define USE_UART1 diff --git a/src/main/target/STM32F3DISCOVERY/target.mk b/src/main/target/STM32F3DISCOVERY/target.mk index f4c5fec0b..7e589a45a 100644 --- a/src/main/target/STM32F3DISCOVERY/target.mk +++ b/src/main/target/STM32F3DISCOVERY/target.mk @@ -27,5 +27,6 @@ TARGET_SRC = \ drivers/compass/compass_ak8975.c \ drivers/compass/compass_fake.c \ drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ drivers/flash_m25p16.c \ drivers/max7456.c