#ifndef __SW_FIFO__ #define __SW_FIFO__ #include #define FIFO_BUFFER_SIZE 128 // software buffer size (in bytes) //typedef uint8_t unsigned char // UART data transmit function // - checks if there's room in the transmit sw buffer // - if there's room, it transfers data byte to sw buffer // - automatically handles "uart_tx_buffer_full_flag" // - sets the overflow flag upon software buffer overflow (doesn't overwrite existing data) // - if this is the first data byte in the buffer, it enables the "hw buffer empty" interrupt void uart_send_byte(uint8_t byte); volatile extern uint8_t uart_rx_fifo_not_empty_flag; // this flag is automatically set and cleared by the software buffer volatile extern uint8_t uart_rx_fifo_full_flag; // this flag is automatically set and cleared by the software buffer volatile extern uint8_t uart_rx_fifo_ovf_flag; // this flag is not automatically cleared by the software buffer volatile extern uint8_t uart_tx_fifo_full_flag; // this flag is automatically set and cleared by the software buffer volatile extern uint8_t uart_tx_fifo_ovf_flag; // this flag is not automatically cleared by the software buffer volatile extern uint8_t uart_tx_fifo_not_empty_flag; // this flag is automatically set and cleared by the software buffer void usartInterrupt(void); int serialAvailable(); unsigned char serialRead(void); #endif