Contiki 2.5
uart_intr.c
Go to the documentation of this file.
1 /**
2  * \file
3  *
4  * uart write routines
5  *
6  * \author
7  *
8  * Anthony "Asterisk" Ambuehl
9  *
10  * interrupt routines which must be in HOME bank. handles received data from UART.
11  *
12  */
13 #include <stdlib.h>
14 #include <string.h>
15 
16 #include "cc2430_sfr.h"
17 
18 #include "dev/leds.h"
19 #include "dev/uart.h"
20 
21 static int (*uart0_input_handler)(unsigned char c);
22 static int (*uart1_input_handler)(unsigned char c);
23 /*---------------------------------------------------------------------------*/
24 void
25 uart0_set_input(int (*input)(unsigned char c))
26 {
27  uart0_input_handler = input;
28 }
29 
30 /*---------------------------------------------------------------------------*/
31 void
32 uart0_rxISR(void) __interrupt (URX0_VECTOR)
33 {
34  TCON_URX0IF = 0;
35  if(uart0_input_handler != NULL) {
36  uart0_input_handler(U0BUF);
37  }
38 }
39 /*---------------------------------------------------------------------------*/
40 void
41 uart0_txISR( void ) __interrupt (UTX0_VECTOR)
42 {
43 }
44 /*---------------------------------------------------------------------------*/
45 void
46 uart1_set_input(int (*input)(unsigned char c))
47 {
48  uart1_input_handler = input;
49 }
50 /*---------------------------------------------------------------------------*/
51 void
52 uart1_rxISR(void) __interrupt (URX1_VECTOR)
53 {
54  TCON_URX1IF = 0;
55  if(uart1_input_handler != NULL) {
56  uart1_input_handler(U1BUF);
57  }
58 }
59 /*---------------------------------------------------------------------------*/
60 void
61 uart1_txISR( void ) __interrupt (UTX1_VECTOR)
62 {
63 }
64 /*---------------------------------------------------------------------------*/