I have an arduino uno with atmega328p controller.
I found the code to deal with some specific uart protocol, named mdb: https://github.com/Bouni/MateDealer/tree/master/arduino
But it's compiled just for atmega2560 controller: https://github.com/Bouni/MateDealer/blob/master/arduino/makefile#L42
If I replace it by atmega328p
or atmega328
, I get the error:
asiniy@misha:~/projects/MateDealer/arduino$ make all
-------- begin --------
avr-gcc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiling: main.c
avr-gcc -c -mmcu=atmega328 -I. -gdwarf-2 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=main.lst -std=gnu99 -DF_OSC=16000000 -MD -MP -MF .dep/main.o.d main.c -o main.o
Compiling: usart.c
avr-gcc -c -mmcu=atmega328 -I. -gdwarf-2 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=usart.lst -std=gnu99 -DF_OSC=16000000 -MD -MP -MF .dep/usart.o.d usart.c -o usart.o
usart.c:25:40: error: ‘UBRR1H’ undeclared here (not in a function)
{ { { {}, 0, 0 }, { {}, 0, 0 } }, &UBRR1H, &UBRR1L, &UCSR1B, &UCSR1C },
^
usart.c:25:49: error: ‘UBRR1L’ undeclared here (not in a function)
{ { { {}, 0, 0 }, { {}, 0, 0 } }, &UBRR1H, &UBRR1L, &UCSR1B, &UCSR1C },
^
usart.c:25:58: error: ‘UCSR1B’ undeclared here (not in a function)
{ { { {}, 0, 0 }, { {}, 0, 0 } }, &UBRR1H, &UBRR1L, &UCSR1B, &UCSR1C },
^
usart.c:25:67: error: ‘UCSR1C’ undeclared here (not in a function)
{ { { {}, 0, 0 }, { {}, 0, 0 } }, &UBRR1H, &UBRR1L, &UCSR1B, &UCSR1C },
^
In file included from usart.c:14:0:
usart.c: In function ‘USART0_RX_vect’:
usart.c:185:5: warning: ‘USART0_RX_vect’ appears to be a misspelled signal handler [enabled by default]
ISR(USART0_RX_vect){
^
usart.c: In function ‘USART1_RX_vect’:
usart.c:197:5: warning: ‘USART1_RX_vect’ appears to be a misspelled signal handler [enabled by default]
ISR(USART1_RX_vect){
^
usart.c:203:12: error: ‘UDR1’ undeclared (first use in this function)
data = UDR1;
^
usart.c:203:12: note: each undeclared identifier is reported only once for each function it appears in
In file included from usart.c:14:0:
usart.c: In function ‘USART0_UDRE_vect’:
usart.c:233:5: warning: ‘USART0_UDRE_vect’ appears to be a misspelled signal handler [enabled by default]
ISR(USART0_UDRE_vect){
^
usart.c: In function ‘USART1_UDRE_vect’:
usart.c:253:5: warning: ‘USART1_UDRE_vect’ appears to be a misspelled signal handler [enabled by default]
ISR(USART1_UDRE_vect){
^
usart.c:261:31: error: ‘TXB81’ undeclared (first use in this function)
UCSR1B |= (1<<TXB81);
^
usart.c:266:9: error: ‘UDR1’ undeclared (first use in this function)
UDR1 = data;
^
usart.c:269:20: error: ‘UDRIE1’ undeclared (first use in this function)
UCSR1B &= ~(1<<UDRIE1);
^
make: *** [usart.o] Error 1
I've tried to play with compilers (default is gnu99) and so on, but with no success. Why I have this trouble? How can I compile this code for upload it to arduino?