mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-24 16:55:29 +03:00
Detect LIS3MDL in either address configuration
This commit is contained in:
parent
9ddc2f782f
commit
d7addd5cc0
3 changed files with 11 additions and 1 deletions
|
@ -103,6 +103,7 @@ typedef enum {
|
|||
DEVHW_QMC5883,
|
||||
DEVHW_MAG3110,
|
||||
DEVHW_LIS3MDL,
|
||||
DEVHW_LIS3MDL_A2,
|
||||
|
||||
/* OSD chips */
|
||||
DEVHW_MAX7456,
|
||||
|
|
|
@ -189,6 +189,15 @@ bool lis3mdlDetect(magDev_t * mag)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!deviceDetect(mag)) {
|
||||
busDeviceDeInit(mag->busDev);
|
||||
mag->busDev = busDeviceInit(BUSTYPE_I2C, DEVHW_LIS3MDL_A2, mag->magSensorToUse, OWNER_COMPASS);
|
||||
if (mag->busDev == NULL) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!deviceDetect(mag)) {
|
||||
busDeviceDeInit(mag->busDev);
|
||||
return false;
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
#define LIS3MDL_I2C_BUS MAG_I2C_BUS
|
||||
#endif
|
||||
BUSDEV_REGISTER_I2C(busdev_lis3mdl, DEVHW_LIS3MDL, LIS3MDL_I2C_BUS, 0x1E, NONE, DEVFLAGS_NONE);
|
||||
// BUSDEV_REGISTER_I2C(busdev_lis3mdl, DEVHW_LIS3MDL, LIS3MDL_I2C_BUS, 0x1C, NONE, DEVFLAGS_NONE);
|
||||
BUSDEV_REGISTER_I2C(busdev_lis3mdl_a2, DEVHW_LIS3MDL_A2, LIS3MDL_I2C_BUS, 0x1C, NONE, DEVFLAGS_NONE);
|
||||
#endif
|
||||
|
||||
#if defined(USE_MAG_IST8310)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue