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.

25 lines
816 B

  1. from adafruit_blinka import Enum, agnostic
  2. class Pin(Enum):
  3. def __init__(self, id):
  4. """Identifier for pin, referencing platform-specific pin id"""
  5. self.id = id
  6. def __repr__(self):
  7. import board
  8. for key in dir(board):
  9. if getattr(board, key) is self:
  10. return "board.{}".format(key)
  11. import microcontroller.pin as pin
  12. for key in dir(pin):
  13. if getattr(pin, key) is self:
  14. return "microcontroller.pin.{}".format(key)
  15. return repr(self)
  16. if agnostic.microcontroller == "esp8266":
  17. from adafruit_blinka.microcontroller.esp8266 import *
  18. elif agnostic.microcontroller == "stm32":
  19. from adafruit_blinka.microcontroller.stm32 import *
  20. else:
  21. raise NotImplementedError("Microcontroller not supported")