Skip to content

esp32-s2: Don't set PWMOut frequency to 0 #4702

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 3 commits into from
May 3, 2021
Merged

esp32-s2: Don't set PWMOut frequency to 0 #4702

merged 3 commits into from
May 3, 2021

Conversation

rsbohn
Copy link

@rsbohn rsbohn commented May 3, 2021

FeatherS2 crashes if you set the PWMOut frequency to 0.
This change will raise ValueError: Invalid PWM frequency if the requested frequency is 0.
(Lifted from the atmel-samd port)

rsbohn added 2 commits May 3, 2021 07:15
FeatherS2 crashes if you set the PWMOut frequency to 0.
This change will raise `ValueError: Invalid PWM frequency` if the requested frequency is 0.
(Lifted from the atmel-samd port)
was causing pre-commit checks to fail
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! @rsbohn for spotting and fixing this issue. Just one comment...

As MicroDev1 pointed out the problem is a divide by zero when calculating the duty cycle.
Maybe need to check again in `common_hal_pwmio_pwmout_set_frequency()`.
@tannewt tannewt merged commit 6782797 into adafruit:main May 3, 2021
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.

4 participants