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

Add fractional divider support for RMT hal #2127

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

Tnze
Copy link

@Tnze Tnze commented Sep 9, 2024

Thank you for your contribution!

We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:

Submission Checklist 📝

  • I have updated existing examples or added new ones (if applicable).
  • I have used cargo xtask fmt-packages command to ensure that all changed code is formatted correctly.
  • My changes were added to the CHANGELOG.md in the proper section.
  • I have added necessary changes to user code to the Migration Guide.
  • My changes are in accordance to the esp-rs API guidelines

Extra:

Pull Request Details 📖

Description

The hardware support fractional divider, but the HAL doesn't use it. We can use it to achieve higher accuracy.

Testing

Describe how you tested your changes.

Didn't test yet

esp-hal/src/rmt.rs Outdated Show resolved Hide resolved
@Tnze
Copy link
Author

Tnze commented Sep 10, 2024

The solver from lcd_cam use Farey Sequence to find the closest fractional number.

Using Stern-Brocot Tree might be a better solution with O(log²V) complexity which V is the maximum limit of denominator.

@Tnze
Copy link
Author

Tnze commented Sep 10, 2024

Current implementation is tested on ESP32-H2 which successfully dividing 32MHz resulted in 152kHz.

@Tnze Tnze marked this pull request as ready for review September 11, 2024 15:42
@bugadani bugadani linked an issue Sep 11, 2024 that may be closed by this pull request
esp-hal/src/rmt.rs Outdated Show resolved Hide resolved
esp-hal/CHANGELOG.md Outdated Show resolved Hide resolved
esp-hal/src/rmt.rs Outdated Show resolved Hide resolved
esp-hal/src/rmt.rs Outdated Show resolved Hide resolved
esp-hal/src/rmt.rs Outdated Show resolved Hide resolved
esp-hal/src/rmt.rs Outdated Show resolved Hide resolved
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.

[RMT] Feature request: fractional divider support
4 participants