Compile problem interfacing EVAL-CN0414-ARDZ Shield with Arduino compatible controller

Hello

I'm VERY new to this and self-taught so apologies if I'm not entirely clear.

I'm currently trying to interface the EVAL-CN0414-ARDZ Shield with an Arduino compatible controller (Adafruit Grand Central M4: SAMD51) using the AD717X No-OS Software Drivers and code from the associated Wiki linked below.

https://wiki.analog.com/resources/tools-software/uc-drivers/ad7

I'm compiling using the Arduino IDE 1.8.9.

When I compile, I get two errors referencing typedef sequences for spi_desc, the 1st in the ad717x header and the 2nd in the spi header I took from the No-OS library and updated as per the Wiki above.  The exact error messages and associated code snippets are below.

I would very much appreciate any help I can get sorting this out.

Thank you.

ERROR MESSAGES & CODE

ad717x.h:80:13: error: declaration of 'spi_desc* <unnamed struct>::spi_desc' [-fpermissive]

spi_desc *spi_desc;

^~~~~~~~

typedef struct {
	/* SPI */
	spi_desc		*spi_desc;
	/* Device Settings */
	ad717x_st_reg		*regs;
	uint8_t			num_regs;
	ad717x_crc_mode		useCRC;
} ad717x_dev;

spi.h:84:3: error: changes meaning of 'spi_desc' from 'typedef struct spi_desc spi_desc' [-fpermissive]

} spi_desc;

 ^~~~~~~~

typedef struct spi_desc {
	enum spi_type	type;
	uint32_t	id;
	uint32_t	max_speed_hz;
	enum spi_mode	mode;
	uint8_t		chip_select;
} spi_desc;

The .ino file I've created is as follows

#include "ad411X_regs.h"
#include "ad717x.h"
#include "platform_drivers.h"

#define AD411X_INIT

  /* Create a new driver instance */
  ad717x_dev *my_ad4111;
  ad717x_init_param ad411X_init;

  /* Other variables */
  long timeout = 1000;
  long ret;
  long sample;

void setup()
{
  /* Main setting */
  ad411X_init.spi_init.type = GENERIC_SPI;
  ad411X_init.spi_init.id = 0;
  ad411X_init.spi_init.max_speed_hz = 1000000;
  ad411X_init.spi_init.mode = SPI_MODE_3;
  ad411X_init.spi_init.chip_select = 0x01;  
  ad411X_init.regs = ad4111_regs;
  ad411X_init.num_regs = sizeof(ad4111_regs) / sizeof(ad4111_regs[0]);

  /* Initialize the driver instance and let's use the ad411X_regs array defined in ad411X_regs_v2.h */
  AD717X_Init(&my_ad4111, ad411X_init);
}

void loop() 
{      
  /* Read data from the ADC */
	AD717X_WaitForReady(my_ad4111, timeout);
	AD717X_ReadData(my_ad4111, &sample);
	Serial.println(sample);

 /* delay 500 milliseconds before the next reading */
  delay(500);
}

Parents Reply Children
No Data