AnsweredAssumed Answered

How to make AD7124 registers in multiple source files(.c)

Question asked by muthusms on May 13, 2017
Latest reply on May 15, 2017 by muthusms
Branched to a new discussion


I am using  AD7124 in My project.  Right now, I can write and read AD7124 registers properly from main.c. I also want to perform read and write to registers from other file. I am getting complier errors when I try to make AD7124 registers visible in other file . Please suggest a solution.


Here is that what I have done in main.c:

#define AD7124_INIT
#include "AD7124.h"

/*- ADC Driver Usage ------------------------------------------------------------*/
struct spi_module spi_master_instance;
struct spi_slave_inst slave;
struct ad7124_device my_ad7124;
struct ad7124_device *ad7124_handler = &my_ad7124;


When I include AD7124.h in the other file I am getting,     'ad7124_regs' undeclared (first use in this function)  error.


When I include both AD7124.h and  #define AD7124_INIT, getting multiple declaration error.


Please suggest a solution.