]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/msp430/usci/Msp430SpiP.nc
This change allows msp430 usci SpiByte.write to terminate if the spi resource
[tinyos-2.x.git] / tos / chips / msp430 / usci / Msp430SpiP.nc
index acd288b8c5758d5c83dc41382e5bd9d509bb181b..dfdf5afd635089b30c5076deae08baa4aa14a245 100644 (file)
@@ -137,7 +137,7 @@ implementation {
   {
     atomic {
       /* Disable the device */
-      call Registers.setCtl1(UCSYNC);
+      call Registers.setCtl1(UCSWRST);
 
       /* Clear interrupts and interrupt flags.  We only used Rx */
       call Registers.clrIeRx();
@@ -160,9 +160,9 @@ implementation {
     if (isBusy())
       return 0;
     else {
-      while (!call Registers.getIfgTx());
+      while (!call Registers.getIfgTx() && !call Registers.getCtl1(UCSWRST));
       call Registers.setTxbuf(byte);
-      while(!call Registers.getIfgRx());
+      while(!call Registers.getIfgRx() && !call Registers.getCtl1(UCSWRST));
       return call Registers.getRxbuf();
     }
   }