Skip to content

Commit

Permalink
update channel range
Browse files Browse the repository at this point in the history
  • Loading branch information
BlitzCityDIY committed Apr 15, 2024
1 parent d05ff91 commit 046bac4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions adafruit_adg72x.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ def channel(self):
@channel.setter
def channel(self, channel: int):
"""
Selects a single channel on the ADG72x chip. Channel numbering starts at 1.
Selects a single channel on the ADG72x chip. Channel numbering starts at 0.
:param bits: 8-bit value representing the channels to be selected/deselected.
:type bits: int
"""
bits = 1 << (channel - 1)
bits = 1 << channel
try:
with self.i2c_device as i2c:
i2c.write(bytes([bits]))
Expand All @@ -91,14 +91,14 @@ def channels(self):
@channels.setter
def channels(self, channels: typing.List[int]):
"""
Selects multiple channels on the ADG72x chip. Channel numbering starts at 1.
Selects multiple channels on the ADG72x chip.
:param channels: A list of channel numbers to be selected.
:param channels: A list of channel numbers to be selected. Channel numbering starts at 0.
:type channels: List[int]
"""
bits = 0
for channel in channels:
bits |= 1 << (channel - 1)
bits |= 1 << channel
try:
with self.i2c_device as i2c:
i2c.write(bytes([bits]))
Expand Down

0 comments on commit 046bac4

Please sign in to comment.