]> 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 e35d54fa9ccd7d8847aac6b7accb9c705ad52984..dfdf5afd635089b30c5076deae08baa4aa14a245 100644 (file)
@@ -32,7 +32,7 @@
  *
  * TODO: Implement error checking via UCxxSTAT
  *
- * @author R. Steve McKown <smckown@gmail.com>
+ * @author R. Steve McKown <rsmckown@gmail.com>
  */
  
 generic module Msp430SpiP(uint16_t blockSize) {
@@ -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();
     }
   }