Skip to content

Commit af69002

Browse files
vadzimdambrouskimvertescher
authored andcommitted
Use NVIC::mask unmask functions instead of custom implementation.
1 parent 57bd07e commit af69002

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/dma.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use core::{
99
};
1010

1111
use as_slice::AsSlice;
12-
use cortex_m::interrupt::Nr;
1312

1413
use crate::{
1514
device::{
@@ -254,9 +253,8 @@ where
254253
w
255254
});
256255

257-
// Enable interrupt. Safe, because we're only doing an atomic write.
258-
let nr = T::INTERRUPT.nr();
259-
unsafe { (&*NVIC::ptr()).iser[nr as usize / 32].write(0x1 << (nr % 32)) }
256+
// Enable interrupt.
257+
unsafe { NVIC::unmask(T::INTERRUPT) };
260258
}
261259

262260
/// Start the DMA transfer
@@ -304,9 +302,8 @@ where
304302
self,
305303
handle: &Handle<T::Instance, state::Enabled>,
306304
) -> Result<TransferResources<T, B>, (TransferResources<T, B>, Error)> {
307-
// Disable interrupt. Safe, because we're only doing an atomic write.
308-
let nr = T::INTERRUPT.nr();
309-
unsafe { (&*NVIC::ptr()).icer[nr as usize / 32].write(0x1 << (nr % 32)) }
305+
// Disable interrupt.
306+
NVIC::mask(T::INTERRUPT);
310307

311308
// Wait for transfer to finish
312309
while self.is_active(handle) {

0 commit comments

Comments
 (0)