84 #if (__GNUC__ * 100 + __GNUC_MINOR__) < 304 85 #error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !" 94 #ifndef USART0_ENABLED 95 #define USART0_ENABLED 103 #ifndef UART_RX0_BUFFER_SIZE 104 #define UART_RX0_BUFFER_SIZE 128 106 #ifndef UART_RX1_BUFFER_SIZE 107 #define UART_RX1_BUFFER_SIZE 128 109 #ifndef UART_RX2_BUFFER_SIZE 110 #define UART_RX2_BUFFER_SIZE 128 112 #ifndef UART_RX3_BUFFER_SIZE 113 #define UART_RX3_BUFFER_SIZE 128 116 #ifndef UART_TX0_BUFFER_SIZE 117 #define UART_TX0_BUFFER_SIZE 128 119 #ifndef UART_TX1_BUFFER_SIZE 120 #define UART_TX1_BUFFER_SIZE 128 122 #ifndef UART_TX2_BUFFER_SIZE 123 #define UART_TX2_BUFFER_SIZE 128 125 #ifndef UART_TX3_BUFFER_SIZE 126 #define UART_TX3_BUFFER_SIZE 128 131 #if (UART_RX0_BUFFER_SIZE > 256 & !defined(USART0_LARGE_BUFFER)) 132 #error "Buffer too large, please use -DUSART0_LARGE_BUFFER switch in compiler options" 135 #if (UART_RX1_BUFFER_SIZE > 256 & !defined(USART1_LARGE_BUFFER)) 136 #error "Buffer too large, please use -DUSART1_LARGE_BUFFER switch in compiler options" 139 #if (UART_RX2_BUFFER_SIZE > 256 & !defined(USART2_LARGE_BUFFER)) 140 #error "Buffer too large, please use -DUSART2_LARGE_BUFFER switch in compiler options" 143 #if (UART_RX3_BUFFER_SIZE > 256 & !defined(USART3_LARGE_BUFFER)) 144 #error "Buffer too large, please use -DUSART3_LARGE_BUFFER switch in compiler options" 149 #if (UART_RX0_BUFFER_SIZE > 32768) 150 #error "Buffer too large, maximum allowed is 32768 bytes" 153 #if (UART_RX1_BUFFER_SIZE > 32768) 154 #error "Buffer too large, maximum allowed is 32768 bytes" 157 #if (UART_RX2_BUFFER_SIZE > 32768) 158 #error "Buffer too large, maximum allowed is 32768 bytes" 161 #if (UART_RX3_BUFFER_SIZE > 32768) 162 #error "Buffer too large, maximum allowed is 32768 bytes" 169 #define UART_BAUD_SELECT(baudRate,xtalCpu) (((xtalCpu)+8UL*(baudRate))/(16UL*(baudRate))-1UL) 175 #define UART_BAUD_SELECT_DOUBLE_SPEED(baudRate,xtalCpu) ((((xtalCpu)+4UL*(baudRate))/(8UL*(baudRate))-1)|0x8000) 179 #if defined(USART0_ENABLED) && ( (UART_RX0_BUFFER_SIZE+UART_TX0_BUFFER_SIZE) >= (RAMEND-0x60)) 180 #error "size of UART_RX0_BUFFER_SIZE + UART_TX0_BUFFER_SIZE larger than size of SRAM" 183 #if defined(USART1_ENABLED) && ( (UART_RX1_BUFFER_SIZE+UART_TX1_BUFFER_SIZE) >= (RAMEND-0x60)) 184 #error "size of UART_RX1_BUFFER_SIZE + UART_TX1_BUFFER_SIZE larger than size of SRAM" 187 #if defined(USART2_ENABLED) && ( (UART_RX2_BUFFER_SIZE+UART_RX2_BUFFER_SIZE) >= (RAMEND-0x60)) 188 #error "size of UART_RX2_BUFFER_SIZE + UART_TX2_BUFFER_SIZE larger than size of SRAM" 191 #if defined(USART3_ENABLED) && ( (UART_RX3_BUFFER_SIZE+UART_RX3_BUFFER_SIZE) >= (RAMEND-0x60)) 192 #error "size of UART_RX3_BUFFER_SIZE + UART_TX3_BUFFER_SIZE larger than size of SRAM" 198 #define UART_FRAME_ERROR 0x0800 199 #define UART_OVERRUN_ERROR 0x0400 200 #define UART_BUFFER_OVERFLOW 0x0200 201 #define UART_NO_DATA 0x0100 206 #define uart_init(b) uart0_init(b) 209 #define uart_getc() uart0_getc() 212 #define uart_peek() uart0_peek() 215 #define uart_putc(d) uart0_putc(d) 218 #define uart_puts(s) uart0_puts(s) 221 #define uart_puts_p(s) uart0_puts_p(s) 224 #define uart_available() uart0_available() 227 #define uart_flush() uart0_flush() 333 #define uart_puts_P(__s) uart0_puts_p(PSTR(__s)) 336 #define uart0_puts_P(__s) uart0_puts_p(PSTR(__s)) 369 #define uart1_puts_P(__s) uart1_puts_p(PSTR(__s)) 397 #define uart2_puts_P(__s) uart2_puts_p(PSTR(__s)) 425 #define uart3_puts_P(__s) uart3_puts_p(PSTR(__s)) uint16_t uart0_getc(void)
Get received byte from ringbuffer.
uint16_t uart3_getc(void)
Get received byte of USART3 from ringbuffer. (only available on selected ATmega)
void uart3_init(uint16_t baudrate)
Initialize USART3 (only available on selected ATmegas)
void uart0_puts_p(const char *s)
Put string from program memory to ringbuffer for transmitting via UART.
uint16_t uart2_getc(void)
Get received byte of USART2 from ringbuffer. (only available on selected ATmega)
void uart1_putc(uint8_t data)
Put byte to ringbuffer for transmitting via USART1 (only available on selected ATmega) ...
void uart1_puts(const char *s)
Put string to ringbuffer for transmitting via USART1 (only available on selected ATmega) ...
uint16_t uart2_peek(void)
Peek at next byte in USART2 ringbuffer.
void uart3_puts(const char *s)
Put string to ringbuffer for transmitting via USART3 (only available on selected ATmega) ...
void uart3_puts_p(const char *s)
Put string from program memory to ringbuffer for transmitting via USART3 (only available on selected ...
void uart1_init(uint16_t baudrate)
Initialize USART1 (only available on selected ATmegas)
void uart2_flush(void)
Flush bytes waiting in receive buffer of USART2.
void uart2_init(uint16_t baudrate)
Initialize USART2 (only available on selected ATmegas)
void uart3_putc(uint8_t data)
Put byte to ringbuffer for transmitting via USART3 (only available on selected ATmega) ...
uint16_t uart3_available(void)
Return number of bytes waiting in the receive buffer of USART3.
uint16_t uart2_available(void)
Return number of bytes waiting in the receive buffer of USART2.
void uart0_init(uint16_t baudrate)
Initialize UART and set baudrate.
void uart0_puts(const char *s)
Put string to ringbuffer for transmitting via UART.
uint16_t uart0_peek(void)
Peek at next byte in ringbuffer.
void uart2_puts(const char *s)
Put string to ringbuffer for transmitting via USART2 (only available on selected ATmega) ...
void uart1_flush(void)
Flush bytes waiting in receive buffer of USART1.
void uart3_flush(void)
Flush bytes waiting in receive buffer of USART3.
uint16_t uart0_available(void)
Return number of bytes waiting in the receive buffer.
void uart1_puts_p(const char *s)
Put string from program memory to ringbuffer for transmitting via USART1 (only available on selected ...
uint16_t uart1_peek(void)
Peek at next byte in USART1 ringbuffer.
uint16_t uart3_peek(void)
Peek at next byte in USART3 ringbuffer.
uint16_t uart1_getc(void)
Get received byte of USART1 from ringbuffer. (only available on selected ATmega)
void uart0_flush(void)
Flush bytes waiting in receive buffer.
void uart2_puts_p(const char *s)
Put string from program memory to ringbuffer for transmitting via USART2 (only available on selected ...
void uart2_putc(uint8_t data)
Put byte to ringbuffer for transmitting via USART2 (only available on selected ATmega) ...
uint16_t uart1_available(void)
Return number of bytes waiting in the receive buffer of USART1.
void uart0_putc(uint8_t data)
Put byte to ringbuffer for transmitting via UART.