From 836faaec42eac0d4368d445e9a8720983dce8e92 Mon Sep 17 00:00:00 2001 From: Riccardo Rizzo Date: Mon, 27 Jan 2020 17:17:18 +0100 Subject: [PATCH] fix pressure readings porting of https://github.com/arduino-libraries/Arduino_LPS22HB/pull/2 --- src/MKRENV.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MKRENV.cpp b/src/MKRENV.cpp index e9be577..c8aef4c 100644 --- a/src/MKRENV.cpp +++ b/src/MKRENV.cpp @@ -156,8 +156,8 @@ float ENVClass::readPressure(int units) // trigger one shot i2cWrite(LPS22HB_ADDRESS, LPS22HB_CTRL2_REG, 0x01); - // wait for completion - while ((i2cRead(LPS22HB_ADDRESS, LPS22HB_STATUS_REG) & 0x02) == 0) { + // wait for ONE_SHOT bit to be cleared by the hardware + while ((i2cRead(LPS22HB_ADDRESS, LPS22HB_CTRL2_REG) & 0x01) != 0) { yield(); }