- } else if (READ_FLAG(UC0IFG, UCB0RXIFG)) {
- volatile uint8_t c = UCB0RXBUF; /* read to clear UCB0RXIFG */
- if (READ_FLAG(UCB0CTL1, UCBRK)) {
- CLR_FLAG(UCB0CTL1, UCBRK);
- if (READ_FLAG(UCB0CTL0, UCMODE_3) == UCMODE_3)
- CLR_FLAG(UCB0CTL1, UCDORM);
- signal IntB.brk();
- } else
- signal IntB.rx(c);
- } else if (READ_FLAG(UCB0STAT, UCALIFG))
+ } else if (READ_FLAG(UC0IFG & UC0IE, UCB0RXIE)) {
+ signal IntB.rx(UCB0RXBUF); /* read clears UCB0RXIFG */
+
+ /* FIXME: the arbitration of I2C interrupts are not vetted. If, for example
+ * the UCALIFG bit gets set and neither it nor the corresponding interrupt
+ * enable bit is never unset, then an ISR configured for UCSTTIFG or
+ * UCSTPIFG will never be signalled.
+ */
+
+ } else if (READ_FLAG(UCB0STAT, UCALIFG)) {
+ CLR_FLAG(UCB0STAT, UCALIFG);