- } else if (READ_FLAG(UC1IFG, UCB1RXIFG)) {
- volatile uint8_t c = UCB1RXBUF; /* read to clear UCB1RXIFG */
- if (READ_FLAG(UCB1CTL1, UCBRK)) {
- CLR_FLAG(UCB1CTL1, UCBRK);
- if (READ_FLAG(UCB1CTL0, UCMODE_3) == UCMODE_3)
- CLR_FLAG(UCB1CTL1, UCDORM);
- signal IntB.brk();
- } else
- signal IntB.rx(c);
- } else if (READ_FLAG(UCB1STAT, UCALIFG))
+ } else if (READ_FLAG(UC1IFG & UC1IE, UCB1RXIE)) {
+ signal IntB.rx(UCB1RXBUF); /* read clears UCB1RXIFG */
+
+ /* 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(UCB1STAT, UCALIFG)) {
+ CLR_FLAG(UCB1STAT, UCALIFG);