Skip to content

Conversation

@dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Sep 16, 2025


  • In raspberrypi rotaryio.IncrementalEncoder, make object be marked as deinited if constructor fails.
  • In all rotaryio.IncrementalEncoder implementations, implement and use common_hal_rotaryio_incrementalencoder_mark_deinit() consistently and same for rp2pio.StateMachine.

Note that in some previous implementations, both IncrementalEncoder pins were NULL'd out on deinit. This was not really necessary, because the deinit test just checks that one of the pins is NULL, which is good enough.

I tested on RP2040 to show that bug no longer occurs. Also tested StateMachine deinit() still works.
I also tested on all other ports that implement rotaryio that creation and deinit of IncrementalEncoder still works: atmel-samd, espressif, nordic, mimxrt10xx.

@Hagtronics FYI

@dhalbert dhalbert requested a review from tannewt September 16, 2025 04:00
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt merged commit ffc42b9 into adafruit:main Sep 17, 2025
540 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RP2xxx: crash after rotaryio constructor exception

2 participants