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

Freertos: app_timer_cnt_get and app_timer_cnt_diff_compute

Is there implementation of these functions available for Freertos version of app_timer?

app_timer_cnt_get()

app_timer_cnt_diff_compute()

they are required for LESC operations.

Thanks!

Parents Reply
  • I came up on the same issue while using libuarte with FreeRTOS. Interesting to see that these two functions are not implemented already inside app_timer_freertos.c

    One of the functions was given by Ali so I added the other one by copying from app_timer.c

    Here you can find both of them:

    uint32_t app_timer_cnt_get(void)
    {
        return xTaskGetTickCount();
    }
    
    uint32_t app_timer_cnt_diff_compute(uint32_t   ticks_to,
                                        uint32_t   ticks_from)
    {
        return ((ticks_to - ticks_from) & RTC_COUNTER_COUNTER_Msk);
    }

    You don't have to edit app_timer_freertos.c though. You can also define them in your main.c

Children
No Data
Related