Open
Description
The Spi
peripheral has Spi::inner()
which is very useful for doing things that the HAL doesn't support yet. It's nicer, safer, and more discoverable than using unsafe { &*pac::UART8::ptr() }
. We should add it to more peripherals, possibly all of them.
Open Questions
- When should we have
&mut
? TheRegisterBlock
'sReg
s don't need&mut
, even for register writes. Traits thatRegisterBlock
s implement likeTargetAddress
don't need&mut
either. However, we may want to use&mut
to indicate that operations may semantically modify the peripheral, even though it is not required for memory safety. The HAL APIs generally use&mut self
as such to help keep things sane. We could keep bothinner()
andinner_mut()
and document thatinner_mut()
is useful to get the compiler to ensure exclusive access. We could only haveinner_mut()
to be on the safe side. I'm leaning towards keeping both. - Which peripherals
inner()
functions should beunsafe
. The DMA peripherals are obvious since they can be used to write to arbitrary memory. Are there any others?
Metadata
Metadata
Assignees
Labels
No labels