Skip to content

Commit

Permalink
Update doc strings to be more (hopefully) clear and informative.
Browse files Browse the repository at this point in the history
  • Loading branch information
yacobucci committed Jan 8, 2025
1 parent 1b48187 commit 82262a0
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions adafruit_tsl2591.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,11 @@ def clear_interrupt(self, operation: int) -> None:

def enable_interrupt(self, interrupts: int) -> None:
"""Enable interrupts on device. ENABLE_NPIEN will turn on No Persist interrupts, these
bypass the persist filter and assert immediately. ENABLE_AIEN will assert after their
threshold values have exceeded the persist filter cycle constraints. The device powers
on with thresholds at 0, meaning enabling interrupts may cause an immediate assertion.
bypass the persist filter and assert immediately when values are detected above the high
threshold or below the low threshold. Similarly, ENABLE_AIEN will assert at the respective
ALS thresholds, but only after the values persist longer than the persist filter cycle
duration. The device powers on with thresholds at 0, meaning enabling interrupts may
cause an immediate assertion.
Can be a value of:
- ``ENABLE_NPIEN``
- ``ENABLE_AIEN``
Expand Down Expand Up @@ -293,8 +295,8 @@ def integration_time(self, val: int) -> None:

@property
def threshold_low(self) -> int:
"""Get and set the ALS interrupt low threshold bytes. If the detected value exceeds
threshold for the number of persist cycles an interrupt will be triggered.
"""Get and set the ALS interrupt low threshold bytes. If the detected value is below
the low threshold for the number of persist filter cycles an interrupt will be triggered.
Can be 16-bit value."""
th_low = self._read_u16LE(_TSL2591_AILTL)
return th_low
Expand All @@ -308,8 +310,8 @@ def threshold_low(self, value: int) -> None:

@property
def threshold_high(self) -> int:
"""Get and set the ALS interrupt high threshold bytes. If the detected value exceeds
threshold for the number of persist cycles an interrupt will be triggered.
"""Get and set the ALS interrupt high threshold bytes. If the detected value is above
the high threshold for the number of persist filter cycles an interrupt will be triggered.
Can be 16-bit value."""
th_high = self._read_u16LE(_TSL2591_AIHTL)
return th_high
Expand All @@ -324,7 +326,8 @@ def threshold_high(self, value: int) -> None:
@property
def nopersist_threshold_low(self) -> int:
"""Get and set the No Persist ALS low threshold bytes. An interrupt will be triggered
immediately once threshold is exceeded. Can be 16-bit value."""
immediately once the detected value is below the low threshold. Can be 16-bit value.
"""
np_th_low = self._read_u16LE(_TSL2591_NPAILTL)
return np_th_low

Expand All @@ -338,7 +341,8 @@ def nopersist_threshold_low(self, value: int) -> None:
@property
def nopersist_threshold_high(self) -> int:
"""Get and set the No Persist ALS high threshold bytes. An interrupt will be triggered
immediately once theshold is exceeded. Can be 16-bit value."""
immediately once the detected value is above the high threshold. Can be 16-bit value.
"""
np_th_high = self._read_u16LE(_TSL2591_NPAIHTL)
return np_th_high

Expand All @@ -351,7 +355,7 @@ def nopersist_threshold_high(self, value: int) -> None:

@property
def persist(self) -> int:
"""Get and set the interrupt persistence filter - the number of consecutive out-of-range
"""Get and set the interrupt persist filter - the number of consecutive out-of-range
ALS cycles necessary to generate an interrupt."""
persist = self._read_u8(_TSL2591_PERSIST_FILTER)
return persist & 0x0F
Expand Down

0 comments on commit 82262a0

Please sign in to comment.