all the prepared mini meterbus client stuff

This commit is contained in:
hg
2014-06-05 21:17:41 +02:00
parent 7802282906
commit a27d27a827
9 changed files with 693 additions and 43 deletions

View File

@ -40,30 +40,23 @@ void uartInit() {
UCA0CTL1 &= ~UCSWRST;
IE2 |= UCA0RXIE;
// FILE *mystdout = fdevopen(uartPutchar, NULL);
// stdout = mystdout;
}
inline void _realUartTx() {
if ((IFG2 | UCA0TXIE) != 0) {
if (txBufferReadIdx != txBufferWriteIdx) {
UCA0TXBUF = txBuffer[txBufferReadIdx];
txBufferReadIdx++;
if (txBufferReadIdx > UART_TX_BUFFER_SIZE) {
txBufferReadIdx = 0;
}
} else {
disableDataRegisterEmptyInterrupt();
}
}
if ((IFG2 | UCA0TXIE) != 0) {
if (txBufferReadIdx != txBufferWriteIdx) {
UCA0TXBUF = txBuffer[txBufferReadIdx];
txBufferReadIdx++;
if (txBufferReadIdx > UART_TX_BUFFER_SIZE) {
txBufferReadIdx = 0;
}
} else {
disableDataRegisterEmptyInterrupt();
}
}
}
void uartWrite(uint8_t o) {
#if 0
UCA0TXBUF = o;
#else
if (txBufferWriteIdx == (UART_TX_BUFFER_SIZE - 1)) {
while (txBufferReadIdx == UART_TX_BUFFER_SIZE);
} else {
@ -78,8 +71,6 @@ void uartWrite(uint8_t o) {
}
enableDataRegisterEmptyInterrupt();
// _realUartTx();
#endif
}
@ -93,7 +84,7 @@ void uartWrite(uint8_t o) {
ISR(USCIAB0TX, UART_TX_ISR) {
_realUartTx();
_realUartTx();
}
ISR(USCIAB0RX, UART_RX_ISR) {