Skip to content

Commit

Permalink
ads1x15.py: Set low threshold in method alert_start()
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-hh committed Apr 6, 2017
1 parent 26c558d commit 338900c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ads1x15.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _read_register(self, register):
return (self.temp2[0] << 8) | self.temp2[1]

def set_conv(self, rate, channel1, channel2 = None):
"""Read voltage between a channel and GND. Time depends on conversion rate."""
"""Set mode for read_rev"""
self.mode = (_CQUE_NONE | _CLAT_NONLAT |
_CPOL_ACTVLOW | _CMODE_TRAD | _RATES[rate] | _MODE_SINGLE |
_OS_SINGLE | _GAINS[self.gain] | _CHANNELS[(channel1, channel2)])
Expand All @@ -159,6 +159,7 @@ def read_rev(self):

def alert_start(self, rate, channe1l, channel2 = None, threshold_high = 0x4000):
"""Start continuous measurement, set ALERT pin on threshold."""
self._write_register(_REGISTER_LOWTHRESH, 0)
self._write_register(_REGISTER_HITHRESH, threshold_high)
self._write_register(_REGISTER_CONFIG, _CQUE_1CONV | _CLAT_LATCH |
_CPOL_ACTVLOW | _CMODE_TRAD | _RATES[rate] |
Expand Down

0 comments on commit 338900c

Please sign in to comment.