-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Please forgive me, if this is stupid, but I get a little confused by the nitty-gritty details of the move and borrow semantics of the SVD HALs.
The 12 DMA channels can be found in the DMA.ch array, but if I'm not wrong, this prevents a certain peripheral from taking ownership of a single channel:
let mut pac = pac::Peripherals::take().unwrap();
let mut chan0 = pac.DMA.ch[0];error[E0507]: cannot move out of dereference of `DMA`
--> src/main.rs:143:21
|
143 | let mut chan0 = pac.DMA.ch[0];
| ^^^^^^^^^^^^^
| |
| move occurs because value has type `rp2040_hal::rp2040_pac::dma::CH
`, which does not implement the `Copy` trait
| help: consider borrowing here: `&pac.DMA.ch[0]`
One could pass the whole DMA struct to please the borrow checker, but that obviously prevents the independent use of channels.
I'd suggest to cluster the 12 channels in separate modules.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels