aboutsummaryrefslogtreecommitdiff
path: root/board/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'board/src/lib.rs')
-rw-r--r--board/src/lib.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/board/src/lib.rs b/board/src/lib.rs
index 24d746a..ebc76ad 100644
--- a/board/src/lib.rs
+++ b/board/src/lib.rs
@@ -40,7 +40,11 @@ impl Pit {
ral::write_reg!(ral::pit::timer, timer, LDVAL, timer_delay_microseconds);
// Enable the PIT timer
ral::modify_reg!(ral::pit, pit, MCR, MDIS: 0);
- Self(unsafe { core::mem::transmute(pit) })
+ Self(unsafe {
+ core::mem::transmute::<&'_ ral::pit::RegisterBlock, &'static ral::pit::RegisterBlock>(
+ pit,
+ )
+ })
}
pub fn blocking_delay(&mut self) {
let timer = &self.0.TIMER[0];
@@ -78,7 +82,12 @@ impl Led {
fn new(offset: u32, port: &ral::gpio::RegisterBlock) -> Self {
let led = Led {
offset,
- port: unsafe { core::mem::transmute(port) },
+ port: unsafe {
+ core::mem::transmute::<
+ &'_ ral::gpio::RegisterBlock,
+ &'static ral::gpio::RegisterBlock,
+ >(port)
+ },
};
ral::modify_reg!(ral::gpio, port, GDIR, |gdir| gdir | led.mask());
led