1 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
3 # SPDX-License-Identifier: MIT
4 from adafruit_blinka import Enum
5 import microcontroller.pin
9 Identifies an IO pin on the microcontroller.
11 They are fixed by the hardware so they cannot be constructed on demand. Instead, use board or
12 microcontroller.pin to reference the desired pin.
15 def __init__(self, pin_id):
16 """Identifier for pin, referencing platform-specific pin id"""
20 # pylint: disable=import-outside-toplevel, cyclic-import
23 for key in dir(board):
24 if getattr(board, key) is self:
25 return "board.{}".format(key)
26 # pylint: enable=import-outside-toplevel, cyclic-import
28 for key in dir(microcontroller.pin):
29 if getattr(microcontroller.pin, key) is self:
30 return "microcontroller.pin.{}".format(key)