X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/blobdiff_plain/a575c4ba6016c3fdedfe0e33e08ba297c7fe754d..b4be9b426d23248ba665a09d16f026dfb2f49d7e:/src/digitalio.py diff --git a/src/digitalio.py b/src/digitalio.py index 635db1e..5598d58 100644 --- a/src/digitalio.py +++ b/src/digitalio.py @@ -1,28 +1,35 @@ from machine import Pin from adafruit_blinka.agnostic import board as boardId -from adafruit_blinka import Enum,ContextManaged +from adafruit_blinka import Enum, ContextManaged class DriveMode(Enum): - PUSH_PULL=None - OPEN_DRAIN=None + PUSH_PULL = None + OPEN_DRAIN = None + + DriveMode.PUSH_PULL = DriveMode() DriveMode.OPEN_DRAIN = DriveMode() class Direction(Enum): - INPUT=None - OUTPUT=None + INPUT = None + OUTPUT = None + + Direction.INPUT = Direction() Direction.OUTPUT = Direction() class Pull(Enum): - UP=None - DOWN=None + UP = None + DOWN = None #NONE=None + + Pull.UP = Pull() Pull.DOWN = Pull() + #Pull.NONE = Pull() @@ -90,7 +97,8 @@ class DigitalInOut(ContextManaged): if hasattr(Pin, "PULL_DOWN"): self._pin.init(mode=Pin.IN, pull=Pin.PULL_DOWN) else: - raise NotImplementedError("{} unsupported on {}".format(Pull.DOWN, boardId)) + raise NotImplementedError("{} unsupported on {}".format( + Pull.DOWN, boardId)) elif pul is None: self._pin.init(mode=Pin.IN, pull=None) else: @@ -113,4 +121,5 @@ class DigitalInOut(ContextManaged): elif mod is DriveMode.PUSH_PULL: self._pin.init(mode=Pin.OUT) + # __all__ = ['DigitalInOut', 'DriveMode', 'Direction','Pull']