]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
add I2C and SPI singletons for some drivers
authorladyada <limor@ladyada.net>
Fri, 22 Mar 2019 16:42:59 +0000 (12:42 -0400)
committerladyada <limor@ladyada.net>
Fri, 22 Mar 2019 16:42:59 +0000 (12:42 -0400)
src/board.py

index e13d95221a6d3288ace25777e9eed9def026ce2c..c89fd43ddcb0fa3a141fbadef00b7f2747f8a817 100755 (executable)
@@ -78,3 +78,13 @@ elif "sphinx" in sys.modules:
 
 else:
     raise NotImplementedError("Board not supported")
+
+def I2C():
+    """The singleton I2C interface"""
+    import busio
+    return busio.I2C(SCL, SDA)
+
+def SPI():
+    """The singleton SPI interface"""
+    import busio
+    return busio.SPI(SCLK, MOSI, MISO)