/**** * Interrupt-driven Hardware UART Serial Driver * Henry Chan (hc352@cornell.edu) * Based on interrupt-driver serial code by Bruce Land ****/ #ifndef SERIAL_H #define SERIAL_H #include #include #include "uart.h" extern FILE uart_str; // Receiving end // Position in serial_rx_buffer extern volatile char serial_rx_index; // Buffer to hold received string extern volatile char serial_rx_buffer[16]; // Flag for ready when return entered extern volatile char serial_rx_ready; // Save character extern volatile char serial_rx_char; // Transmitting end // Position in the serial_tx_buffer extern volatile char serial_tx_index; // Buffer to hold transmitting string extern volatile char serial_tx_buffer[16]; // Flag for ready once transmission is complete extern volatile char serial_tx_ready; // Current character to send extern volatile char tx_char; // Hardware control of receiveing ISR(USART0_RX_vect); // Hardware control of transmitting ISR(USART0_UDRE_vect); /**** * Initialize ISRs for Hardware Serial ****/ void serial_initialize(); /**** * Sets the hardware serial up to receive a string ****/ char serial_getstr(); /**** * Sets the hardware serial up to send a string ****/ char serial_putstr(); #endif