]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/msp430/usci/Msp430SpiP.nc
Fix up io pin restoration after SPI peripheral is released.
[tinyos-2.x.git] / tos / chips / msp430 / usci / Msp430SpiP.nc
index 84878dd17b75f6b90aa37ceefe808109034b9153..1f9701cc1da40cb3befded98cc1400b9748d63fe 100644 (file)
@@ -144,13 +144,13 @@ implementation {
       call Registers.clrIfgRx();
 
       /* Restore pins to their pre-configure state */
-      if (is4pin() && (m_pins & PINS_STE))
+      if (is4pin() && (m_pins & (1 << PINS_STE)))
        call STE.selectIOFunc();
-      if (m_pins & PINS_SIMO)
+      if (m_pins & (1 << PINS_SIMO))
        call SIMO.selectIOFunc();
-      if (m_pins & PINS_SOMI)
+      if (m_pins & (1 << PINS_SOMI))
        call SOMI.selectIOFunc();
-      if (m_pins & PINS_CLK)
+      if (m_pins & (1 << PINS_CLK))
        call CLK.selectIOFunc();
     }
   }
@@ -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();
     }
   }