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

Add inner and inner_mut functions to peripherals where it's easy to do so

Open mattico opened this issue 3 years ago • 4 comments

Where the registers are owned by a single struct and not shared amongst many channels, etc.

Fixes #232

mattico avatar Jan 04 '22 17:01 mattico

I just added methods to access the peripheral in a DMA Transfer. My first thought was that these should be unsafe since you could read/write to registers while the DMA is reading/writing the same registers. However the hardware synchronizes register access in some fashion and pause() already gives access to the peripheral while the stream is executing. Feel like I might be missing something.

mattico avatar Jan 05 '22 16:01 mattico

I'm less keen on those methods to access the peripheral in a DMA Transfer. Whilst I see your argument, I'd like to get more experience with actually using the DMA API before deciding what to do. You're right that pause() allows access, but it also mutates the stream state (disables it) so maybe more obvious for users what the outcome will be.

richardeoin avatar Jan 24 '22 20:01 richardeoin

@mattico Do you mind if I pick only the first commit and merge that for now?

richardeoin avatar Mar 14 '22 20:03 richardeoin

@richardeoin fine with me!

mattico avatar Mar 14 '22 20:03 mattico