I've been using calendar mode just for hours, minutes and seconds but after i set the year and weekday and i check for return, i get just random values.
So there seems to be a bug with this feature or i'm just being silly?
This is my code using energia
void setup()
{
Serial.begin(9600);
// put your setup code here, to run once:
//Enable Hibernate peripheral. I'm using Energia so i use F_CPU for geting the clock frequency
HibernateEnableExpClk(F_CPU);
HibernateRTCEnable();
//We set a interrupt for the RTC after second. You can change the value
HibernateRTCMatchSet(0,HibernateRTCGet()+1);
HibernateIntRegister(HibernateHandler);
HibernateIntEnable(HIBERNATE_INT_RTC_MATCH_0);
//Set up calender mode. HibernateCounterMode() is always needed but can be set to 12hr mode
HibernateCounterMode(HIBERNATE_COUNTER_24HR);
HibernateCalendarSet(temp); //<-- the struct declared
//We change the hour, minutes and seconds
temp->tm_year= 2014;
temp->tm_wday=0;
//This fuction below is what actualy updates the values inside the peripheral.
//if you don't use it, the value changes above won't do anytigh
HibernateCalendarSet(temp);
}
void loop()
{
//This is to take the "live" values that the RTC keeps updating into our struct
HibernateCalendarGet(temp);
Serial.print(temp->tm_year);
Serial.print(':');
Serial.println(temp->tm_wday);
delay(1000);
}