00001 00038 /* 00039 serial.h - Contains definitions and function prototypes for the RS232 serial port 00040 author(s): pkv 00041 00042 Directions: 00043 Call the initialization function for the serial port you wish to use. Then, use 00044 either the provided functions or the stdio functions (fprintf, etc) to read and 00045 write characters to the serial ports. 00046 00047 UART Mapping: 00048 usb_*() -> UART0 00049 xbee_*() -> UART1 00050 00051 Options: (Add the following defines to your code to configure this library) 00052 #define USB_BAUD { 115200 | 9600 } <= pick ONE value from in here 00053 #define XBEE_BAUD { 115200 | 9600 } <= pick ONE value from in here 00054 #define USE_STDIO 00055 00056 Note: If you enable USE_STDIO, the first init function that is called will 00057 automatically be linked to stdin, stdout, and stderr. To use the baud rate 00058 commands, add something like the following to your code: 00059 00060 #define FOO_BAUD 9600 00061 00062 **UNLESS YOU KNOW WHAT YOU ARE DOING, PLEASE DO NOT CHANGE THIS FILE** 00063 Many, many other people use this file in their code. If you change it, you will 00064 probably break all of their nice code. You should not need to change anything in 00065 here, except to accomodate new hardware. 00066 */ 00067 00068 #ifndef _SERIAL_H 00069 #define _SERIAL_H 00070 00080 // if no baud rate is defined for usb, default is set here 00081 #ifndef USB_BAUD 00082 00083 #define USB_BAUD 115200 00084 #endif 00085 00087 void usb_init(void); 00089 int usb_putc(char c); 00091 int usb_getc(void); 00093 int usb_getc_nb(char *c); 00095 int usb_puts(char *s); 00097 int usb_puti(int value); 00098 //end addtogroup 00100 00110 // if no baud rate is defined for usb, default is set here 00111 00112 // if no baud rate is defined for xbee, default is set here 00113 #ifndef XBEE_BAUD 00114 00115 #define XBEE_BAUD 9600 00116 #endif 00117 00119 void xbee_init(void); 00121 int xbee_putc(char c); 00123 int xbee_getc(void); 00125 int xbee_getc_nb(char *c); 00126 //end addtogroup 00128 00129 #endif 00130