Description
In #169, I wanted to add a function SCB::steal
that unsafely obtains an instance of the SCB
peripheral. While this API isn't really necessary since Peripherals::steal().SCB
does the same, it is slightly more convenient.
One issue that came up was that Peripherals::steal()
is not documented to have any relationship with Peripherals::take()
. In reality, calling steal()
will cause take()
to return None
, and this is relied on by RTFM for soundness! We definitely need to document this, but it might also be useful to have an unsafe steal()
-like API that does not affect the "taken flag" at all (this is what my SCB::steal()
would've been, for example).
Another possible improvement on this API would be to move it to a trait, which could help with https://github.com/rust-embedded/cortex-m-rt/issues/180. If we had that, we could have cortex-m-rt
steal and pass arbitrary implementors of that trait to the #[entry]
point of the app, moving one nice pattern enabled by RTFM to the non-RTFM embedded world.