Improve DMA ergonomics when working with generics #239
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.
I found our current DMA API to be quite difficult to work with in external crates because of the
A, B
thingy. This replaces the buffer types with the ones used in the embeddonomicon https://docs.rust-embedded.org/embedonomicon/dma.htmlAs far as I can tell, this is safe, but I may very well be missing something.
Because of the way that
Transfer
is implemented, I found no way to specify a generic TxDma which has await
method. To fix that, I added theTransferable
trait.Example usage of all of this can be found at https://gitlab.com/TheZoq2/ws2812-spi-dma/-/blob/master/src/lib.rs
DNM because the same treatment has to be given to RxDma, but I just want to make sure I don't do anything stupid before going through with that.