Skip to content

Commit 95e59d4

Browse files
committed
Updating docs.
1 parent 71534e4 commit 95e59d4

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

adafruit_mcp9600.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ class MCP9600:
104104

105105
# STATUS - 0x4
106106
burst_complete = RWBit(0x4, 7)
107-
"""Burst complete"""
107+
"""Burst complete."""
108108
temperature_update = RWBit(0x4, 6)
109-
"""Temperature update"""
109+
"""Temperature update."""
110110
input_range = ROBit(0x4, 4)
111-
"""Input range"""
111+
"""Input range."""
112112
alert_1 = ROBit(0x4, 0)
113113
"""Alert 1 status."""
114114
alert_2 = ROBit(0x4, 1)
@@ -203,7 +203,8 @@ def alert_config(self, *, alert_number, alert_temp_source, alert_temp_limit, ale
203203
204204
:param int alert_number: The alert pin number. Must be 1-4.
205205
:param alert_temp_source: The temperature source to monitor for the alert. Options are:
206-
``THERMOCOUPLE`` or ``AMBIENT``.
206+
``THERMOCOUPLE`` (hot-junction) or ``AMBIENT`` (cold-junction).
207+
Temperatures are in Celsius.
207208
:param float alert_temp_limit: The temperature in degrees Celsius at which the alert should
208209
trigger. For rising temperatures, the alert will trigger when
209210
the temperature rises above this limit. For falling
@@ -216,8 +217,11 @@ def alert_config(self, *, alert_number, alert_temp_source, alert_temp_limit, ale
216217
:param alert_temp_direction: The direction the temperature must change to trigger the alert.
217218
Options are ``RISING`` (heating up) or ``FALLING`` (cooling
218219
down).
219-
:param alert_mode: The alert mode. Options are ``COMPARATOR`` or ``INTERRUPT``. If setting
220-
mode to ``INTERRUPT``, use ``alert_interrupt_clear`` to clear the
220+
:param alert_mode: The alert mode. Options are ``COMPARATOR`` or ``INTERRUPT``. In
221+
comparator mode, the pin will follow the alert, so if the temperature
222+
drops, for example, the alert pin will go back low. In interrupt mode,
223+
by comparison, once the alert goes off, you must manually clear it. If
224+
setting mode to ``INTERRUPT``, use ``alert_interrupt_clear`` to clear the
221225
interrupt flag.
222226
:param alert_state: Alert pin output state. Options are ``ACTIVE_HIGH`` or ``ACTIVE_LOW``.
223227
@@ -258,11 +262,25 @@ def alert_config(self, *, alert_number, alert_temp_source, alert_temp_limit, ale
258262

259263
def alert_disable(self, alert_number):
260264
"""Configuring an alert using ``alert_config()`` enables the specified alert by default.
261-
Use ``alert_disable`` to disable an alert pin."""
265+
Use ``alert_disable`` to disable an alert pin.
266+
267+
:param int alert_number: The alert pin number. Must be 1-4.
268+
269+
"""
270+
if alert_number not in (1, 2, 3, 4):
271+
raise ValueError("Alert pin number must be 1-4.")
262272
setattr(self, '_alert_%d_enable' % alert_number, False)
263273

264274
def alert_interrupt_clear(self, alert_number, interrupt_clear=True):
265-
"""Setting ``interrupt_clear==True`` clears the interrupt flag."""
275+
"""Turns off the alert flag in the MCP9600, and clears the pin state (not used if the alert
276+
is in comparator mode). Required when ``alert_mode`` is ``INTERRUPT``.
277+
278+
:param int alert_number: The alert pin number. Must be 1-4.
279+
:param bool interrupt_clear: The bit to write the interrupt state flag
280+
281+
"""
282+
if alert_number not in (1, 2, 3, 4):
283+
raise ValueError("Alert pin number must be 1-4.")
266284
setattr(self, '_alert_%d_interrupt_clear' % alert_number, interrupt_clear)
267285

268286
@property

0 commit comments

Comments
 (0)