Workflow

  1. 1.
    Create alarm struct and initialize the time with current time.
    struct rtc_calendar_alarm_time alarm;
    
  2. 2.
    Set alarm to trigger on seconds only.
    alarm.mask = RTC_CALENDAR_ALARM_MASK_SEC;
    
  3. 3.
    Add one second to the current time and set new alarm.
    alarm.time.second += 5;
    alarm.time.second = alarm.time.second % 60;
    
    rtc_calendar_set_alarm(&rtc_instance, &alarm, RTC_CALENDAR_ALARM_0);