You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that when attempting to clear i2c receive interrupts utilising the clear_irq function, that this is essentially a no op.
Clearing the rxie interrupt involves reading data from the rxdr register, and the clear_irq does not do this.
I would suggest having the clear_irq function return a Option, something like this:
/// Clears interrupt flag for `event`
pub fn clear_irq(&mut self, event: Event) -> Option<u8> {
self.i2c.icr.write(|w| {
match event {
Event::Stop => w.stopcf().set_bit(),
Event::Errors => w
.berrcf().set_bit()
.arlocf().set_bit()
.ovrcf().set_bit(),
Event::NotAcknowledge => w.nackcf().set_bit(),
_ => w
}
});
let _ = self.i2c.isr.read();
let _ = self.i2c.isr.read(); // Delay 2 peripheral clocks
if event == Event::Receive {
return Some(self.i2c.rxdr.read().rxdata().bits());
}
None
}
The text was updated successfully, but these errors were encountered:
I've noticed that when attempting to clear i2c receive interrupts utilising the
clear_irq
function, that this is essentially a no op.Clearing the rxie interrupt involves reading data from the
rxdr
register, and theclear_irq
does not do this.I would suggest having the
clear_irq
function return a Option, something like this:The text was updated successfully, but these errors were encountered: