Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

Commit a670ebc

Browse files
committed
Fix HTS221 and LPS25H documentation
1 parent d42e6a5 commit a670ebc

2 files changed

Lines changed: 21 additions & 22 deletions

File tree

hts221/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ try {
6363
}
6464
```
6565

66-
If you need to read sensor values continuously, you can register the Hts221 with the system and
66+
If you need to read sensor values continuously, you can register the HTS221 with the system and
6767
listen for sensor values using the [Sensor APIs][sensors]:
6868

6969
```java

lps25h/README.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
HTS221 driver for Android Things
1+
LPS25H driver for Android Things
22
================================
33

4-
This driver supports STMicroelectronics [HTS221][product_hts221] capacitive digital sensor for
5-
relative humidity and temperature.
4+
This driver supports STMicroelectronics [LPS25H][product_lps25h] MEMS pressure sensor.
65

76
NOTE: these drivers are not production-ready. They are offered as sample
87
implementations of Android Things user space drivers for common peripherals
@@ -30,53 +29,53 @@ import com.google.android.things.contrib.driver.hts221.Lps25h;
3029

3130
// Access the environmental sensor:
3231

33-
Hts221 mHts221;
32+
Lps25h mLps25h;
3433

3534
try {
36-
mHts221 = new Hts221(i2cBusName);
35+
mLps25h = new Lps25h(i2cBusName);
3736
} catch (IOException e) {
3837
// Couldn't configure the device...
3938
}
4039

41-
// Read the current humidity:
40+
// Read the current pressure:
4241

4342
try {
44-
float humidity = mHts221.readHumidity();
43+
float pressure = mLps25h.readPressure();
4544
} catch (IOException e) {
46-
// Error reading humidity
45+
// Error reading pressure
4746
}
4847

4948
// Read the current temperature:
5049

5150
try {
52-
float temperature = mHts221.readTemperature();
51+
float temperature = mLps25h.readTemperature();
5352
} catch (IOException e) {
5453
// Error reading temperature
5554
}
5655

57-
// Close the environmental sensor when finished:
56+
// Close the pressure sensor when finished:
5857

5958
try {
60-
mHts221.close();
59+
mLps25h.close();
6160
} catch (IOException e) {
6261
// Error closing sensor
6362
}
6463
```
6564

66-
If you need to read sensor values continuously, you can register the Hts221 with the system and
65+
If you need to read sensor values continuously, you can register the LPS25H with the system and
6766
listen for sensor values using the [Sensor APIs][sensors]:
6867

6968
```java
7069
SensorManager mSensorManager = getSystemService(Context.SENSOR_SERVICE);
71-
SensorEventListener mHumidityListener = ...;
70+
SensorEventListener mPressureListener = ...;
7271
SensorEventListener mTemperatureListener = ...;
73-
Hts221SensorDriver mSensorDriver;
72+
Lps25hSensorDriver mSensorDriver;
7473

7574
mSensorManager.registerDynamicSensorCallback(new SensorManager.DynamicSensorCallback() {
7675
@Override
7776
public void onDynamicSensorConnected(Sensor sensor) {
78-
if (sensor.getType() == Sensor.TYPE_RELATIVE_HUMIDITY) {
79-
mSensorManager.registerListener(mHumidityListener, sensor,
77+
if (sensor.getType() == Sensor.TYPE_PRESSURE) {
78+
mSensorManager.registerListener(mPressureListener, sensor,
8079
SensorManager.SENSOR_DELAY_NORMAL);
8180
} else if (sensor.getType() == Sensor.TYPE_AMBIENT_TEMPERATURE) {
8281
mSensorManager.registerListener(mTemperatureListener, sensor,
@@ -86,18 +85,18 @@ mSensorManager.registerDynamicSensorCallback(new SensorManager.DynamicSensorCall
8685
});
8786

8887
try {
89-
mSensorDriver = new Hts221SensorDriver(i2cBusName);
90-
mSensorDriver.registerHumiditySensor();
88+
mSensorDriver = new Lps25hSensorDriver(i2cBusName);
89+
mSensorDriver.registerPressureSensor();
9190
mSensorDriver.registerTemperatureSensor();
9291
} catch (IOException e) {
9392
// Error configuring sensor
9493
}
9594

9695
// Unregister and close the driver when finished:
9796

98-
mSensorManager.unregisterListener(mHumidityListener);
97+
mSensorManager.unregisterListener(mPressureListener);
9998
mSensorManager.unregisterListener(mTemperatureListener);
100-
mSensorDriver.unregisterHumiditySensor();
99+
mSensorDriver.unregisterPressureSensor();
101100
mSensorDriver.unregisterTemperatureSensor();
102101
try {
103102
mSensorDriver.close();
@@ -126,6 +125,6 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
126125
License for the specific language governing permissions and limitations under
127126
the License.
128127

129-
[product_hts221]: http://www.st.com/en/mems-and-sensors/lps25h.html
128+
[product_lps25h]: http://www.st.com/en/mems-and-sensors/lps25h.html
130129
[jcenter]: https://bintray.com/google/androidthings/contrib-driver-lps25h/_latestVersion
131130
[sensors]: https://developer.android.com/guide/topics/sensors/sensors_overview.html

0 commit comments

Comments
 (0)