Skip to content

Commit 5664175

Browse files
committed
Fix coexistence with other IMU libs
1 parent d385ea0 commit 5664175

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

src/LSM6DS3.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,8 @@ int LSM6DS3Class::writeRegister(uint8_t address, uint8_t value)
208208
return 1;
209209
}
210210

211-
#ifndef LSM6DS3_SHOULDNT_DECLARE_IMU_OBJECT
212-
#ifdef ARDUINO_AVR_UNO_WIFI_REV2
213-
LSM6DS3Class IMU(SPI, SPIIMU_SS, SPIIMU_INT);
214-
#else
215-
LSM6DS3Class IMU(Wire, LSM6DS3_ADDRESS);
216-
#endif
211+
#ifdef ARDUINO_AVR_UNO_WIFI_REV2
212+
LSM6DS3Class IMU(SPI, SPIIMU_SS, SPIIMU_INT);
213+
#else
214+
LSM6DS3Class IMU_LSM6DS3(Wire, LSM6DS3_ADDRESS);
217215
#endif

src/LSM6DS3.h

+4-9
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@
2121
#include <Wire.h>
2222
#include <SPI.h>
2323

24-
#if defined __has_include
25-
#if __has_include("Arduino_LSM6DSOX.h") || __has_include("Arduino_LSM9DS1.h") || __has_include("BoschSensorClass.h")
26-
#define LSM6DS3_SHOULDNT_DECLARE_IMU_OBJECT
27-
#endif
28-
#endif
29-
3024
#define LSM6DS3_ADDRESS 0x6A
3125

3226
#define LSM6DS3_WHO_AM_I_REG 0X0F
@@ -90,6 +84,7 @@ class LSM6DS3Class {
9084

9185
SPISettings _spiSettings;
9286
};
93-
#ifndef LSM6DS3_SHOULDNT_DECLARE_IMU_OBJECT
94-
extern LSM6DS3Class IMU;
95-
#endif
87+
88+
extern LSM6DS3Class IMU_LSM6DS3;
89+
#undef IMU
90+
#define IMU IMU_LSM6DS3

0 commit comments

Comments
 (0)