]> Repositories - Adafruit_Blinka-hackapet.git/blob - python/agnostic.py
Standardised platform (chip) names
[Adafruit_Blinka-hackapet.git] / python / agnostic.py
1 """Allows useful indirection to test Pin naming logic by switching platform in testing
2     or where auto-detection is not feasible (e.g. multiple ESP8266 boards architecturally identical)
3 """
4 import sys
5
6 try:
7     platform = sys.platform
8 except:
9     platform = None
10
11 # TODO switch name of platform below to be microcontroller
12 if platform is not None:
13     if platform == "esp8266":
14         board = "feather_huzzah"
15     elif platform == "samd21":
16         board="feather_m0_express"
17     elif platform == "pyboard":
18         platform="stm32"
19         board="pyboard"
20 else:
21     board = None
22
23 implementation = sys.implementation.name
24 if implementation == "micropython":
25     import utime as time
26 elif implementation == "circuitpython":
27     import time