Skip to content
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

samd21: port_disable_tick() should disable event channel #7217

Merged
merged 1 commit into from
Nov 16, 2022

Conversation

dhalbert
Copy link
Collaborator

Fixes #7105.

On SAMD21, port_disable_tick() did not finish the job of disabling the _tick_event_channel.

Also added a check to avoid doing anything if _tick_event_channel was already disabled.

Before this change, editing a file and causing an autoreload would use up a bunch of event channels:
(this is from some temporary logging I added:

[code.py edited here]
Code stopped by auto-reload. Reloading soon.
>port_disable_tick, _tick_event_channel: 0
<port_enable_tick, _tick_event_channel: 0
>port_disable_tick, _tick_event_channel: 0
<port_enable_tick, _tick_event_channel: 1
>port_disable_tick, _tick_event_channel: 1
<port_enable_tick, _tick_event_channel: 2
>port_disable_tick, _tick_event_channel: 2
<port_enable_tick, _tick_event_channel: 3
>port_disable_tick, _tick_event_channel: 3
<port_enable_tick, _tick_event_channel: 4
>port_disable_tick, _tick_event_channel: 4
<port_enable_tick, _tick_event_channel: 5
>port_disable_tick, _tick_event_channel: 5
<port_enable_tick, _tick_event_channel: 6
>port_disable_tick, _tick_event_channel: 6

Now it reuses the same channel:

[code.py edited here]
Code stopped by auto-reload. Reloading soon.
>port_disable_tick, _tick_event_channel: 0
<port_enable_tick, _tick_event_channel: 0
>port_disable_tick, _tick_event_channel: 0
<port_enable_tick, _tick_event_channel: 0
>port_disable_tick, _tick_event_channel: 0
<port_enable_tick, _tick_event_channel: 0

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 a4bd772 into adafruit:main Nov 16, 2022
@dhalbert dhalbert deleted the samd21-tick-event branch November 16, 2022 17:25
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.

CPX: sound meter: RuntimeError: All sync event channels in use
2 participants