aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan McIntyre <me@mciantyre.dev>2024-10-16 08:51:03 -0400
committerIan McIntyre <me@mciantyre.dev>2024-10-16 08:51:14 -0400
commitcb3af5ba736443adbf3dbf305f7a95aa23f3d26b (patch)
tree903dfd916521365f17cfa9ff6b910988a3a8c63b
parentdf20b0576dc7e904bed4184193938e497809bb0d (diff)
Address clippy transmute warnings
-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