Contiki 2.6
|
00001 #ifndef UART_0_H 00002 #define UART_0_H 00003 00004 #include "contiki-conf.h" 00005 00006 #include "cc253x.h" 00007 #include "8051def.h" 00008 #include "uart.h" 00009 00010 /*---------------------------------------------------------------------------*/ 00011 /* UART0 Enable - Disable */ 00012 #ifdef UART0_CONF_ENABLE 00013 #define UART0_ENABLE UART0_CONF_ENABLE 00014 #else 00015 #define UART0_ENABLE 0 00016 #endif 00017 /*---------------------------------------------------------------------------*/ 00018 /* UART0 Function Declarations */ 00019 #if UART0_ENABLE 00020 void uart0_init(); 00021 void uart0_writeb(uint8_t byte); 00022 00023 void uart0_set_input(int (*input)(unsigned char c)); 00024 00025 #if UART0_CONF_WITH_INPUT 00026 void uart0_rx_isr( void ) __interrupt (URX0_VECTOR); 00027 /* Macro to turn on / off UART RX Interrupt */ 00028 #define UART0_RX_INT(v) do { URX0IE = v; } while(0) 00029 #define UART0_RX_EN() do { U0CSR |= UCSR_RE; } while(0) 00030 #else 00031 #define UART0_RX_INT(v) 00032 #define UART0_RX_EN() 00033 #endif /* UART0_CONF_WITH_INPUT */ 00034 #else 00035 #define uart0_init(...) 00036 #define uart0_writeb(...) 00037 #define uart0_set_input(...) 00038 #define UART0_RX_INT(v) 00039 #define UART0_RX_EN() 00040 #endif /* UART0_ENABLE */ 00041 #endif /* UART_0_H */