14.10.1.2.3 Workflow

  1. Create a RTC configuration structure to hold the desired RTC driver settings.
    struct rtc_count_config config_rtc_count;
    
  2. Fill the configuration structure with the default driver configuration.
    rtc_count_get_config_defaults(&config_rtc_count);
    
    Note: This should always be performed before using the configuration struct to ensure that all values are initialized to known default settings.
  3. Alter the RTC driver configuration to run in 16-bit counting mode, with continuous counter register updates.
    config_rtc_count.prescaler           = RTC_COUNT_PRESCALER_DIV_1;
    config_rtc_count.mode                = RTC_COUNT_MODE_16BIT;
    #ifdef FEATURE_RTC_CONTINUOUSLY_UPDATED
        config_rtc_count.continuously_update = true;
    #endif
        config_rtc_count.compare_values[0]   = 1000;
    
  4. Initialize the RTC module.
    rtc_count_init(&rtc_instance, RTC, &config_rtc_count);
    
  5. Enable the RTC module, so that it may begin counting.
    rtc_count_enable(&rtc_instance);