From: ladyada Date: Fri, 22 Mar 2019 16:42:59 +0000 (-0400) Subject: add I2C and SPI singletons for some drivers X-Git-Tag: 1.2.7^2 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/50c34129cf8a33735078b15699b154020138011b?hp=--cc add I2C and SPI singletons for some drivers --- 50c34129cf8a33735078b15699b154020138011b diff --git a/src/board.py b/src/board.py index e13d952..c89fd43 100755 --- a/src/board.py +++ b/src/board.py @@ -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)