X-Git-Url: https://git.ayoreis.com/hackapet/Adafruit_Blinka.git/blobdiff_plain/a0dffa801c47aa283db835c338f7773f1f63df7c..407308219c2a647970137a9635cb1573ff34ef0e:/python/agnostic.py diff --git a/python/agnostic.py b/python/agnostic.py index 2246326..2a73347 100644 --- a/python/agnostic.py +++ b/python/agnostic.py @@ -1,3 +1,26 @@ -#platform = sys.implementation.platform -platform="esp8266" -"""Useful indirection to test Pin naming logic by switching platform in testing""" \ No newline at end of file +"""Allows useful indirection to test Pin naming logic by switching platform in testing + or where auto-detection is not feasible (e.g. multiple ESP8266 boards architecturally identical) +""" +import sys + +try: + platform = sys.platform +except: + platform = None + +if platform is not None: + if platform == "esp8266": + board = "huzzah" + elif platform == "Atmel SAMD21": + board="feather_m0_express" + elif platform == "pyboard": + platform="STM32F405RG" + board="pyboard" +else: + board = None + +implementation = sys.implementation.name +if implementation == "micropython": + import utime as time +elif implementation == "circuitpython": + import time \ No newline at end of file