oulib_serial_buffered.h

00001 #include "oulib.h"
00002 
00003 #ifdef SERIAL_NPORTS_2
00004 // Two serial ports
00005 struct OU_FILE_BUF *ou_file_buf[2] = {NULL, NULL};
00006 
00007 ISR(USART0_RX_vect) {
00008   serial_receive_isr(ou_file_buf[0]);
00009 }
00010 ISR(USART1_RX_vect) {
00011   serial_receive_isr(ou_file_buf[1]);
00012 }
00013 ISR(USART0_UDRE_vect) {
00014   serial_transmit_isr(ou_file_buf[0]);
00015 }
00016 ISR(USART1_UDRE_vect) {
00017   serial_transmit_isr(ou_file_buf[1]);
00018 }
00019 #else
00020 #ifdef SERIAL_NPORTS_4
00021 // Four serial ports
00022 struct OU_FILE_BUF *ou_file_buf[4] = {NULL, NULL, NULL, NULL};
00023 
00024 ISR(USART0_RX_vect) {
00025   serial_receive_isr(ou_file_buf[0]);
00026 }
00027 ISR(USART1_RX_vect) {
00028   serial_receive_isr(ou_file_buf[1]);
00029 }
00030 
00031 ISR(USART2_RX_vect) {
00032   serial_receive_isr(ou_file_buf[2]);
00033 }
00034 
00035 ISR(USART3_RX_vect) {
00036   serial_receive_isr(ou_file_buf[3]);
00037 }
00038 ISR(USART0_UDRE_vect) {
00039   serial_transmit_isr(ou_file_buf[0]);
00040 }
00041 ISR(USART1_UDRE_vect) {
00042   serial_transmit_isr(ou_file_buf[1]);
00043 }
00044 ISR(USART2_UDRE_vect) {
00045   serial_transmit_isr(ou_file_buf[2]);
00046 }
00047 ISR(USART3_UDRE_vect) {
00048   serial_transmit_isr(ou_file_buf[3]);
00049 }
00050 #else
00051 // One serial port
00052 struct OU_FILE_BUF *ou_file_buf[1] = {NULL};
00053 
00054 ISR(USART_RXC_vect) {
00055   serial_receive_isr(ou_file_buf[0]);
00056 }
00057 ISR(USART_UDRE_vect) {
00058   serial_transmit_isr(ou_file_buf[0]);
00059 }
00060 #endif
00061 #endif
Generated on Tue Feb 14 00:23:58 2012 for OU Atmel Utilities Library by  doxygen 1.6.3