This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADC6120 Pure Path Console function call

Part Number: ADC6120EVM-PDK
Other Parts Discussed in Thread: TLV320ADC6120

The Example C code that is generated by  PurePath Console 3 is not working.  Here is the code:  It is generated by PurePath Console 3.

#pragma anon_unions  // I added line to make it work
typedef unsigned char cfg_u8;
typedef union {
struct {
cfg_u8 offset;
cfg_u8 value;
};
struct {
cfg_u8 command;
cfg_u8 param;
};
} cfg_reg;

#define CFG_META_SWITCH (255)
#define CFG_META_DELAY (254)
#define CFG_META_BURST (253)


/* Writes register over TWI to ADC board. */
void transmit_registers(cfg_reg *r, int n)
{
int i = 0;
while (i < n) {
switch (r[i].command) {
case CFG_META_SWITCH:
// Used in legacy applications. Ignored here.
break;
case CFG_META_DELAY:
nrf_delay_ms(r[i].param);
break;
case CFG_META_BURST: // not used now. Have to modify the i2c write function to use the burst mode. Data is small, should not make too big of difference.
i2c_write((unsigned char *)&r[i+1], r[i].param);
i += (r[i].param / 2) + 1;
break;
default:
i2c_write((unsigned char *)&r[i], 2);
break;
}
i++;
}
}


// the following are i2c codes to programming the TI ADC 6120.
cfg_reg registers[] = {
#define CHECKSUM (67)
// Generated by ADCx120EVM-SW v3.0.5
// TLV320ADC6120 device configuration
// -----------------------------------------------------------------------------
// Reset
// -----------------------------------------------------------------------------
// Select Page 0
{ 0x00, 0x00 },
// Reset Device
{ 0x01, 0x01 },
// 1mS Delay

transmit_registers(registers, sizeof(registers)/sizeof(registers[0]));     // this function call is from the Example in PurePath Console 3

C compiler does not like " registers[0]" in the above function call.  C compiler complains that it is not  "subscripted value is not an array pointer or vector."

transmit_registers(&registers, sizeof(registers)/sizeof(registers.command));  -- this function call works (for testing only), but I do not think sizeof(registers.command is the correct element. I do not understand

the typede onion and the cfg_reg registers structure; so I do not know how to find the size of the first element-(registers[0]).   What is the correct way to call the transmit_registers function.