]> Repositories - hackapet/Adafruit_Blinka.git/blobdiff - python/mcp/__init__.py
Moved pin_count out of board into proper place in microcontroller hierarchy
[hackapet/Adafruit_Blinka.git] / python / mcp / __init__.py
index d52c0b9cfe635834f58b595fb68d28c85809cb2e..a8c4a84f5146dac324115ba420d9e55958ec7aba 100644 (file)
@@ -1,8 +1,17 @@
-class Enum(object):
+"""Module providing runtime utility objects to support the Micro/CircuitPython api"""
 
+class Enum(object):
+    """
+        Object supporting CircuitPython-style of static symbols
+        as seen with Direction.OUTPUT, Pull.UP
+    """
 
     @classmethod
     def iteritems(cls):
+        """
+            Inspects attributes of the class for instances of the class
+            and returns as key,value pairs mirroring dict#iteritems
+        """
         for key in dir(cls):
             val = getattr(cls, key)
             if type(val) is cls:
@@ -11,11 +20,18 @@ class Enum(object):
 
     def __repr__(self):
         """
-        Assumes instance will be found as attribute of own
-        class. Returns dot-subscripted path to instance
+        Assumes instance will be found as attribute of own class.
+        Returns dot-subscripted path to instance
+        (assuming absolute import of containing package)
         """
         cls = type(self)
         for key in dir(cls):
             if getattr(cls, key) is self:
                 return "{}.{}.{}".format(cls.__module__, cls.__qualname__, key)
-        return repr(self)
\ No newline at end of file
+        return repr(self)
+
+class Pin(Enum):
+    def __init__(self, id):
+        """ id type is likely platform-specific"""
+        self.id = id
+    pass