feat(adc): spike for ADC reads using DMA w/ circular buffer #442
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.
This implements continuous ADC reads of multiple channels using DMA and a circular buffer. Values should be able to be read directly from the buffer from any context, not just interrupts.
This is unsafe, but it's working and so gives a jumping off point for improvements. I'm not actually sure if the use-case is even possible in safe Rust.
Seeking ideas to improve:
u8
s instead of an array of pins.read_volatile
because the transfer has&mut
ownership over the buffer. There would also need to be an API to access this buffer from outside an interrupt context, where we might not have access to the transfer.DmaConfig
needs to be setup correctly (e.g.circular_buffer(true)
), otherwise it won't work.