Skip to content

Commit 9ec3438

Browse files
committed
Compatible with SensorLib v0.3.0 lewisxhe/SensorLib#22
1 parent db1b9e6 commit 9ec3438

File tree

2 files changed

+35
-11
lines changed

2 files changed

+35
-11
lines changed

src/LilyGoLib.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,17 @@ bool LilyGoLib::begin(Stream *stream)
144144
}
145145

146146
log_println("Init BMA423");
147+
#if SENSORLIB_VERSION_MINOR > 2
148+
res = SensorBMA423::begin(Wire);
149+
if (!res) {
150+
log_println("Failed to find BMA423 - check your wiring!");
151+
} else {
152+
log_println("Initializing BMA423 succeeded");
153+
SensorBMA423::setRemapAxes(REMAP_BOTTOM_LAYER_TOP_RIGHT_CORNER);
154+
setStepCounterWatermark(1);
155+
devices_probe |= WATCH_BMA_ONLINE;
156+
}
157+
#else
147158
res = SensorBMA423::init(Wire);
148159
if (!res) {
149160
log_println("Failed to find BMA423 - check your wiring!");
@@ -153,8 +164,20 @@ bool LilyGoLib::begin(Stream *stream)
153164
setStepCounterWatermark(1);
154165
devices_probe |= WATCH_BMA_ONLINE;
155166
}
167+
#endif
156168

157169
log_println("Init PCF8563 RTC");
170+
#if SENSORLIB_VERSION_MINOR > 2
171+
res = SensorPCF8563::begin(Wire);
172+
if (!res) {
173+
log_println("Failed to find PCF8563 - check your wiring!");
174+
} else {
175+
log_println("Initializing PCF8563 succeeded");
176+
SensorPCF8563::setClockOutput(SensorPCF8563::CLK_DISABLE); //Disable clock output , Conserve Backup Battery Current Consumption
177+
hwClockRead(); //Synchronize RTC clock to system clock
178+
devices_probe |= WATCH_RTC_ONLINE;
179+
}
180+
#else
158181
res = SensorPCF8563::init(Wire);
159182
if (!res) {
160183
log_println("Failed to find PCF8563 - check your wiring!");
@@ -164,15 +187,24 @@ bool LilyGoLib::begin(Stream *stream)
164187
hwClockRead(); //Synchronize RTC clock to system clock
165188
devices_probe |= WATCH_RTC_ONLINE;
166189
}
190+
#endif
167191

168192
log_println("Init DRV2605");
193+
#if SENSORLIB_VERSION_MINOR > 2
194+
res = SensorDRV2605::begin(Wire);
195+
#else
169196
res = SensorDRV2605::init(Wire);
197+
#endif
170198
if (!res) {
171199
log_println("Failed to find DRV2605 - check your wiring!");
172200
} else {
173201
log_println("Initializing DRV2605 succeeded");
174202
SensorDRV2605::selectLibrary(1);
203+
#if SENSORLIB_VERSION_MINOR > 2
204+
SensorDRV2605::setMode(SensorDRV2605::MODE_INTTRIG);
205+
#else
175206
SensorDRV2605::setMode(DRV2605_MODE_INTTRIG);
207+
#endif
176208
SensorDRV2605::useERM();
177209
SensorDRV2605::setWaveform(0, 15); // play effect
178210
SensorDRV2605::setWaveform(1, 0); // end waveform

src/LilyGoLib.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,7 @@ class LilyGoLib :
218218

219219
extern LilyGoLib watch;
220220

221-
222-
223-
224-
225-
226-
227-
228-
229-
230-
231-
221+
#if SENSORLIB_VERSION_MINOR > 2
222+
#define configreFeatureInterrupt configFeatureInterrupt
223+
#endif
232224

0 commit comments

Comments
 (0)