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 @@ -56,8 +56,8 @@ int HTS221Class::begin()
56
56
57
57
readHTS221Calibration ();
58
58
59
- // enable HTS221
60
- i2cWrite (HTS221_CTRL1_REG, 0x80 );
59
+ // turn on the HTS221 and enable Block Data Update
60
+ i2cWrite (HTS221_CTRL1_REG, 0x84 );
61
61
62
62
return 1 ;
63
63
}
@@ -72,6 +72,9 @@ void HTS221Class::end()
72
72
73
73
float HTS221Class::readTemperature (int units)
74
74
{
75
+ // Wait for ONE_SHOT bit to be cleared by the hardware
76
+ while (HTS221_CTRL2_REG) & 0x01 );
77
+
75
78
// trigger one shot
76
79
i2cWrite (HTS221_CTRL2_REG, 0x01 );
77
80
@@ -92,6 +95,9 @@ float HTS221Class::readTemperature(int units)
92
95
93
96
float HTS221Class::readHumidity ()
94
97
{
98
+ // Wait for ONE_SHOT bit to be cleared by the hardware
99
+ while (HTS221_CTRL2_REG) & 0x01 );
100
+
95
101
// trigger one shot
96
102
i2cWrite (HTS221_CTRL2_REG, 0x01 );
97
103
You can’t perform that action at this time.
0 commit comments