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

rmt: Add support for transmitting rust iterators #113

Merged
merged 1 commit into from
Aug 8, 2022

Conversation

N3xed
Copy link
Collaborator

@N3xed N3xed commented Aug 8, 2022

Adds rmt::Transmit::start_iter and rmt::Transmit::start_iter_blocking that allow to
transmit items generated on-the-fly by a rust iterator. This is done by using the
translator feature of the rmt peripheral.

See the documentation in the code for how it works exactly.

Adds `rmt::Transmit::start_iter` and `rmt::Transmit::start_iter_blocking` that allow to
transmit items generated on-the-fly by a rust iterator. This is done by using the
`translator` feature of the rmt peripheral.
Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

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

This is really cool! I didn't know the hardware could do this! We might need to revisit rmt in general when v5.0 is released, a lot of breaking changes... https://docs.espressif.com/projects/esp-idf/en/latest/esp32/migration-guides/release-5.x/peripherals.html#rmt-driver.

but until then, LGTM!

@N3xed N3xed merged commit 3a5538b into master Aug 8, 2022
@N3xed N3xed deleted the feature/rmt-send-iterator branch August 8, 2022 14:01
dsheets added a commit to dsheets/esp-idf-hal that referenced this pull request Dec 21, 2023
This makes it much easier to use `TxRmtDriver::start_iter` and
`TxRmtDriver::start_iter_blocking` (esp-rs#113).
dsheets added a commit to dsheets/esp-idf-hal that referenced this pull request Jan 27, 2024
This makes it much easier to use `TxRmtDriver::start_iter` and
`TxRmtDriver::start_iter_blocking` (esp-rs#113).
ivmarkov pushed a commit that referenced this pull request Jan 31, 2024
* rmt: wrap rmt_item32_t in a newtype

This makes it much easier to use `TxRmtDriver::start_iter` and
`TxRmtDriver::start_iter_blocking` (#113).

* examples/rmt_musical_buzzer: fix for ESP32

Possibly broken by #97, possibly never worked. The ESP-IDF repo
specifically excludes the ESP32 from the RMT musical buzzer demo
because its RMT unit lacks hardware looping. Before this change, the
demo would simply hang when trying to play the second note possibly
because the ESP32 RMT unit does not support asynchronous stopping.

As an added bonus, this example is now much easier to modify to
experiment with 1-bit chiptune synthesis by making every symbol
(cycle) accessible in the ISR iterator.

* rmt: remove Pulse::into_rmt_item in favor of Symbol::new

Also, factor Pulse pairs into function arguments for ease of use.
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.

2 participants