add sdcard interface
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 24 Jul 2018 11:49:49 +0000 (12:49 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 24 Jul 2018 11:49:49 +0000 (12:49 +0100)
src/bsv/interface_decl.py

index 7da837189cb071c5c71b5ccacafc838172746600..1840ba19986803cf4b1fec3d08efc1db1c380b8e 100644 (file)
@@ -488,6 +488,17 @@ class InterfaceLCD(InterfaceBus, Interface):
         return len(pins) 
 
 
+class InterfaceSD(InterfaceBus, Interface):
+
+    def __init__(self, *args):
+        InterfaceBus.__init__(self, ['io_out', 'io_out_en', 'io_in'],
+                              "Bit#({0})", "d")
+        Interface.__init__(self, *args)
+
+    def get_n_iopins(self, pins): # HACK! assume in/out/outen so div by 3
+        return len(pins) / 3
+
+
 class InterfaceNSPI(InterfaceBus, Interface):
 
     def __init__(self, *args):
@@ -512,6 +523,9 @@ class InterfaceEINT(Interface):
 
 
 class InterfaceGPIO(InterfaceBus, Interface):
+    """ note: the busfilter cuts out everything as the entire set of pins
+        is a bus, but it's less code.  get_nonbuspins returns empty list.
+    """
 
     def __init__(self, ifacename, pinspecs, ganged=None, single=False):
         InterfaceBus.__init__(self, ['out', 'out_en', 'in'],
@@ -531,6 +545,7 @@ class Interfaces(InterfacesBase, PeripheralInterfaces):
                                 {'gpio': InterfaceGPIO,
                                  'spi': InterfaceNSPI,
                                  'lcd': InterfaceLCD,
+                                 'sd': InterfaceSD,
                                  'qspi': InterfaceNSPI,
                                  'eint': InterfaceEINT})
         PeripheralInterfaces.__init__(self)