rmt: Add user context pointer for use with RMT translator callbacks (IDFGH-4135) #6002
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This is a continuation of #5919
This PR allows adds a temporary function signature,
rmt_init_translator_with_context
so that users can pass in a context pointer to use withrmt_write_sample
. This is useful for situations when you need a reference to the RMT channel being used in the translator function (or other context like timing data for the RMT pulses).Example
An example of this usage is shown in https://github.com/intentfulmotion/AddressableLED/blob/master/src/OneWireLED.cpp. In this example, timing data for different addressable LED strips are passed to the translation function. Since this object is dynamically created and the timing is not known at compile time, this gives the developer flexibilty to write a single translator callback for different timing usecases.