You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.0 KiB

  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. try:
  11. microcontroller = sys.platform
  12. except:
  13. microcontroller = None
  14. board = None
  15. if microcontroller is not None:
  16. if microcontroller == "esp8266": # TODO more conservative board-guessing
  17. board = "feather_huzzah"
  18. elif microcontroller == "samd21":
  19. board = "feather_m0_express"
  20. elif microcontroller == "pyboard":
  21. microcontroller = "stm32"
  22. board = "pyboard"
  23. implementation = sys.implementation.name
  24. if implementation == "micropython":
  25. from utime import sleep
  26. elif implementation == "circuitpython":
  27. from time import sleep
  28. gc.collect()