From 91ea129be302cc35f7b3a9b8ffc869ca520cdaea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Wed, 20 Oct 2021 00:03:43 -0300 Subject: [PATCH] AP_Compass: Add support to AK09915 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- libraries/AP_Compass/AP_Compass_AK09916.cpp | 4 ++++ libraries/AP_Compass/AP_Compass_Backend.h | 1 + 2 files changed, 5 insertions(+) diff --git a/libraries/AP_Compass/AP_Compass_AK09916.cpp b/libraries/AP_Compass/AP_Compass_AK09916.cpp index fcbd93fe16..a43eb0b472 100644 --- a/libraries/AP_Compass/AP_Compass_AK09916.cpp +++ b/libraries/AP_Compass/AP_Compass_AK09916.cpp @@ -49,6 +49,7 @@ extern const AP_HAL::HAL &hal; #define ICM_WHOAMI_VAL 0xEA +#define AK09915_Device_ID 0x10 #define AK09916_Device_ID 0x09 #define AK09918_Device_ID 0x0c #define AK09916_MILLIGAUSS_SCALE 10.0f @@ -345,6 +346,9 @@ bool AP_Compass_AK09916::_check_id() /* Read AK09916's id */ if (_bus->register_read(REG_DEVICE_ID, &deviceid)) { switch (deviceid) { + case AK09915_Device_ID: + _devtype = DEVTYPE_AK09915; + return true; case AK09916_Device_ID: _devtype = DEVTYPE_AK09916; return true; diff --git a/libraries/AP_Compass/AP_Compass_Backend.h b/libraries/AP_Compass/AP_Compass_Backend.h index 00d730ede2..95b5976a18 100644 --- a/libraries/AP_Compass/AP_Compass_Backend.h +++ b/libraries/AP_Compass/AP_Compass_Backend.h @@ -66,6 +66,7 @@ public: DEVTYPE_RM3100_2 = 0x12, // unused, past mistake DEVTYPE_MMC5983 = 0x13, DEVTYPE_AK09918 = 0x14, + DEVTYPE_AK09915 = 0x15, }; #if HAL_MSP_COMPASS_ENABLED