]> Repositories - Adafruit_Blinka-hackapet.git/blob - src/adafruit_blinka/agnostic/__init__.py
some initial work on adding platformdetect
[Adafruit_Blinka-hackapet.git] / src / adafruit_blinka / agnostic / __init__.py
1 """Allows useful indirection to test Pin naming logic by switching platform in testing
2     or provide bootstrapping logic for board identification where auto-detection is not
3     feasible (e.g. multiple ESP8266 boards architecturally identical). Once runtime
4     environment is established, can choose various routes to make available and re-export
5     common modules and operations, depending on platform support
6 """
7 import sys
8 import adafruit_platformdetect
9
10 # We intentionally are patching into this namespace as module names so skip the name check.
11 # pylint: disable=invalid-name
12
13 detect = adafruit_platformdetect.PlatformDetect()
14
15 board_name = detect.board.name()
16 chip_name = detect.chip.name()
17
18 implementation = sys.implementation.name
19 if implementation == "micropython":
20     from utime import sleep
21 elif implementation == "circuitpython" or implementation == "cpython":
22     from time import sleep