Skip to content

Commit

Permalink
some optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
YruamaLairba committed Jul 18, 2023
1 parent 575cb79 commit 479d718
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/i2c/dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,23 +597,19 @@ where
{
fn handle_dma_interrupt(&mut self) {
if let Some(tx_t) = &mut self.tx.tx_transfer {
if tx_t.is_fifo_error() {
tx_t.clear_fifo_error();

let flags = tx_t.all_flags();
tx_t.clear_fifo_error();
tx_t.clear_transfer_error();
tx_t.clear_transfer_complete();
if flags.fifo_error {
return;
}

if tx_t.is_transfer_error() {
tx_t.clear_transfer_error();

if flags.transfer_error {
self.finish_transfer_with_result(Err(Error::TransferError));

return;
}

if tx_t.is_transfer_complete() {
tx_t.clear_transfer_complete();

if flags.transfer_complete {
self.finish_transfer_with_result(Ok(()));

// Wait for BTF
Expand Down

0 comments on commit 479d718

Please sign in to comment.