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

Fix LEDC duty-cycle updates #294

Merged
merged 3 commits into from
Dec 12, 2022
Merged

Fix LEDC duty-cycle updates #294

merged 3 commits into from
Dec 12, 2022

Conversation

IsaacDynamo
Copy link
Contributor

Fixes #285.

Added start_duty_without_fade!() and update_channel!() to set_duty!() in order for the new duty-cycle to take effect.

start_duty_without_fade!() is a new macro that configures the fading register. It was found that setting LEDC_DUTY_START_CHn is required in order for the new duty-cycle to take effect. The other fields of the conf1 are also written and configured for no fading.

For cfg(esp32) the update_channel!() macro now takes a speed argument, and will result in a no-op for high speed. Because high speed variant doesn't have the para_up field.

This PR also removes the restriction that set_duty(0) could not be called without error.

Tested on ESP32C3. Builds for ESP32.

Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

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

LGTM

@bjoernQ
Copy link
Contributor

bjoernQ commented Dec 12, 2022

Checked on all targets

Thanks for the fix!

@bjoernQ bjoernQ merged commit 68cb35e into esp-rs:main Dec 12, 2022
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.

ESP32C3: set_duty_hw() on ledc::Channel doesn't work
2 participants