stm32f1xx-hal icon indicating copy to clipboard operation
stm32f1xx-hal copied to clipboard

Add BlockingReadDma/BlockingWriteDma traits

Open burrbull opened this issue 4 years ago • 1 comments

cc @TheZoq2 @thalesfragoso

burrbull avatar Oct 17 '20 12:10 burrbull

Thanks @burrbull , that indeed seems like a good addition, but maybe we could use a closure approach, like crossbeam's scoped threads and the scoped_threadpool crate. That way the user can still do some work while the DMA is running, but I'm not sure how we would handle panics in the closure, it should be okay since we don't usually unwind, but still not nice, I have to think more about it.

Another thing, WriteBuffer and the other traits are implemented for pointer types, so B is already a pointer, you don't need &mut B, changing StaticWriteBuffer to WriteBuffer should work better.

PS: I haven't reviewed all of this PR yet.

thalesfragoso avatar Oct 17 '20 18:10 thalesfragoso