[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] USART_RXC_vect and USART_TXC_vect

From: Joerg Wunsch
Subject: Re: [avr-libc-dev] USART_RXC_vect and USART_TXC_vect
Date: Thu, 13 May 2010 21:15:42 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

As Karl Edler wrote:

> The reason why I wanted them unified was so that I could write one
> piece of UART code that would work with all avr micro-controllers.

Well, there are (unfortunately) more stumbling blocks along that road.
That starts with older devices naming their registers just UDR, UCSRA
etc. while newer AVRs always number them (UDR0, UCSR0A) even if there
is only one USART available.

So in the end, you won't get away without an abstraction layer, and
that abstraction layer could then include something like:

#ifndef USART0_RX_vect
#  ifdef USART_RXC_vect
     /* ATmega16/32 etc. */
#    define USART0_RX_vect USART_RXC_vect
#  elif defined(USART_RX_vect)
     /* ATmega165/169 etc. */
#    define USART0_RX_vect USART_RX_vect
#  else
#    error "you lose"
#  endif

etc. pp.

However, this is beyond the scope of what avr-libc wants to be.

cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]