Skip to content

Commit daf0105

Browse files
committed
Added compatibility with other Arduino IMU libraries
1 parent fa4fc94 commit daf0105

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/LSM6DS3.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,10 @@ int LSM6DS3Class::writeRegister(uint8_t address, uint8_t value)
207207
}
208208
return 1;
209209
}
210-
211-
#ifdef ARDUINO_AVR_UNO_WIFI_REV2
212-
LSM6DS3Class IMU(SPI, SPIIMU_SS, SPIIMU_INT);
213-
#else
214-
LSM6DS3Class IMU(Wire, LSM6DS3_ADDRESS);
215-
#endif
210+
#ifdef IMU_INCLUDED
211+
#ifdef ARDUINO_AVR_UNO_WIFI_REV2
212+
LSM6DS3Class IMU(SPI, SPIIMU_SS, SPIIMU_INT);
213+
#else
214+
LSM6DS3Class IMU(Wire, LSM6DS3_ADDRESS);
215+
#endif
216+
#endif

src/LSM6DS3.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
#include <Arduino.h>
2121
#include <Wire.h>
2222
#include <SPI.h>
23+
#include "ArduinoIMU.h"
24+
25+
#define IMU_INCLUDED !HAS_INCLUDE_IMU
2326

2427
#define LSM6DS3_ADDRESS 0x6A
2528

@@ -84,5 +87,6 @@ class LSM6DS3Class {
8487

8588
SPISettings _spiSettings;
8689
};
87-
88-
extern LSM6DS3Class IMU;
90+
#ifdef IMU_INCLUDED
91+
extern LSM6DS3Class IMU;
92+
#endif

0 commit comments

Comments
 (0)