From: Cefn Hoile Date: Sun, 18 Feb 2018 01:23:30 +0000 (+0000) Subject: Added pyboard entry. Generalised logic X-Git-Tag: 0.1.0~4^2~137 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/ca4cd1a0f2bde741039f1e802bd2ad22faba585d Added pyboard entry. Generalised logic --- 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