implementation {
enum {
/* Bit positions in m_pins */
- PINS_RXD = 1,
+ PINS_RXD = 0,
PINS_TXD
};
call TXD.selectModuleFunc();
}
+ /* Reset important state variables */
+ m_robuf = 0;
+ m_sobuf = 0;
+
/* Clear interrupts; we'll add them as needed */
call Registers.clrIeRx();
call Registers.clrIeTx();
/* Enable the device */
call Registers.clrCtl1(UCSWRST);
+
+ /* TOS convention is for receive interrupts on by default. */
+ call Registers.clrIfgRx();
+ call Registers.setIeRx();
}
}
call Registers.clrIeTx();
call Registers.clrIfgRx();
+ /* Reset important state variables */
+ m_robuf = 0;
+ m_sobuf = 0;
+
/* Restore pins to their pre-configure state */
- if (m_pins & PINS_RXD)
+ if (m_pins & (1 << PINS_RXD))
call RXD.selectIOFunc();
- if (m_pins & PINS_TXD)
+ if (m_pins & (1 << PINS_TXD))
call TXD.selectIOFunc();
}
}