-
Notifications
You must be signed in to change notification settings - Fork 102
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
ADC Interrupt and DMA support #226
Conversation
20f5a18
to
575067b
Compare
Thanks for the PR! Could you add an example to the the repo for easier testing? |
Could I have a question about usage of the new I've noticed that for example in the F4 HAL this is solved by the start function accepting a closure - https://github.com/stm32-rs/stm32f4xx-hal/blob/master/src/dma/mod.rs#L1236 and example of usage here: https://github.com/stm32-rs/stm32f4xx-hal/blob/master/examples/adc_dma_rtic.rs#L83. Maybe this is beyond a scope of this PR and I'm fine with that, I'm just asking about the usage and - I'm also willing to help if wanted, needed. |
575067b
to
d37e02f
Compare
Not quite: you can get the peripheral back through the I'm not sure if having a closure makes a lot of sense in this scenario, especially considering the fact that the DMA configuration depends on the ADC's configuration, so making changes to that would require changes to the DMA configuration. Perhaps there is something I'm missing there, though. For further DMA discussions I'd recommend you check out #230, since we start using |
14bccfd
to
02af053
Compare
Have added a usage example now :) |
Ok, this makes sense, I was able to use it in my code now - the usage example helped a lot, thank you! |
Hi the new DMA interface is merged. |
Use replace_bits premade function Make this more equivalent to the oneshot implementation
Write != modify...
I have updated this PR to be able to use the new DMA API now.
Found it! I've also disabled circular DMA requests for now, as I'm unsure how to properly implement it. I assume it'll require a |
This PR is now ready for review. |
fcbf6d7
to
324886d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me!
Any objections to merging @MathiasKoch ? |
This PR adds support for sequences, interrupts and DMA requests to ADC1 by implementing
from_adc
for thedma::Transfer
struct.There is currently a problem with the
L3
(also:L
) bits in theSRQ1
register having the incorrect and inconsistent names across the parts. For now, I've feature gated this issue away. This problem is fixed in the latest source of the STM32L4 crate, but the fix has not been released yet.