Skip to content

Commit 836faae

Browse files
committed
fix pressure readings
porting of arduino-libraries/Arduino_LPS22HB#2
1 parent 052d676 commit 836faae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MKRENV.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ float ENVClass::readPressure(int units)
156156
// trigger one shot
157157
i2cWrite(LPS22HB_ADDRESS, LPS22HB_CTRL2_REG, 0x01);
158158

159-
// wait for completion
160-
while ((i2cRead(LPS22HB_ADDRESS, LPS22HB_STATUS_REG) & 0x02) == 0) {
159+
// wait for ONE_SHOT bit to be cleared by the hardware
160+
while ((i2cRead(LPS22HB_ADDRESS, LPS22HB_CTRL2_REG) & 0x01) != 0) {
161161
yield();
162162
}
163163

0 commit comments

Comments
 (0)