Something is wrong with this DAC library!

I cot a custom arduino board in the mail today. The board is running an XMega128a3, and i have included a lot of libraries, including this DAC library.

I loaded the sketch, but I got an error when I tried to compile, saying;

In file included from SingleChannelDAC.ino:12:
/Users/hansi/Documents/Arduino/libraries/xmDAC/xmDAC.h:81: error: ISO C++ forbids declaration of ‘DAC_t’ with no type
/Users/hansi/Documents/Arduino/libraries/xmDAC/xmDAC.h:81: error: expected ‘;’ before ‘*’ token

I seems like there is something wrong with the library in line 81.
This line is DAC_t *dac;

I’ve tried to remove the * , and tried to replace DAC_t, but no luck.
What’s wrong?

I’ll include the library and the sketches for you, download right below :slight_smile:

I found out there was some documentation for the library here: (14.3 KB)

I lookad at the AVR headers in 1.5.2, and the only reference to DAC_t is in "iox64a3.h". Is this the processor you're compiling for?

I'm compiling for the xmega128a3u. Like I said, it's a custom board with a custom library. Documentation is provided in the main post :)

Oops, sorry, misread the search status - no, you're right, it's there in "iox128a3.h" too.

But do you have any clue how I can get this library working again?

How are you compiling this?
From the command line or in the IDE?
Have you modified “boards.txt” to include the non-standard processor?

Ive compiled the code in the arduino IDE. I found a guy who have included this library in arduino IDE 1.0.1, so I copied that file into IDE v1.0.4, and it magically works! :D no idea why!

but there is also an EEPROM library for this that give me a lot of errors, if you want a brainteaser ;)

But do you have any clue how I can get this library working again?

from the code it seems that DAC_t is just a define of uint8_t so replacing it might solve the issue. update, my mistake :blush: :blush: :blush:

it seems that DAC_t is just a define of uint8_t

typedef struct DAC_struct
    register8_t CTRLA;  /* Control Register A */
    register8_t CTRLB;  /* Control Register B */
    register8_t CTRLC;  /* Control Register C */
    register8_t EVCTRL;  /* Event Input Control */
    register8_t TIMCTRL;  /* Timing Control */
    register8_t STATUS;  /* Status */
    register8_t reserved_0x06;
    register8_t reserved_0x07;
    register8_t GAINCAL;  /* Gain Calibration */
    register8_t OFFSETCAL;  /* Offset Calibration */
    register8_t reserved_0x0A;
    register8_t reserved_0x0B;
    register8_t reserved_0x0C;
    register8_t reserved_0x0D;
    register8_t reserved_0x0E;
    register8_t reserved_0x0F;
    register8_t reserved_0x10;
    register8_t reserved_0x11;
    register8_t reserved_0x12;
    register8_t reserved_0x13;
    register8_t reserved_0x14;
    register8_t reserved_0x15;
    register8_t reserved_0x16;
    register8_t reserved_0x17;
    _WORDREGISTER(CH0DATA);  /* Channel 0 Data */
    _WORDREGISTER(CH1DATA);  /* Channel 1 Data */
} DAC_t;

We must be on different pages.

my mistake :blush: :blush: :blush: ;)