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();
}
}
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();
}
}
task void signalSendDone()
{
atomic {
- signal SpiPacket.sendDone(m_txBuf, m_rxBuf, m_len, SUCCESS);
m_len = 0;
+ signal SpiPacket.sendDone(m_txBuf, m_rxBuf, m_len, SUCCESS);
}
}