Skip to content

Commit e9bc113

Browse files
authored
Merge pull request #4 from kattni/cleanup
BREAKING CHANGE - cleans up spelling.
2 parents c70c7c7 + cece836 commit e9bc113

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

adafruit_ltr329_ltr303.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,29 +121,29 @@ def als_data_gain(self) -> int:
121121
@property
122122
def integration_time(self) -> int:
123123
"""ALS integration times, can be: 50, 100, 150, 200, 250,
124-
300, 350, or 400 millisec"""
124+
300, 350, or 400 milliseconds"""
125125
return _integration_times[self._integration_time]
126126

127127
@integration_time.setter
128128
def integration_time(self, int_time: int) -> None:
129129
if not int_time in _integration_times:
130130
raise RuntimeError(
131131
"Invalid integration time: must be 50, 100, 150, "
132-
"200, 250, 300, 350, or 400 millisec"
132+
"200, 250, 300, 350, or 400 milliseconds"
133133
)
134134
self._integration_time = _integration_times.index(int_time)
135135

136136
@property
137137
def measurement_rate(self) -> int:
138138
"""ALS measurement rate, must be = or > than ALS integration rate!
139-
Can be: 50, 100, 200, 500, 1000, or 2000 millisec"""
139+
Can be: 50, 100, 200, 500, 1000, or 2000 milliseconds"""
140140
return _measurement_rates[self._measurement_rate]
141141

142142
@measurement_rate.setter
143143
def measurement_rate(self, rate: int) -> None:
144144
if not rate in _measurement_rates:
145145
raise RuntimeError(
146-
"Invalid measurement rate: must be 50, 100, 200, 500, 1000, or 2000 millisec"
146+
"Invalid measurement rate: must be 50, 100, 200, 500, 1000, or 2000 milliseconds"
147147
)
148148
self._measurement_rate = _measurement_rates.index(rate)
149149

@@ -189,25 +189,25 @@ class LTR303(LTR329):
189189
threshold_high = UnaryStruct(_LTR303_REG_THRESHHIGH_LSB, "<H")
190190
threshold_low = UnaryStruct(_LTR303_REG_THRESHLOW_LSB, "<H")
191191

192-
_int_persistance = RWBits(4, _LTR303_REG_INTPERSIST, 0)
192+
_int_persistence = RWBits(4, _LTR303_REG_INTPERSIST, 0)
193193

194194
@property
195-
def int_persistance(self) -> int:
195+
def int_persistence(self) -> int:
196196
"""How long the data needs to be high/low to generate an interrupt.
197197
Setting of 1 means 'every measurement', 2 means "two in a row", etc
198198
up to 16
199199
"""
200-
return self._int_persistance + 1
200+
return self._int_persistence + 1
201201

202-
@int_persistance.setter
203-
def int_persistance(self, counts: int) -> None:
202+
@int_persistence.setter
203+
def int_persistence(self, counts: int) -> None:
204204
if not 1 <= counts <= 16:
205-
raise ValueError("Persistance counts must be 1-16")
206-
self._int_persistance = counts - 1
205+
raise ValueError("Persistence counts must be 1-16")
206+
self._int_persistence = counts - 1
207207

208208
@property
209209
def enable_int(self) -> bool:
210-
"""Whether the interupt is enabled"""
210+
"""Enable the interrupt functionality."""
211211
return self._enable_int
212212

213213
@enable_int.setter
@@ -222,7 +222,7 @@ def enable_int(self, enable: bool) -> None:
222222

223223
@property
224224
def int_polarity(self) -> bool:
225-
"""The polarity of the interupt (whether high or low is "active")"""
225+
"""The polarity of the interrupt (whether high or low is "active")"""
226226
return self._int_polarity
227227

228228
@int_polarity.setter

examples/ltr303_advancedtest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@
3535
# The interrupt output can be enabled
3636
ltr303.enable_int = True
3737
# We can also change whether the polarity is active LOW (False) or HIGH (True)
38-
ltr303.int_polarity = False
38+
ltr303.int_polarity = True
3939

4040
# Then set the low and high thresholds that would trigger an IRQ!
4141
ltr303.threshold_low = 2000 # interrupt goes off if BELOW this number
4242
ltr303.threshold_high = 40000 # or ABOVE this number!
4343
print("Interrupt thresholds:", ltr303.threshold_low, ltr303.threshold_high)
4444

4545
# Finally, we can set how many measurements must be above/below before
46-
# we trigger an IRQ - basically avoid spurious readings. A seting of 1
46+
# we trigger an IRQ - basically avoid spurious readings. A setting of 1
4747
# means every value triggers an int, 2 means two consecutive readings to
4848
# trigger... up to 16!
49-
ltr303.int_persistance = 4
49+
ltr303.int_persistence = 4
5050

5151
while True:
5252
# The sensor will let us know when the measurement time has

examples/ltr329_advancedtest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
# Can set the ALS measurement integration time, how long the sensor
2020
# 'looks' for light data. Default is 100ms.
21-
# Set to: 50, 100, 150, 200, 250, 300, 350, or 400 millisec
21+
# Set to: 50, 100, 150, 200, 250, 300, 350, or 400 milliseconds
2222
# ltr329.integration_time = 50
2323
print("LTR-329 integration time (ms):", ltr329.integration_time)
2424

2525
# Can set the ALS measurement rate, how often the data register updates
2626
# Default is 500ms. Must be equal or greater than the integration time
27-
# Set to: 50, 100, 200, 500, 1000, 2000 millisec
27+
# Set to: 50, 100, 200, 500, 1000, 2000 milliseconds
2828
# ltr329.measurement_rate = 500
2929
print("LTR-329 measurement rate (ms):", ltr329.measurement_rate)
3030

0 commit comments

Comments
 (0)