]> Repositories - Adafruit_Blinka-hackapet.git/blob - python/agnostic.py
Moved pin_count out of board into proper place in microcontroller hierarchy
[Adafruit_Blinka-hackapet.git] / python / agnostic.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
9 try:
10     microcontroller = sys.platform
11 except:
12     microcontroller = None
13
14 # TODO switch name of platform below to be microcontroller
15 if microcontroller is not None:
16     if microcontroller == "esp8266":
17         board = "feather_huzzah"
18     elif microcontroller == "samd21":
19         board="feather_m0_express"
20     elif microcontroller == "pyboard":
21         microcontroller= "stm32"
22         board="pyboard"
23 else:
24     board = None
25
26 implementation = sys.implementation.name
27 if implementation == "micropython":
28     import utime as time
29 elif implementation == "circuitpython":
30     import time