41
41
class HDC302x :
42
42
"""Driver for the HDC302x temperature and humidity sensor."""
43
43
44
+ # Auto modes
44
45
AUTO_MODES : Dict [str , int ] = {
45
46
"5MPS_LP0" : 0x2032 ,
46
47
"5MPS_LP1" : 0x2024 ,
@@ -64,7 +65,7 @@ class HDC302x:
64
65
"10MPS_LP3" : 0x27FF ,
65
66
"EXIT_AUTO_MODE" : 0x3093 ,
66
67
}
67
-
68
+ # Heater power options
68
69
HEATER_POWERS : Dict [str , int ] = {
69
70
"OFF" : 0x0000 ,
70
71
"QUARTER_POWER" : 0x009F ,
@@ -85,7 +86,7 @@ def __init__(self, i2c_bus: busio.I2C, address: int = 0x44) -> None:
85
86
@property
86
87
def heater (self ) -> bool :
87
88
"""
88
- Check if the heater is on.
89
+ Heater power
89
90
90
91
:return: True if the heater is on, False otherwise.
91
92
"""
@@ -95,8 +96,6 @@ def heater(self) -> bool:
95
96
@heater .setter
96
97
def heater (self , power : str ) -> None :
97
98
"""
98
- Set the heater power.
99
-
100
99
:param power: The heater power level.
101
100
"""
102
101
if power not in self .HEATER_POWERS :
@@ -130,7 +129,7 @@ def manufacturer_id(self) -> int:
130
129
@property
131
130
def nist_id (self ) -> List [int ]:
132
131
"""
133
- Get the NIST ID of the sensor.
132
+ NIST ID of the sensor.
134
133
135
134
:return: NIST ID as a list of integers.
136
135
"""
@@ -149,7 +148,7 @@ def nist_id(self) -> List[int]:
149
148
@property
150
149
def auto_mode (self ) -> int :
151
150
"""
152
- Current auto mode.
151
+ Auto mode for measurements .
153
152
154
153
:return: The current auto mode.
155
154
"""
@@ -158,8 +157,6 @@ def auto_mode(self) -> int:
158
157
@auto_mode .setter
159
158
def auto_mode (self , mode : int ) -> None :
160
159
"""
161
- Set the auto mode.
162
-
163
160
:param mode: The auto mode to set.
164
161
"""
165
162
if mode not in self .AUTO_MODES :
@@ -171,7 +168,7 @@ def auto_mode(self, mode: int) -> None:
171
168
@property
172
169
def offsets (self ) -> Tuple [float , float ]:
173
170
"""
174
- Get the temperature and humidity offsets.
171
+ Set temperature and relative humidity offsets
175
172
176
173
:return: The temperature and humidity offsets.
177
174
"""
@@ -185,8 +182,6 @@ def offsets(self) -> Tuple[float, float]:
185
182
@offsets .setter
186
183
def offsets (self , temp : float , humid : float ) -> None :
187
184
"""
188
- Set the temperature and humidity offsets.
189
-
190
185
:param values: A tuple containing the temperature and humidity offsets.
191
186
"""
192
187
rh_offset = self ._calculate_offset (humid , False )
@@ -197,7 +192,7 @@ def offsets(self, temp: float, humid: float) -> None:
197
192
@property
198
193
def auto_temperature (self ) -> float :
199
194
"""
200
- Get the temperature in auto mode.
195
+ Read temperature in auto mode.
201
196
202
197
:return: The temperature in degrees Celsius.
203
198
"""
@@ -207,7 +202,7 @@ def auto_temperature(self) -> float:
207
202
@property
208
203
def auto_relative_humidity (self ) -> float :
209
204
"""
210
- Get the relative humidity in auto mode.
205
+ Read relative humidity in auto mode.
211
206
212
207
:return: The relative humidity in percent.
213
208
"""
0 commit comments