Fix threading issue that stopped Blinka from working on MicroPython
* Author(s): cefn
"""
-import threading
+try:
+ import threading
+except ImportError:
+ threading = None
import adafruit_platformdetect.constants.boards as ap_board
import adafruit_platformdetect.constants.chips as ap_chip
(scl, sda), i2cPorts
)
)
-
- self._lock = threading.RLock()
+ if threading is not None:
+ self._lock = threading.RLock()
def deinit(self):
"""Deinitialization"""
pass
def __enter__(self):
- self._lock.acquire()
+ if threading is not None:
+ self._lock.acquire()
return self
def __exit__(self, exc_type, exc_value, traceback):
- self._lock.release()
+ if threading is not None:
+ self._lock.release()
self.deinit()
def scan(self):