@@ -104,11 +104,11 @@ class MCP9600:
104
104
105
105
# STATUS - 0x4
106
106
burst_complete = RWBit (0x4 , 7 )
107
- """Burst complete"""
107
+ """Burst complete. """
108
108
temperature_update = RWBit (0x4 , 6 )
109
- """Temperature update"""
109
+ """Temperature update. """
110
110
input_range = ROBit (0x4 , 4 )
111
- """Input range"""
111
+ """Input range. """
112
112
alert_1 = ROBit (0x4 , 0 )
113
113
"""Alert 1 status."""
114
114
alert_2 = ROBit (0x4 , 1 )
@@ -203,7 +203,8 @@ def alert_config(self, *, alert_number, alert_temp_source, alert_temp_limit, ale
203
203
204
204
:param int alert_number: The alert pin number. Must be 1-4.
205
205
: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.
207
208
:param float alert_temp_limit: The temperature in degrees Celsius at which the alert should
208
209
trigger. For rising temperatures, the alert will trigger when
209
210
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
216
217
:param alert_temp_direction: The direction the temperature must change to trigger the alert.
217
218
Options are ``RISING`` (heating up) or ``FALLING`` (cooling
218
219
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
221
225
interrupt flag.
222
226
:param alert_state: Alert pin output state. Options are ``ACTIVE_HIGH`` or ``ACTIVE_LOW``.
223
227
@@ -258,11 +262,25 @@ def alert_config(self, *, alert_number, alert_temp_source, alert_temp_limit, ale
258
262
259
263
def alert_disable (self , alert_number ):
260
264
"""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." )
262
272
setattr (self , '_alert_%d_enable' % alert_number , False )
263
273
264
274
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." )
266
284
setattr (self , '_alert_%d_interrupt_clear' % alert_number , interrupt_clear )
267
285
268
286
@property
0 commit comments