Skip to content

Added statemachine deinit #4662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2021
Merged

Conversation

gamblor21
Copy link
Member

For issue #4657

Two problems in deinit. First was the pin being used was not reset with reset_pin_number.

Second the deinit function was not calling common_hal_rp2pio_statemachine_deinit leaving the global pin usage out of sync with the pin now being reset.

Also noticed the constructor is not calling the common_hal version to construct a state machine but did not have time to fix that now. Did a small change so it doesn't allocate a state machine object to just copy to self->statemachine later.

Copy link
Collaborator

@microdev1 microdev1 left a comment

Choose a reason for hiding this comment

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

Thanks! for the PR @gamblor21.

I believe moving to the common_hal version of construct is a better option.
Also, I found the following while going through PulseIn.c.

  • There is no error raised when all state machines are in use.
  • Instead of using save_self, the struct can be passed as an arg to the interrupt handler.

The above are not necessary with respect to the current issue and can have their own PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug rp2040 Raspberry Pi RP2040
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pi Pico (RP2040): pulseio.PulseIn.deinit() doesn't seem to release the pin hardware
3 participants