10 static char UART_RX_CHAR = 0;
12 #if defined MW_DEVBOARD_V2
14 void debug_uart_tx_char(char c);
16 #pragma vector=USCI_A3_VECTOR
17 __interrupt void UCA_ISR (void)
23 UART_RX_CHAR = UCA3RXBUF;
24 _event_src |= DBG_UART_RCV_EVENT;
25 /* wake up to handle the received char */
35 void init_debug_uart(void)
40 /* reset default SMCLK = 1.048MHz */
41 UCA3CTL1 |= UCSSEL__SMCLK;
42 /* CLK baud BRx BRSx BRFx */
43 /* 1,048,576 115200 9 1 0 */
44 /* 16,000,000 115200 138 7 0 */
47 UCA3MCTL = UCBRS_7 | UCBRF_0;
49 /* set P10.4 & P10.5 to UCA function */
58 /* enable receive interrupt */
60 /* clear interrup flags */
64 void debug_uart_tx_char(const char c)
66 while (UCA3STAT & UCBUSY)
69 while ((UCA3IFG & UCTXIFG) == 0 )
73 void debug_uart_tx(const char *buf)
78 debug_uart_tx_char(buf[i]);
80 debug_uart_tx_char('\r');
82 while (UCA3STAT & UCBUSY)
86 void debug_dump_hex(const uint16_t len, const void *buf)
91 for (i=0; i<len; i++) {
92 snprintf(tstr, 8, "0x%02x ", *(uint8_t *)(buf+i));
98 void debug_dump_ascii(const uint16_t len, const void *buf)
102 for (i=0; i<len; i++) {
103 debug_uart_tx_char(isprint(*(uint8_t *)(buf+i)) ? *(uint8_t *)(buf+i) : '.');
108 char debug_uart_rx_char(char *c)
110 if (UART_RX_CHAR != 0) {