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)
21 UART_RX_CHAR = UCA3RXBUF;
22 _event_src |= DBG_UART_RCV_EVENT;
23 /* wake up to handle the received char */
27 void init_debug_uart(void)
32 /* reset default SMCLK = 1.048MHz */
33 UCA3CTL1 |= UCSSEL__SMCLK;
34 /* CLK baud BRx BRSx BRFx */
35 /* 1,048,576 115200 9 1 0 */
36 /* 16,000,000 115200 138 7 0 */
39 UCA3MCTL = UCBRS_7 + UCBRF_0;
41 /* set P10.4 & P10.5 to UCA function */
50 /* enable receive interrupt */
52 /* clear interrup flags */
56 void debug_uart_tx_char(const char c)
59 while ((UCA3IFG & UCTXIFG) == 0 )
63 void debug_uart_tx(const char *buf)
68 debug_uart_tx_char(buf[i]);
70 debug_uart_tx_char('\r');
72 while (UCA3STAT & UCBUSY)
76 void debug_dump_hex(const uint16_t len, const void *buf)
81 for (i=0; i<len; i++) {
82 snprintf(tstr, 8, "0x%02x ", *(uint8_t *)(buf+i));
88 void debug_dump_ascii(const uint16_t len, const void *buf)
92 for (i=0; i<len; i++) {
93 debug_uart_tx_char(isprint(*(uint8_t *)(buf+i)) ? *(uint8_t *)(buf+i) : '.');
98 char debug_uart_rx_char(char *c)
100 if (UART_RX_CHAR != 0) {