Skip to content

Commit

Permalink
use check_errorsrc instead of matching again on errorsrc bits
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonnn committed Jan 8, 2025
1 parent ec2ab82 commit 0316ef8
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions embassy-nrf/src/twim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,8 @@ impl<'d, T: Instance> Twim<'d, T> {
if r.events_error().read() != 0 {
r.events_error().write_value(0);
r.tasks_stop().write_value(1);
let errorsrc = r.errorsrc().read();
if errorsrc.overrun() {
return Poll::Ready(Err(Error::Overrun));
} else if errorsrc.anack() {
return Poll::Ready(Err(Error::AddressNack));
} else if errorsrc.dnack() {
return Poll::Ready(Err(Error::DataNack));
if let Err(e) = self.check_errorsrc() {
return Poll::Ready(Err(e));
} else {
return Poll::Ready(Err(Error::Bus));
}
Expand Down

0 comments on commit 0316ef8

Please sign in to comment.