]> Repositories - Adafruit_Blinka-hackapet.git/blob - src/adafruit_blinka/agnostic/__init__.py
Merge pull request #12 from tannewt/auto_pypi
[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 gc
8 import sys
9 gc.collect()
10
11
12 # We intentionally are patching into this namespace as module names so skip the name check.
13 # pylint: disable=invalid-name
14 microcontroller = sys.platform
15
16 board = None
17 if microcontroller is not None:
18     if microcontroller == "esp8266":  # TODO more conservative board-guessing
19         board = "feather_huzzah"
20     elif microcontroller == "samd21":
21         board = "feather_m0_express"
22     elif microcontroller == "pyboard":
23         microcontroller = "stm32"
24         board = "pyboard"
25
26 implementation = sys.implementation.name
27 if implementation == "micropython":
28     from utime import sleep
29 elif implementation == "circuitpython":
30     from time import sleep
31 gc.collect()