Skip to content

QT Py RP2040 & rotaryio - "Pins must be sequential" error isn't user friendly #5334

@jpconstantineau

Description

@jpconstantineau

CircuitPython version

Adafruit CircuitPython 7.0.0-beta.0

Code/REPL

import board
import rotaryio
# works
encoder = rotaryio.IncrementalEncoder(board.D4, board.D5)
# does not work -- returns RuntimeError: Pins must be sequential
encoder = rotaryio.IncrementalEncoder(board.D5, board.D6)

Behavior

Initializing a rotary encoder on D4 and D5 appears to be on sequential pins as they are next to each other on the QT PY RP2040 and even have sequential numbers. This combination works properly.

Initializing a rotary encoder on D5 and D6 also appears to be on sequential pins as they are next to each other on the QT PY RP2040 and even have sequential numbers. Unfortunately, rotaryio checks that the GPIOs on the chip are sequential (pin_GPIO25 and pin_GPIO20) using the function "common_hal_rp2pio_pins_are_sequential" and fails with the RuntimeError: Pins must be sequential.

For the QT Py RP2040, this message isn't clear. For users that don't have access to the circuitpython source code to troubleshoot this error message, they will think that the two pins combination are pretty much the same but behave differently.

Ideally, any combination of GPIOs should be able to be configured to work with the rotaryio module.

Description

No response

Additional information

No response

Metadata

Metadata

Assignees

Labels

bugrp2040Raspberry Pi RP2040

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions