Compiler error using AVR Atmel Studio library config files

218 views Asked by At
// Created by lenovo on 8/27/2017.
//

#ifndef UART_UART_CFG_H
#define UART_UART_CFG_H

#define UART_BaudRate     1200   //9600UL
#define CLK               16
#define UART_Parity       NONE
#define UART_TX           EN_TX
#define UART_RX           EN_RX
#define UART_STARTBITS      1
#define UART_STOPBITS       1
#define UART_DATABITS   EightBits

#endif //UART_UART_CFG_H

enter image description here This is the error "called object is not a function or pointer" and this my private file that have all word's addresses inside the config file. The first file:

//
// Created by lenovo on 8/27/2017.
//

#ifndef UART_UART_PRIV_H
#define UART_UART_PRIV_H

/* Main PINS */
#define UCSRA *((volatile u8 *)0x2B)
#define UCSRB *((volatile u8 *)0x2A)
#define UCSRC *((volatile u8 *)0x40)
#define UBRRL *((volatile u8 *)0x29)
#define UBRRH *((volatile u8 *)0x40)
#define UDR   *((volatile u8 *)0x2C)
/* END Main PINS */
#define NONE        0x00
#define twoBit      0x08
#define oneBit      0x00
/* Bits */
#define fiveBits    0x00
#define SixBits     0x02
#define SevenBits   0x04
#define EightBits   0x06
/* End Bits */
#define DIS         0  // Disable
#define EN          1  // Enable

#define UART_9600   9600UL
#endif //UART_UART_PRIV_H

Private file that have some addresses for my Microcontroller ATmega16. Moreover, my config file is reference to private file; which have keys that defined in private. For example, in UART_Partit I wrote NONE and NONE address defined in private but it shows error

1

There are 1 answers

2
Bohdan Pakhaliuk On

You need to include your file with declarations.

#ifndef UART_UART_CFG_H
#define UART_UART_CFG_H

#include "uart_priv.h"

#define UART_BaudRate     1200   //9600UL
#define CLK               16
#define UART_Parity       NONE
#define UART_TX           EN_TX
#define UART_RX           EN_RX
#define UART_STARTBITS      1
#define UART_STOPBITS       1
#define UART_DATABITS   EightBits

#endif //UART_UART_CFG_H

and there are no EN_TX or EN_RX defines for these constants in your second file.