Skip to content

Commit

Permalink
Updated comments and error messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
woolseyj committed Jun 10, 2021
1 parent 5bb78f7 commit fdae772
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions wws_74hc165.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@


class DigitalInOut:
"""Digital input/output of the 74HC165. The interface is exactly the
same as the ``digitalio.DigitalInOut`` class, however note that by design
this device is INPUT ONLY! Attempting to write outputs or set
direction as output will raise an exception.
"""Digital input/output of the 74HC165. The interface is exactly the same
as the ``digitalio.DigitalInOut`` class, however note that by design this
device is INPUT ONLY! Attempting to write outputs or set direction as
output will raise an exception.
"""

def __init__(self, pin_number, shift_register_74hc165):
Expand All @@ -62,7 +62,7 @@ def __init__(self, pin_number, shift_register_74hc165):
# pylint: disable=unused-argument
def switch_to_output(self, value=False, **kwargs): # pylint: disable=no-self-use
"""``switch_to_output`` is not supported."""
raise RuntimeError("Digital output not supported.")
raise RuntimeError("Digital output is not supported.")

def switch_to_input(self, **kwargs):
"""``DigitalInOut switch_to_input``"""
Expand All @@ -80,7 +80,7 @@ def value(self):
@value.setter
def value(self, val): # pylint: disable=no-self-use
"""``value`` setting is not supported."""
raise RuntimeError("Setting value not supported.")
raise RuntimeError("Setting value is not supported.")

@property
def direction(self):
Expand All @@ -91,23 +91,23 @@ def direction(self):
def direction(self, val): # pylint: disable=no-self-use
"""``Direction`` can only be set to ``INPUT``."""
if val != digitalio.Direction.INPUT:
raise RuntimeError("Digital output not supported.")
raise RuntimeError("Digital output is not supported.")

@property
def pull(self):
"""Pull-up/down not supported, return None for no pull-up/down."""
"""Pull-up/down is not supported, return None for no pull-up/down."""
return None

@pull.setter
def pull(self, val): # pylint: disable=no-self-use
"""Only supports null/no pull state."""
if val is not None:
raise RuntimeError("Pull-up and pull-down not supported.")
raise RuntimeError("Pull-up and pull-down is not supported.")


class ShiftRegister74HC165:
"""Initialize the 74HC165 on the specified SPI bus
and indicate the number of shift registers being used.
"""Initialize the 74HC165 on the specified SPI bus and indicate the number
of shift registers being used.
"""

def __init__(self, spi, latch, number_of_shift_registers=1):
Expand All @@ -124,10 +124,11 @@ def number_of_shift_registers(self):

@property
def gpio(self):
"""The raw GPIO input register. Each bit represents the
input value of the associated pin (0 = low, 1 = high).
"""The raw GPIO input register. Each bit represents the input value of
the associated pin (0 = low, 1 = high).
"""
# Manage latch (chip select) separately since it's values needs to be set in reverse
# Manage latch (chip select) separately since it's values needs to be
# set in reverse.
self._latch.value = True
with self._device as spi:
# pylint: disable=no-member
Expand All @@ -138,7 +139,7 @@ def gpio(self):
@gpio.setter
def gpio(self, val): # pylint: disable=no-self-use
"""``gpio`` setting is not supported."""
raise RuntimeError("Setting gpio not supported.")
raise RuntimeError("Setting gpio is not supported.")

def get_pin(self, pin):
"""Convenience function to create an instance of the DigitalInOut class
Expand Down

0 comments on commit fdae772

Please sign in to comment.