Skip to content

Pin(Enum) __repr__ recursion when trying to report error in board pins. #947

@embedded-dev

Description

@embedded-dev

Board Name

Raspberry Pico W

Steps

1 ) Install adafruit_blinka
2) mpremote
3) >>> import board
4) >>> import bus
5) >>y=busio(board.GP16, board.GP17)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "lib/busio.py", line 28, in __init__
  File "lib/busio.py", line 36, in init
  File "lib/microcontroller/rp2040/i2c.py", line 26, in __init__
  File "lib/microcontroller/generic_micropython/__init__.py", line 25, in __repr__
  File "lib/microcontroller/generic_micropython/__init__.py", line 25, in __repr__
  File "lib/microcontroller/generic_micropython/__init__.py", line 25, in __repr__
  File "lib/microcontroller/generic_micropython/__init__.py", line 25, in __repr__
  File "lib/microcontroller/generic_micropython/__init__.py", line 25, in __repr__
  File "lib/microcontroller/generic_micropython/__init__.py", line 25, in __repr__
  File "lib/microcontroller/generic_micropython/__init__.py", line 25, in __repr__
  File "lib/microcontroller/generic_micropython/__init__.py", line 25, in __repr__
  File "lib/microcontroller/generic_micropython/__init__.py", line 25, in __repr__
  File "lib/microcontroller/generic_micropython/__init__.py", line 25, in __repr__
RuntimeError: maximum recursion depth exceeded

Description

In the above, the busio.I2C call the clock and data pins are reversed. Since there was no match in i2cPorts, the rp2040/I2C.__init__() is trying to use Pin(Enum).__repr__() to report the arguments. The Pin(Enum).__repr__() does not detect a match.

I looked into trying to provide a fix but I guess I don't understand how it is supposed to work.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions