Here is a little usage example for alarms and some other stuff:
void setup()
{
// Set the clock using a unix time stamp (date -u +'%s')
RTC.clockSet(1192390068); //Sun Oct 14 15:27:48 EDT 2007
// Setup a callback function for the integrity check
// See below for the callback functions
RTC.clockIntegrityCallback(integrityCallback);
// Enable the Square Wave @ 1Hz on INTB
RTC.sqwSetRate(DS1337_SQW_1HZ);
RTC.sqwEnable();
// Setup the first alarm
RTC.alarmSelect(0); // Switch to alarm 2
RTC.alarmSet(RTC_SEC, 30);
RTC.alarmSet(RTC_MIN, 18);
RTC.alarmSet(RTC_HR, 0);
RTC.alarmSet(RTC_DOW, 0);
// Match mode: every minutes and seconds
RTC.alarmSet(DS1337_ALARM_MODE, DS1337_ALARM_MCH_MINSEC);
// Setup callback function for alarm 1
RTC.alarmSetCallback(alarmCallback1);
// Setuo the external interrupt on INTA for alarm1
RTC.alarmSetInterrupt();
RTC.alarmSelect(1); // Switch to alarm 2
// Match mode: once per minute at 00s
RTC.alarmSet(DS1337_ALARM_MODE, DS1337_ALARM_PER_MIN);
// Setup callback function for alarm 2
RTC.alarmSetCallback(alarmCallback2);
// Setup the interrupt for alarm 2
// If the square wave is enabled, it will output on INTA
// if the SQW is disabled the interrupt will happen on INTB
RTC.alarmSetInterrupt();
}
void loop()
{
RTC.clockChecks(); // Performs alarm and integrity checks for call back functions
}
// Note that the alarm registers will stay high
// until these function are finished executing.
void alarmCallback1(void)
{
Serial.print("alarm 1 triggerd");
return;
}
void alarmCallback2(void)
{
Serial.print("alarm 2 triggerd");
return;
}
void integrityCallback(void)
{
Serial.print("Oscillator integrity fault!");
// If the fault flag is high the clock is stopped
// so in this function we can fix the time and start the clock again
RTC.clockStart();
return;
}
There are other stuff too obvious, such as manually checking for alarms, setting the time in binary, etc. Most of the options can be turned on/off to save some space if you don't need the functionality. You should try and go through the two configuration files (ds1337.h, configs/ds1337/ds1337.h and configs/RTC/rtcConfig.h) there are a lot of helpful comments in there.