This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ticks to ms calculation

app_timer.h contains a useful macro for getting from milliseconds to a number of timer ticks, given a prescaler value with which the timer was started:

#define APP_TIMER_TICKS(MS, PRESCALER)\
        ((uint32_t)ROUNDED_DIV((MS) * (uint64_t)APP_TIMER_CLOCK_FREQ, ((PRESCALER) + 1) * 1000))

Supposing I know a certain number of ticks have elapsed since a certain time, and I want to know how many milliseconds that is. Is there a macro for that? What would one look like? I have something here but it looks like it's overflowing long before it should.

Parents Reply Children
No Data
Related