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!
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!
Hi.
There is actually no need for those functions in FreeRTOS.
Instead, you can use
xTaskGetTickCount - which returns the count of ticks since vTaskStartScheduler was called.
(Ref: https://www.freertos.org/a00021.html#xTaskGetTickCount)
When using an RTOS, it is best to use RTOS features as much as possible.
Best regards,
Joakim
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
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