diff --git a/adafruit_seesaw/digitalio.py b/adafruit_seesaw/digitalio.py index 764c259..89cd64d 100644 --- a/adafruit_seesaw/digitalio.py +++ b/adafruit_seesaw/digitalio.py @@ -45,7 +45,7 @@ def __init__(self, seesaw, pin): self._seesaw = seesaw self._pin = pin self._drive_mode = digitalio.DriveMode.PUSH_PULL - self._direction = False + self._direction = digitalio.Direction.INPUT self._pull = None self._value = False @@ -62,8 +62,8 @@ def switch_to_output(self, value=False, drive_mode=digitalio.DriveMode.PUSH_PULL def switch_to_input(self, pull=None): """Switch the pin to input mode""" if pull == digitalio.Pull.DOWN: - raise ValueError("Pull Down currently not supported") - if pull == digitalio.Pull.UP: + self._seesaw.pin_mode(self._pin, self._seesaw.INPUT_PULLDOWN) + elif pull == digitalio.Pull.UP: self._seesaw.pin_mode(self._pin, self._seesaw.INPUT_PULLUP) else: self._seesaw.pin_mode(self._pin, self._seesaw.INPUT) @@ -117,8 +117,8 @@ def pull(self, mode): if self._direction == digitalio.Direction.OUTPUT: raise AttributeError("cannot set pull on an output pin") if mode == digitalio.Pull.DOWN: - raise ValueError("Pull Down currently not supported") - if mode == digitalio.Pull.UP: + self._seesaw.pin_mode(self._pin, self._seesaw.INPUT_PULLDOWN) + elif mode == digitalio.Pull.UP: self._seesaw.pin_mode(self._pin, self._seesaw.INPUT_PULLUP) elif mode is None: self._seesaw.pin_mode(self._pin, self._seesaw.INPUT) diff --git a/adafruit_seesaw/seesaw.py b/adafruit_seesaw/seesaw.py index 5824a7d..ff3bce3 100644 --- a/adafruit_seesaw/seesaw.py +++ b/adafruit_seesaw/seesaw.py @@ -277,6 +277,7 @@ def _pin_mode_bulk_x(self, capacity, offset, pins, mode): self.write(_GPIO_BASE, _GPIO_DIRSET_BULK, cmd) elif mode == self.INPUT: self.write(_GPIO_BASE, _GPIO_DIRCLR_BULK, cmd) + self.write(_GPIO_BASE, _GPIO_PULLENCLR, cmd) elif mode == self.INPUT_PULLUP: self.write(_GPIO_BASE, _GPIO_DIRCLR_BULK, cmd)