]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/msp430/usci/HplMsp430UsciInt0P.nc
USCI I2C support.
[tinyos-2.x.git] / tos / chips / msp430 / usci / HplMsp430UsciInt0P.nc
index 9d75d9d9f940bebe5f3d90f27856e1cc760a2253..d802a0bf3b66e2163998866bb63580d8934ff57f 100644 (file)
@@ -106,9 +106,13 @@ implementation
    * modes.
    */
   TOSH_SIGNAL(USCIAB0TX_VECTOR) {
-    if (READ_FLAG(UC0IFG & UC0IE, UCB0RXIE))
-      signal IntB.rx(UCB0RXBUF); /* I2C receive */
-    else if (READ_FLAG(UC0IFG & UC0IE, UCA0TXIFG))
+    if (READ_FLAG(UC0IFG & UC0IE, UCB0RXIE)) {
+      /* I2C receive.  Do not read UCB0RXBUF here, as the code receiving
+       * IntB.rx() may first need to set stop and/or start bits.  The receiver
+       * must read UCB0RXBUF.
+       */
+      signal IntB.rx(0);
+    } else if (READ_FLAG(UC0IFG & UC0IE, UCA0TXIFG))
       signal IntA.tx();
     else if (READ_FLAG(UC0IFG & UC0IE, UCB0TXIFG))
       signal IntB.tx();