Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Enable the use of RTC0, RTC1 or RTC2 in app_timer2

Hi,

in SDK/components/libraries/timer/drv_rtc.h, there is some preprocessor define provided to select the RTC module (0, 1 or 2) used by app_timer2: APP_TIMER_V2_RTC0_ENABLED, APP_TIMER_V2_RTC1_ENABLED, APP_TIMER_V2_RTC2_ENABLE.

But in app_timer2.c, the RTC instance is fixed:

static drv_rtc_t m_rtc_inst = DRV_RTC_INSTANCE(1);

Can you change it to allow the other RTC instance to be used, like this:

#if defined(APP_TIMER_V2_RTC0_ENABLED)                                                                
static drv_rtc_t m_rtc_inst = DRV_RTC_INSTANCE(0);                                                    
#elif defined(APP_TIMER_V2_RTC1_ENABLED)                                                              
static drv_rtc_t m_rtc_inst = DRV_RTC_INSTANCE(1);                                                    
#elif defined(APP_TIMER_V2_RTC2_ENABLED)                                                              
static drv_rtc_t m_rtc_inst = DRV_RTC_INSTANCE(2);                                                    
#endif     

Thank you !

Best,

jym

Related