uart_intr.c

Go to the documentation of this file.
00001 /**
00002  * \file
00003  *
00004  *   uart write routines
00005  *
00006  * \author
00007  * 
00008  *   Anthony "Asterisk" Ambuehl
00009  *
00010  *   interrupt routines which must be in HOME bank.  handles received data from UART.
00011  *
00012  */
00013 #include <stdlib.h>
00014 #include <string.h>
00015 
00016 #include "cc2430_sfr.h"
00017 
00018 #include "dev/leds.h"
00019 #include "dev/uart.h"
00020 
00021 static int (*uart0_input_handler)(unsigned char c);
00022 static int (*uart1_input_handler)(unsigned char c);
00023 /*---------------------------------------------------------------------------*/
00024 void
00025 uart0_set_input(int (*input)(unsigned char c))
00026 {
00027   uart0_input_handler = input;
00028 }
00029 
00030 /*---------------------------------------------------------------------------*/
00031 void
00032 uart0_rxISR(void) __interrupt (URX0_VECTOR)
00033 {
00034   TCON_URX0IF = 0;
00035   if(uart0_input_handler != NULL) {
00036     uart0_input_handler(U0BUF);
00037   }
00038 }
00039 /*---------------------------------------------------------------------------*/
00040 void
00041 uart0_txISR( void ) __interrupt (UTX0_VECTOR)
00042 {
00043 }
00044 /*---------------------------------------------------------------------------*/
00045 void
00046 uart1_set_input(int (*input)(unsigned char c))
00047 {
00048   uart1_input_handler = input;
00049 }
00050 /*---------------------------------------------------------------------------*/
00051 void
00052 uart1_rxISR(void) __interrupt (URX1_VECTOR)
00053 {
00054   TCON_URX1IF = 0;
00055   if(uart1_input_handler != NULL) {
00056     uart1_input_handler(U1BUF);
00057   }
00058 }
00059 /*---------------------------------------------------------------------------*/
00060 void
00061 uart1_txISR( void ) __interrupt (UTX1_VECTOR)
00062 {
00063 }
00064 /*---------------------------------------------------------------------------*/

Generated on Mon Apr 11 14:23:38 2011 for Contiki 2.5 by  doxygen 1.6.1