Skip to content

rotaryio's same-port requirement is undocumented, and the README still says rotaryio is not implemented #32

Description

@begeistert

rotaryio.IncrementalEncoder(pin_a, pin_b) refuses when the two pins are on different
AVR ports:

import board
import rotaryio

encoder = rotaryio.IncrementalEncoder(board.D2, board.D8)
error: CompileError: an encoder's two lines have to be on the same port. The handler
that decodes them reads one port register, and a register address has to be known when
the firmware is built, so it cannot read a second port chosen at run time. ...

This is a deliberate, well-explained hardware constraint
(pymcu/hal/avr/encoder/atmega328p.py, encoder_check_same_port) -- not a bug -- but
it is not written down anywhere a user would find it before hitting it: neither the
README's rotaryio row (which, additionally, is stale -- it still lists rotaryio under
"not implemented yet" even though IncrementalEncoder has shipped) nor
docs/language/limitations.md mentions it.

Ask

Document the same-port requirement next to rotaryio in the README (and drop the
"not implemented yet" line, which no longer matches rotaryio.py), so a user picks
board.D2, board.D3 instead of discovering the constraint from a build failure.

Corpus program (pymcu-circuitpython test corpus)

  • 39_rotary_diff_ports_refuse.py -- rotaryio.IncrementalEncoder(board.D2, board.D8),
    a pin pair that reads naturally from the docs' own knob wiring diagrams (D2/D8 are
    both digital pins) but happens to straddle PORTD/PORTB.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions