36 #include "dev/uart1.h" 37 #include "dev/watchdog.h" 39 #include "isr_compat.h" 41 static int (*uart1_input_handler)(
unsigned char c);
45 #ifdef UART1_CONF_TX_WITH_INTERRUPT 46 #define TX_WITH_INTERRUPT UART1_CONF_TX_WITH_INTERRUPT 48 #define TX_WITH_INTERRUPT 1 55 static uint8_t txbuf_data[TXBUFSIZE];
66 uart1_set_input(
int (*
input)(
unsigned char c))
68 uart1_input_handler =
input;
72 uart1_writeb(
unsigned char c)
92 while(!(IFG2 & UCA0TXIFG));
108 UCA0CTL1 |= UCSSEL_2;
112 UCA0CTL1 &= ~UCSWRST;
118 ISR(USCIAB1RX, uart1_rx_interrupt)
123 if(UCA0STAT & UCRXERR) {
127 if(uart1_input_handler != NULL) {
128 if(uart1_input_handler(c)) {
135 #if TX_WITH_INTERRUPT 136 ISR(USCIAB1TX, uart1_tx_interrupt)
138 if(IFG2 & UCA0TXIFG) {
static uint8_t transmitting(void)
Check the RF's TX status.
int ringbuf_elements(struct ringbuf *r)
Get the number of elements currently in the ring buffer.
int ringbuf_get(struct ringbuf *r)
Get a byte from the ring buffer.
void uart1_init(unsigned long ubr)
Initalize the RS232 port.
Header file for the ring buffer library
Structure that holds the state of a ring buffer.
int ringbuf_put(struct ringbuf *r, uint8_t c)
Insert a byte into the ring buffer.
static void input(void)
Process a received 6lowpan packet.