Changeset 6c47e45 in avrstuff


Ignore:
Timestamp:
Sep 24, 2017, 7:47:43 PM (7 years ago)
Author:
Adrien Destugues <pulkomandy@…>
Branches:
main
Children:
c0a8b2a
Parents:
6390cc3
Message:

libusart: configure as 7E1 when using atmega128.

I'm using a Minitel as a terminal today. It can do only that.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libs/usart/usart.c

    r6390cc3 r6c47e45  
    4040        UCSRC = (1 << UCSZ1) | (1 << UCSZ0);
    4141#elif defined __AVR_ATmega128__
    42         UCSRC = (3 << UCSZ0);
     42        UCSR0C = (2 << UCSZ0) | (2 << UPM0) ; /* 7 bits + even parity.
     43                                                                                        TODO make this configurable. */
    4344#else
    4445        UCSRC = (1 << URSEL) | (3 << UCSZ0);
     
    5556{
    5657        //Wait untill the transmitter is ready
    57         while(!(UCSRA & (1<<UDRE)))
     58        while(!(UCSR0A & (1<<UDRE0)))
    5859        {
    5960                //Do nothing
     
    7273{
    7374        //Wait untill a data is available
    74         while(!(UCSRA & (1<<RXC)))
     75        while(!(UCSR0A & (1<<RXC0)))
    7576        {
    7677                //Do nothing
     
    8081        //and is available is buffer
    8182
    82         return UDR;
     83        return UDR0;
    8384}
    8485
Note: See TracChangeset for help on using the changeset viewer.