Skip to content

Commit 3620e82

Browse files
committed
Simplify block calculation
1 parent f91610f commit 3620e82

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/gpio.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,10 +1156,7 @@ pub mod erased {
11561156
const GPIO_REGISTER_OFFSET: usize = 0x0400;
11571157

11581158
let offset = GPIO_REGISTER_OFFSET * self.port_id() as usize;
1159-
let block_ptr = (crate::pac::GPIOA::ptr() as usize + offset)
1160-
as *const crate::pac::gpioa::RegisterBlock;
1161-
1162-
unsafe { &*block_ptr }
1159+
unsafe { &*crate::pac::GPIOA::ptr().add(offset) }
11631160
}
11641161

11651162
/// Configures the pin to operate as a floating

0 commit comments

Comments
 (0)