stm32/dac: impl. write for gpdma and other cleanups#6513
Conversation
|
I have a STM32U545RE and I can't seem to make a successful transfer using GPDMA using this version of write, I might need some guidance. |
|
Thanks for the help, seems like the GPDMA works now |
| pub const fn no_packing() -> bool { | ||
| false | ||
| } | ||
|
|
There was a problem hiding this comment.
I think this could be an enum instead
enum Packing {
Disabled,
Enabled
}
| pub const fn no_packing() -> Pam { | ||
| Pam::ZeroExtendOrLeftTruncate | ||
| } | ||
|
|
There was a problem hiding this comment.
Any reason we need this and we couldn't use Pam::ZeroExtendOrLeftTruncate directly?
| fn new_inner<T: Instance, C: Channel>( | ||
| _peri: Peri<'d, T>, | ||
| peri: Option<Peri<'d, T>>, | ||
| trigger: Option<u8>, |
There was a problem hiding this comment.
Could you comment what the u8 value is supposed to represent? What valid values would be, etc
There was a problem hiding this comment.
Could be worthwhile to comment the other parameters as well, since its non-obvious when something should be None, vs Some, what the values should be, etc
| let _guard = OnDrop::new(|| { | ||
| self.info.regs.cr().modify(|w| { | ||
| w.set_en(self.idx, false); | ||
| w.set_dmaen(self.idx, false); | ||
| }) | ||
| }); |
There was a problem hiding this comment.
As a personal preference, I would think its more obvious if we just add these disable commands at the end of the function, since there is no other place this would get dropped (if I am not missing something)
| }; | ||
|
|
||
| // Initiate the correct type of DMA transfer depending on what data is passed | ||
| let tx_f = unsafe { dma.write_raw(W::dma_buf(data), W::dma_ptr(self.info.regs, self.idx), tx_options) }; |
closes #6500.