File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -86,8 +86,8 @@ int ENVClass::begin()
86
86
87
87
readHTS221Calibration ();
88
88
89
- // enable HTS221
90
- i2cWrite (HTS221_ADDRESS, HTS221_CTRL1_REG, 0x80 );
89
+ // turn on the HTS221 and enable Block Data Update
90
+ i2cWrite (HTS221_ADDRESS, HTS221_CTRL1_REG, 0x84 );
91
91
92
92
// configure VEML6075 for 100 ms
93
93
i2cWriteWord (VEML6075_ADDRESS, VEML6075_UV_CONF_REG, 0x0010 );
@@ -111,6 +111,9 @@ void ENVClass::end()
111
111
112
112
float ENVClass::readTemperature (int units)
113
113
{
114
+ // Wait for ONE_SHOT bit to be cleared by the hardware
115
+ while (i2cRead (HTS221_ADDRESS, HTS221_CTRL2_REG) & 0x01 );
116
+
114
117
// trigger one shot
115
118
i2cWrite (HTS221_ADDRESS, HTS221_CTRL2_REG, 0x01 );
116
119
@@ -131,6 +134,9 @@ float ENVClass::readTemperature(int units)
131
134
132
135
float ENVClass::readHumidity ()
133
136
{
137
+ // Wait for ONE_SHOT bit to be cleared by the hardware
138
+ while (i2cRead (HTS221_ADDRESS, HTS221_CTRL2_REG) & 0x01 );
139
+
134
140
// trigger one shot
135
141
i2cWrite (HTS221_ADDRESS, HTS221_CTRL2_REG, 0x01 );
136
142
You can’t perform that action at this time.
0 commit comments