Skip to content

Commit

Permalink
Clear USB OUT interrupts when buffer is full
Browse files Browse the repository at this point in the history
  • Loading branch information
ianrrees committed Jun 24, 2021
1 parent 0c820d4 commit 99e98db
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,13 @@ where
};
}
Err(_) => {
// Don't read the data out of the USB endpoint, because we don't
// have anywhere to put it. The USB hardware will NAK the
// packet and decide whether to retry or abort the transfer.
// Since we don't have anywhere to put more data, we can't read
// data out of the USB endpoint. The USB hardware will NAK
// transfers, and the host will decide whether to retry, until
// we eventually read. In the meantime, clear interrupt flags
// in the USB endpoint hardware with an empty read:
let _ = self.read_ep.read(&mut[]);

self.flush_uart(); // Ensure we continue draining the buffer
}
}
Expand Down

0 comments on commit 99e98db

Please sign in to comment.