Contiki 2.6
|
00001 #ifndef UART_H 00002 #define UART_H 00003 00004 #include "contiki-conf.h" 00005 00006 #include "cc253x.h" 00007 #include "8051def.h" 00008 00009 /*---------------------------------------------------------------------------*/ 00010 /* UART BAUD Rates */ 00011 /* 00012 * Macro to set speed of UART N by setting the UnBAUD SFR to M and the 00013 * UnGCR SRF to E. See the cc2530 datasheet for possible values of M and E 00014 */ 00015 #define UART_SET_SPEED(N, M, E) do{ U##N##BAUD = M; U##N##GCR = E; } while(0) 00016 00017 /* 00018 * Sample Values for M and E in the macro above to achieve some common BAUD 00019 * rates. For more values, see the cc2430 datasheet 00020 */ 00021 /* 2000000 - cc2430 theoretical MAX when using the 32MHz clock */ 00022 #define UART_2K_M 0 00023 #define UART_2K_E 16 00024 /* 1000000 - cc2430 theoretical MAX when using the 16MHz clock */ 00025 #define UART_1K_M 0 00026 #define UART_1K_E 15 00027 /* 921600 */ 00028 #define UART_921_M 216 00029 #define UART_921_E 14 00030 /* 460800 Higher values lead to problems when the node needs to RX */ 00031 #define UART_460_M 216 00032 #define UART_460_E 13 00033 /* 115200 */ 00034 #define UART_115_M 216 00035 #define UART_115_E 11 00036 /* 38400 */ 00037 #define UART_38_M 59 00038 #define UART_38_E 10 00039 /* 9600 */ 00040 #define UART_9_M 59 00041 #define UART_9_E 8 00042 00043 #endif /* UART_H */