123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- #ifndef UART_H
- #define UART_H
-
-
-
-
-
-
-
- #if (__GNUC__ * 100 + __GNUC_MINOR__) < 304
- #error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !"
- #endif
-
-
-
-
-
- #define UART_BAUD_SELECT(baudRate,xtalCpu) ((xtalCpu)/((baudRate)*16l)-1)
-
-
- #define UART_BAUD_SELECT_DOUBLE_SPEED(baudRate,xtalCpu) (((xtalCpu)/((baudRate)*8l)-1)|0x8000)
-
-
-
- #ifndef UART_RX_BUFFER_SIZE
- #define UART_RX_BUFFER_SIZE 32
- #endif
-
- #ifndef UART_TX_BUFFER_SIZE
- #define UART_TX_BUFFER_SIZE 32
- #endif
-
-
- #if ( (UART_RX_BUFFER_SIZE+UART_TX_BUFFER_SIZE) >= (RAMEND-0x60 ) )
- #error "size of UART_RX_BUFFER_SIZE + UART_TX_BUFFER_SIZE larger than size of SRAM"
- #endif
-
-
- #define UART_FRAME_ERROR 0x0800
- #define UART_OVERRUN_ERROR 0x0400
- #define UART_BUFFER_OVERFLOW 0x0200
- #define UART_NO_DATA 0x0100
-
-
-
-
-
- extern void uart_init(unsigned int baudrate);
-
-
-
- extern unsigned int uart_getc(void);
-
-
-
- extern void uart_putc(unsigned char data);
-
-
-
- extern void uart_puts(const char *s );
-
-
-
- extern void uart_puts_p(const char *s );
-
-
- #define uart_puts_P(__s) uart_puts_p(PSTR(__s))
-
-
-
-
- extern void uart1_init(unsigned int baudrate);
-
- extern unsigned int uart1_getc(void);
-
- extern void uart1_putc(unsigned char data);
-
- extern void uart1_puts(const char *s );
-
- extern void uart1_puts_p(const char *s );
-
- #define uart1_puts_P(__s) uart1_puts_p(PSTR(__s))
-
-
-
-
- #endif
-
|