]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Merge pull request #95 from ladyada/master 1.2.7
authorLimor "Ladyada" Fried <limor@ladyada.net>
Fri, 22 Mar 2019 16:45:44 +0000 (12:45 -0400)
committerGitHub <noreply@github.com>
Fri, 22 Mar 2019 16:45:44 +0000 (12:45 -0400)
add I2C and SPI singletons for some drivers

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)