From 118ab4f4e8259e3d5f9a81c7725f620c8cc660f1 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Thu, 6 May 2021 13:48:20 -0700 Subject: [PATCH] Move import busio back to where it was --- src/board.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/board.py b/src/board.py index 1b42b53..3852a77 100755 --- a/src/board.py +++ b/src/board.py @@ -31,9 +31,9 @@ import sys import adafruit_platformdetect.constants.boards as ap_board from adafruit_blinka.agnostic import board_id, detector -import busio # pylint: disable=wildcard-import,unused-wildcard-import,ungrouped-imports +# pylint: disable=import-outside-toplevel if board_id == ap_board.FEATHER_HUZZAH: from adafruit_blinka.board.feather_huzzah import * @@ -225,17 +225,24 @@ else: raise NotImplementedError("Board not supported {}".format(board_id)) try: - if SDA and SCL: - def I2C(): - """The singleton I2C interface""" - return busio.I2C(SCL, SDA) + def I2C(): + """The singleton I2C interface""" + import busio - if SCLK: + return busio.I2C(SCL, SDA) - def SPI(): - """The singleton SPI interface""" - return busio.SPI(SCLK, MOSI, MISO) + +except NameError: + pass + +try: + + def SPI(): + """The singleton SPI interface""" + import busio + + return busio.SPI(SCLK, MOSI, MISO) except NameError: -- 2.49.0