15
15
16
16
**Hardware:**
17
17
18
- * `HTS221 Breakout <https://www.adafruit.com/products/4535>`_
18
+ * `Adafruit HTS221 - Temperature & Humidity
19
+ Sensor Breakout Board <https://www.adafruit.com/products/4535>`_
19
20
20
21
**Software and Dependencies:**
21
22
* Adafruit CircuitPython firmware for the supported boards:
@@ -65,7 +66,7 @@ class CV:
65
66
66
67
@classmethod
67
68
def add_values (cls , value_tuples ):
68
- "creates CV entires "
69
+ """ creates CV entries"" "
69
70
cls .string = {}
70
71
cls .lsb = {}
71
72
@@ -77,12 +78,12 @@ def add_values(cls, value_tuples):
77
78
78
79
@classmethod
79
80
def is_valid (cls , value ):
80
- "Returns true if the given value is a member of the CV"
81
+ """ Returns true if the given value is a member of the CV"" "
81
82
return value in cls .string
82
83
83
84
84
85
class Rate (CV ):
85
- """Options for `` data_rate` `
86
+ """Options for :attr:` data_rate`
86
87
87
88
+-----------------------+------------------------------------------------------------------+
88
89
| Rate | Description |
@@ -115,7 +116,32 @@ class Rate(CV):
115
116
class HTS221 : # pylint: disable=too-many-instance-attributes
116
117
"""Library for the ST HTS221 Humidity and Temperature Sensor
117
118
118
- :param ~busio.I2C i2c_bus: The I2C bus the HTS221HB is connected to.
119
+ :param ~busio.I2C i2c_bus: The I2C bus the HTS221 is connected to
120
+
121
+
122
+ **Quickstart: Importing and using the HTS221**
123
+
124
+ Here is an example of using the :class:`HTS221` class.
125
+ First you will need to import the libraries to use the sensor
126
+
127
+ .. code-block:: python
128
+
129
+ import board
130
+ import adafruit_hts221
131
+
132
+ Once this is done you can define your `board.I2C` object and define your sensor object
133
+
134
+ .. code-block:: python
135
+
136
+ i2c = board.I2C() # uses board.SCL and board.SDA
137
+ hts = adafruit_hts221.HTS221(i2c)
138
+
139
+ Now you have access to the :attr:`temperature` and :attr:`relative_humidity` attributes
140
+
141
+ .. code-block:: python
142
+
143
+ temperature = hts.temperature
144
+ relative_humidity = hts.relative_humidity
119
145
120
146
"""
121
147
@@ -203,7 +229,7 @@ def relative_humidity(self):
203
229
204
230
@property
205
231
def temperature (self ):
206
- """The current temperature measurement in degrees C """
232
+ """The current temperature measurement in degrees Celsius """
207
233
208
234
calibrated_value_delta = self .calibrated_value_1 - self .calib_temp_value_0
209
235
calibrated_measurement_delta = self .calib_temp_meas_1 - self .calib_temp_meas_0
@@ -222,10 +248,11 @@ def temperature(self):
222
248
223
249
@property
224
250
def data_rate (self ):
225
- """The rate at which the sensor measures ``relative_humidity`` and ``temperature``.
226
- ``data_rate`` should be set to one of the values of ``adafruit_hts221.Rate``. Note that
227
- setting ``data_rate`` to ``Rate.ONE_SHOT`` will cause ``relative_humidity`` and
228
- ``temperature`` measurements to only update when ``take_measurements`` is called."""
251
+ """The rate at which the sensor measures :attr:`relative_humidity` and :attr:`temperature`.
252
+ :attr:`data_rate` should be set to one of the values of :class:`adafruit_hts221.Rate`.
253
+ Note that setting :attr:`data_rate` to ``Rate.ONE_SHOT`` will cause
254
+ :attr:`relative_humidity` and :attr:`temperature` measurements to only
255
+ update when :meth:`take_measurements` is called."""
229
256
return self ._data_rate
230
257
231
258
@data_rate .setter
@@ -246,8 +273,8 @@ def temperature_data_ready(self):
246
273
return self ._temperature_status_bit
247
274
248
275
def take_measurements (self ):
249
- """Update the value of `` relative_humidity`` and `` temperature` ` by taking a single
250
- measurement. Only meaningful if `` data_rate` ` is set to ``ONE_SHOT``"""
276
+ """Update the value of :attr:` relative_humidity` and :attr:` temperature` by taking a single
277
+ measurement. Only meaningful if :attr:` data_rate` is set to ``ONE_SHOT``"""
251
278
self ._one_shot_bit = True
252
279
while self ._one_shot_bit :
253
280
pass
0 commit comments