15.9.1.2.3 Workflow

  1. Make configuration structure.
    struct rtc_calendar_config config_rtc_calendar;
    
  2. Fill the configuration structure with the default driver configuration.
    rtc_calendar_get_config_defaults(&config_rtc_calendar);
    
    Note: This should always be performed before using the configuration struct to ensure that all values are initialized to known default settings.
  3. Make time structure for alarm and set with default and desired values.
    struct rtc_calendar_time alarm;
    rtc_calendar_get_time_defaults(&alarm);
    alarm.year   = 2013;
    alarm.month  = 1;
    alarm.day    = 1;
    alarm.hour   = 0;
    alarm.minute = 0;
    alarm.second = 4;
    
  4. Change configurations as desired.
    config_rtc_calendar.clock_24h     = true;
    config_rtc_calendar.alarm[0].time = alarm;
    config_rtc_calendar.alarm[0].mask = RTC_CALENDAR_ALARM_MASK_YEAR;
    
  5. Initialize module.
    rtc_calendar_init(&rtc_instance, RTC, &config_rtc_calendar);
    
  6. Enable module.
    rtc_calendar_enable(&rtc_instance);