Skip to content

Commit 42ed8ba

Browse files
committed
all clippy fixes
1 parent 649e743 commit 42ed8ba

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

cortex-m/src/peripheral/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl Peripherals {
206206
MPU: MPU {
207207
_marker: PhantomData,
208208
},
209-
NVIC: NVIC(nvic::RegisterBlock::new()),
209+
NVIC: NVIC::steal(),
210210
SAU: SAU {
211211
_marker: PhantomData,
212212
},
@@ -545,8 +545,9 @@ impl NVIC {
545545
///
546546
/// This potentially allows to create multiple instances of the NVIC register block, which
547547
/// might only be valid in certain multi-core environments.
548+
#[inline]
548549
pub unsafe fn steal() -> Self {
549-
NVIC(unsafe { nvic::RegisterBlock::new() })
550+
NVIC(unsafe { nvic::RegisterBlock::new_mmio_fixed() })
550551
}
551552
}
552553

cortex-m/src/peripheral/nvic.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
use crate::interrupt::InterruptNumber;
33
use crate::peripheral::NVIC;
44

5+
/// NVIC base address.
6+
pub const BASE_ADDRESS: usize = 0xE000_E100;
7+
58
/// NVIC register block.
69
#[derive(derive_mmio::Mmio)]
710
#[repr(C)]
@@ -85,8 +88,9 @@ impl RegisterBlock {
8588
///
8689
/// This potentially allows to create multiple instances of the NVIC register block, which
8790
/// might only be valid in certain multi-core environments.
88-
pub const unsafe fn new() -> MmioRegisterBlock<'static> {
89-
unsafe { RegisterBlock::new_mmio_at(0xE000_E100) }
91+
#[inline]
92+
pub const unsafe fn new_mmio_fixed() -> MmioRegisterBlock<'static> {
93+
unsafe { RegisterBlock::new_mmio_at(BASE_ADDRESS) }
9094
}
9195
}
9296

0 commit comments

Comments
 (0)