10 static char UART_RX_CHAR = 0;
12 #if defined MW_DEVBOARD_V2 || MW_DEBUG_UART
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 */
36 void init_debug_uart(void)
41 /* reset default SMCLK = 1.048MHz */
42 UCA3CTL1 |= UCSSEL__SMCLK;
43 /* CLK baud BRx BRSx BRFx */
44 /* 1,048,576 115200 9 1 0 */
45 /* 16,000,000 115200 138 7 0 */
48 UCA3MCTL = UCBRS_7 | UCBRF_0;
50 /* set P10.4 & P10.5 to UCA function */
59 /* enable receive interrupt */
61 /* clear interrup flags */
65 void debug_uart_tx_char(const char c)
67 while (UCA3STAT & UCBUSY)
70 while ((UCA3IFG & UCTXIFG) == 0 )
74 void debug_uart_tx(const char *buf)
79 debug_uart_tx_char(buf[i]);
81 debug_uart_tx_char('\r');
83 while (UCA3STAT & UCBUSY)
87 void debug_dump_hex(const uint16_t len, const void *buf)
92 for (i=0; i<len; i++) {
93 snprintf(tstr, 8, "0x%02x ", *(uint8_t *)(buf+i));
99 void debug_dump_ascii(const uint16_t len, const void *buf)
103 for (i=0; i<len; i++) {
104 debug_uart_tx_char(isprint(*(uint8_t *)(buf+i)) ? *(uint8_t *)(buf+i) : '.');
109 char debug_uart_rx_char(char *c)
111 if (UART_RX_CHAR != 0) {