Arduino Due with DS3234

I'm trying to use the DS3234 library with an Arduino Due
http://playground.arduino.cc/Main/DS3234SoftwareLibrary

But every time I try to upload the example online:

#include <DS3234.h>

void setup()

{

  RTC.configure(4,5,6,7);

}

void loop()

{

 Serial.println(String("Current date/time: ")+RTC.readDateTime()); 

 delay(2000);

}

I get this error:

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\sam\system/CMSIS/Device/ATMEL/sam3xa/include/sam3xa.h:44:0,
                 from C:\Program Files (x86)\Arduino\hardware\arduino\sam\system/CMSIS/Device/ATMEL/sam3.h:59,
                 from C:\Program Files (x86)\Arduino\hardware\arduino\sam\system/CMSIS/Device/ATMEL/sam.h:198,
                 from C:\Program Files (x86)\Arduino\hardware\arduino\sam\system/libsam/chip.h:25,
                 from C:\Program Files (x86)\Arduino\hardware\arduino\sam\cores\arduino/Arduino.h:42,
                 from C:\Users\alsipj\Documents\Arduino\libraries\DS3234/DS3234.h:1,
                 from sketch_dec11a.ino:1:
C:\Program Files (x86)\Arduino\hardware\arduino\sam\system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:502:29: error: expected ')' before '*' token
 #define RTC        ((Rtc    *)0x400E1A60U) /**< \brief (RTC       ) Base Address */
                             ^
C:\Users\alsipj\Documents\Arduino\libraries\DS3234/DS3234.h:29:15: note: in expansion of macro 'RTC'
 extern DS3234 RTC;
               ^
C:\Program Files (x86)\Arduino\hardware\arduino\sam\system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:502:29: error: expected ')' before '*' token
 #define RTC        ((Rtc    *)0x400E1A60U) /**< \brief (RTC       ) Base Address */
                             ^
C:\Users\alsipj\Documents\Arduino\libraries\DS3234/DS3234.h:29:15: note: in expansion of macro 'RTC'
 extern DS3234 RTC;
               ^
sketch_dec11a.ino: In function 'void setup()':
sketch_dec11a.ino:7:7: error: request for member 'configure' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
sketch_dec11a.ino: In function 'void loop()':
sketch_dec11a.ino:15:51: error: request for member 'readDateTime' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
Error compiling.

I'm trying to use an Arduino Due. Is the library incompatible or is something else going on?

Thanks,

It looks like the error is related to the fact that sam3x8e.h and DS3234.h define peripheral RTC with the same name 'RTC'. You can get rid of the error in two ways:

  1. Comment RTC definition (line 502 of sam3x8e.h).
  2. Rename extern DS3234 RTC (like RTC1) in line 29 of DS3234.h and line 4 of DS3234.cpp and also rename all the RTC.xxx in the sketch.

Of course, I'd recommend the second one.

Regards,

p