]> Repositories - Adafruit_Blinka-hackapet.git/blobdiff - src/digitalio.py
Fixed pylint to check all files and linted
[Adafruit_Blinka-hackapet.git] / src / digitalio.py
index 8634e411649e851252558344441743cb9f888e07..4b0036b6537f835236f5324f8bb45418a03e3ddc 100755 (executable)
@@ -61,6 +61,8 @@ from adafruit_blinka import Enum, ContextManaged
 
 
 class DriveMode(Enum):
+    """Drive Mode Enumeration"""
+
     PUSH_PULL = None
     OPEN_DRAIN = None
 
@@ -70,6 +72,8 @@ DriveMode.OPEN_DRAIN = DriveMode()
 
 
 class Direction(Enum):
+    """Direction Enumeration"""
+
     INPUT = None
     OUTPUT = None
 
@@ -79,6 +83,8 @@ Direction.OUTPUT = Direction()
 
 
 class Pull(Enum):
+    """PullUp/PullDown Enumeration"""
+
     UP = None
     DOWN = None
     # NONE=None
@@ -91,6 +97,8 @@ Pull.DOWN = Pull()
 
 
 class DigitalInOut(ContextManaged):
+    """DigitalInOut CircuitPython compatibility implementation"""
+
     _pin = None
 
     def __init__(self, pin):
@@ -98,29 +106,33 @@ class DigitalInOut(ContextManaged):
         self.direction = Direction.INPUT
 
     def switch_to_output(self, value=False, drive_mode=DriveMode.PUSH_PULL):
+        """Switch the Digital Pin Mode to Output"""
         self.direction = Direction.OUTPUT
         self.value = value
         self.drive_mode = drive_mode
 
     def switch_to_input(self, pull=None):
+        """Switch the Digital Pin Mode to Input"""
         self.direction = Direction.INPUT
         self.pull = pull
 
     def deinit(self):
+        """Deinitialize the Digital Pin"""
         del self._pin
 
     @property
     def direction(self):
+        """Get or Set the Digital Pin Direction"""
         return self.__direction
 
     @direction.setter
-    def direction(self, dir):
-        self.__direction = dir
-        if dir is Direction.OUTPUT:
+    def direction(self, value):
+        self.__direction = value
+        if value is Direction.OUTPUT:
             self._pin.init(mode=Pin.OUT)
             self.value = False
             self.drive_mode = DriveMode.PUSH_PULL
-        elif dir is Direction.INPUT:
+        elif value is Direction.INPUT:
             self._pin.init(mode=Pin.IN)
             self.pull = None
         else:
@@ -128,6 +140,7 @@ class DigitalInOut(ContextManaged):
 
     @property
     def value(self):
+        """Get or Set the Digital Pin Value"""
         return self._pin.value() == 1
 
     @value.setter
@@ -139,10 +152,10 @@ class DigitalInOut(ContextManaged):
 
     @property
     def pull(self):
+        """Get or Set the Digital Pin Direction"""
         if self.direction is Direction.INPUT:
             return self.__pull
-        else:
-            raise AttributeError("Not an input")
+        raise AttributeError("Not an input")
 
     @pull.setter
     def pull(self, pul):
@@ -166,10 +179,10 @@ class DigitalInOut(ContextManaged):
 
     @property
     def drive_mode(self):
+        """Get or Set the Digital Pin Drive Mode"""
         if self.direction is Direction.OUTPUT:
             return self.__drive_mode  #
-        else:
-            raise AttributeError("Not an output")
+        raise AttributeError("Not an output")
 
     @drive_mode.setter
     def drive_mode(self, mod):