Skip to content

Commit 00ab471

Browse files
hacknusburrbull
andauthored
clear without checking the flags
Co-authored-by: Zgarbul Andrey <[email protected]>
1 parent 68acafb commit 00ab471

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

examples/uart-dma.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,7 @@ fn DMA1_STREAM1() {
234234
cortex_m::interrupt::free(|cs| {
235235
if let Some(transfer) = G_TRANSFER.borrow(cs).borrow_mut().as_mut() {
236236
// Its important to clear fifo errors as the transfer is paused until it is cleared
237-
if transfer.flags() == DmaFlag::FifoError {
238-
transfer.clear_fifo_error();
239-
}
240-
if transfer.flags() == DmaFlag::TransferComplete {
241-
transfer.clear_transfer_complete();
242-
}
237+
transfer.clear_flags(DmaFlag::FifoError | DmaFlag::TransferComplete);
243238
}
244239
});
245240
}

0 commit comments

Comments
 (0)