You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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? The RegisterBlock's Regs don't need &mut, even for register writes. Traits that RegisterBlocks implement like TargetAddress 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 both inner() and inner_mut() and document that inner_mut() is useful to get the compiler to ensure exclusive access. We could only have inner_mut() to be on the safe side. I'm leaning towards keeping both.
Which peripherals inner() functions should be unsafe. The DMA peripherals are obvious since they can be used to write to arbitrary memory. Are there any others?
The text was updated successfully, but these errors were encountered:
The
Spi
peripheral hasSpi::inner()
which is very useful for doing things that the HAL doesn't support yet. It's nicer, safer, and more discoverable than usingunsafe { &*pac::UART8::ptr() }
. We should add it to more peripherals, possibly all of them.Open Questions
&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.inner()
functions should beunsafe
. The DMA peripherals are obvious since they can be used to write to arbitrary memory. Are there any others?The text was updated successfully, but these errors were encountered: