]> git.karo-electronics.de Git - oswald.git/blobdiff - metawatch/mw_uart.c
Power saving changes, add new fonts, bitmaps and screens
[oswald.git] / metawatch / mw_uart.c
index 16a1a29a8d26c764e5eade40c72eb96ba2720cf4..79b650e7f73ca46373c476c541f4a3f1b2011850 100644 (file)
@@ -16,12 +16,20 @@ void debug_uart_tx_char(char c);
 #pragma vector=USCI_A3_VECTOR
 __interrupt void UCA_ISR (void)
 {
-       /* clear IRQ flag */
-       UCA3IFG  &= ~UCRXIFG;
-       UART_RX_CHAR = UCA3RXBUF;
-       _event_src |= DBG_UART_RCV_EVENT;
-       /* wake up to handle the received char */
-       LPM3_EXIT;
+       switch (UCA3IV) {
+               case 2: // RXIFG
+                       /* clear IRQ flag */
+                       UCA3IFG  &= ~UCRXIFG;
+                       UART_RX_CHAR = UCA3RXBUF;
+                       _event_src |= DBG_UART_RCV_EVENT;
+                       /* wake up to handle the received char */
+                       LPM3_EXIT;
+                       break;
+               case 4: // TXIFG
+                       break;
+               default:
+                       break;
+       }
 }
 
 void init_debug_uart(void)
@@ -36,7 +44,7 @@ void init_debug_uart(void)
        /* 16,000,000 115200 138  7     0 */
 
        UCA3BR0 = 138;
-       UCA3MCTL = UCBRS_7 + UCBRF_0;
+       UCA3MCTL = UCBRS_7 | UCBRF_0;
 
        /* set P10.4 & P10.5 to UCA function */
        P10SEL |= BIT4;
@@ -55,6 +63,8 @@ void init_debug_uart(void)
 
 void debug_uart_tx_char(const char c)
 {
+       while (UCA3STAT & UCBUSY)
+               nop();
        UCA3TXBUF = c;
        while ((UCA3IFG & UCTXIFG) == 0 )
                nop();