Skip to content

Commit 067af84

Browse files
bors[bot]Dirbaio
andauthored
Merge #472
472: nvic: do not require `&mut self` for `request`. r=adamgreig a=Dirbaio It's not needed, the register write is stateless/atomic. Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2 parents 88c6f86 + d6086d3 commit 067af84

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Breaking changes
11+
12+
- `NVIC::request()` no longer requires `&mut self`.
13+
1014
### Added
1115
- Updated `SCB.ICSR.VECTACTIVE`/`SCB::vect_active()` to be 9 bits instead of 8.
1216
Also fixes `VectActive::from` to take a `u16` and subtract `16` for

src/peripheral/nvic.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,14 @@ impl NVIC {
9494
/// [`NVIC::pend`]: #method.pend
9595
#[cfg(not(armv6m))]
9696
#[inline]
97-
pub fn request<I>(&mut self, interrupt: I)
97+
pub fn request<I>(interrupt: I)
9898
where
9999
I: InterruptNumber,
100100
{
101101
let nr = interrupt.number();
102102

103-
unsafe {
104-
self.stir.write(u32::from(nr));
105-
}
103+
// NOTE(ptr) this is a write to a stateless register
104+
unsafe { (*Self::PTR).stir.write(u32::from(nr)) }
106105
}
107106

108107
/// Disables `interrupt`

0 commit comments

Comments
 (0)