#include "oulib.h" #ifdef SERIAL_NPORTS_2 // Two serial ports struct OU_FILE_BUF *ou_file_buf[2] = {NULL, NULL}; ISR(USART0_RX_vect) { serial_receive_isr(ou_file_buf[0]); } ISR(USART1_RX_vect) { serial_receive_isr(ou_file_buf[1]); } ISR(USART0_UDRE_vect) { serial_transmit_isr(ou_file_buf[0]); } ISR(USART1_UDRE_vect) { serial_transmit_isr(ou_file_buf[1]); } #else #ifdef SERIAL_NPORTS_4 // Four serial ports struct OU_FILE_BUF *ou_file_buf[4] = {NULL, NULL, NULL, NULL}; ISR(USART0_RX_vect) { serial_receive_isr(ou_file_buf[0]); } ISR(USART1_RX_vect) { serial_receive_isr(ou_file_buf[1]); } ISR(USART2_RX_vect) { serial_receive_isr(ou_file_buf[2]); } ISR(USART3_RX_vect) { serial_receive_isr(ou_file_buf[3]); } ISR(USART0_UDRE_vect) { serial_transmit_isr(ou_file_buf[0]); } ISR(USART1_UDRE_vect) { serial_transmit_isr(ou_file_buf[1]); } ISR(USART2_UDRE_vect) { serial_transmit_isr(ou_file_buf[2]); } ISR(USART3_UDRE_vect) { serial_transmit_isr(ou_file_buf[3]); } #else // One serial port struct OU_FILE_BUF *ou_file_buf[1] = {NULL}; ISR(USART_RXC_vect) { serial_receive_isr(ou_file_buf[0]); } ISR(USART_UDRE_vect) { serial_transmit_isr(ou_file_buf[0]); } #endif #endif