Skip to content

Commit 58c21c2

Browse files
author
joeleb
committed
Updating Wire.requestFrom() to not wait
Removing wait from Wire.requestFrom() and updating library properties to 1.0.1
1 parent 06eb77a commit 58c21c2

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

library.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name=SparkFun Si7021 Humidity and Temperature Sensor
2-
version=1.0.0
1+
name=SparkFun Si7021 Humidity and Temperature Sensor
2+
version=1.0.1
33
author=Joel@SparkFun Electronics <[email protected]>
44
maintainer=SparkFun Electronics <sparkfun.com>
5-
sentence=Library for Si7021 Humidity and Temperature Sensor.
6-
paragraph=Library for Si7021 Humidity and Temperature Sensor.
5+
sentence=Library for Si7021 Humidity and Temperature Sensor.
6+
paragraph=Library for Si7021 Humidity and Temperature Sensor.
77
category=Sensors
88
url=https://github.com/sparkfun/Si7021_Breakout
9-
architectures=*
9+
architectures=*

src/SparkFun_Si7021_Breakout_Library.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,9 @@ uint16_t Weather::makeMeasurment(uint8_t command)
198198
delay(100);
199199

200200
Wire.requestFrom(ADDRESS,nBytes);
201-
//Wait for data
202-
int counter = 0;
203-
while (Wire.available() < nBytes){
204-
delay(1);
205-
counter ++;
206-
if (counter >100){
207-
// Timeout: Sensor did not return any data
208-
return 100;
209-
}
210-
}
211-
201+
if(Wire.available() != nBytes)
202+
return 100;
203+
212204
unsigned int msb = Wire.read();
213205
unsigned int lsb = Wire.read();
214206
// Clear the last to bits of LSB to 00.

0 commit comments

Comments
 (0)