/* Clear interrupts; we'll add them as needed */
call Registers.clrIeRx();
call Registers.clrIeTx();
/* Enable the device */
call Registers.clrCtl1(UCSWRST);
/* Clear interrupts; we'll add them as needed */
call Registers.clrIeRx();
call Registers.clrIeTx();
/* Enable the device */
call Registers.clrCtl1(UCSWRST);
/* FIXME: this can cause an arbitrarily long ISR, if m_slen is large.
* But depending on timing, we may always only write 1 byte.
*/
/* FIXME: this can cause an arbitrarily long ISR, if m_slen is large.
* But depending on timing, we may always only write 1 byte.
*/
- while (!call Registers.getIfgTx()); /* in case interleaved UB.send */
- while (m_slen && call Registers.getIfgTx()) {
- call Registers.setTxbuf(*m_sbuf);
- if (--m_slen)
- m_sbuf++;
- }
- if (m_slen == 0) {
- call Registers.clrIeTx();
- m_sobuf = 0;
- signal UartStream.sendDone(m_sobuf, m_solen, SUCCESS);
+ if (m_sobuf) {
+ while (!call Registers.getIfgTx()); /* in case interleaved UB.send */
+ while (m_slen && call Registers.getIfgTx()) {
+ call Registers.setTxbuf(*m_sbuf);
+ if (--m_slen)
+ m_sbuf++;
+ }
+ if (m_slen == 0) {
+ call Registers.clrIeTx();
+ m_sobuf = 0;
+ signal UartStream.sendDone(m_sobuf, m_solen, SUCCESS);
+ }
async event void Interrupts.i2cStop() {}
async event void Interrupts.i2cCal() {}
async event void Interrupts.brk() {}
async event void Interrupts.i2cStop() {}
async event void Interrupts.i2cCal() {}
async event void Interrupts.brk() {}
async event void Counter.overflow() {}
default async event void UartStream.sendDone( uint8_t* buf, uint16_t len,
async event void Counter.overflow() {}
default async event void UartStream.sendDone( uint8_t* buf, uint16_t len,