add io option to Pin
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 20 Mar 2018 16:12:36 +0000 (16:12 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 20 Mar 2018 16:12:36 +0000 (16:12 +0000)
src/interface_decl.py

index c66098e55c016696ffeda2d86d53c93c4c50dd45..a74e812fd005a0358f9b7cf0a9f8670934db8a94 100644 (file)
@@ -72,10 +72,16 @@ pwminterface_decl = '''
 
 class Pin(object):
 
-    def __init__(self, name, ready, enabled, action, inout):
+    def __init__(self, name,
+                       ready=True,
+                       enabled=True,
+                       io=False,
+                       action=False,
+                       inout=True):
         self.name = name
         self.ready = ready
         self.enabled = enabled
+        self.io = io
         self.action = action
         self.inout = inout
 
@@ -86,6 +92,8 @@ class Pin(object):
             status.append('always_ready')
         if self.enabled:
             status.append('always_enabled')
+        if self.io:
+            status.append('result="io"')
         res += ','.join(status)
         res += "*) method "
         if self.action:
@@ -96,7 +104,6 @@ class Pin(object):
         res += ";"
         return res
 
-
 # basic test
 if __name__ == '__main__':