I want to keep perform some task periodically .. probably using tick timer of every 1 ms, so that only after every 4000ms, i can perform some task.
How do i implement it ?
Any API / example i can refer to ?
I want to keep perform some task periodically .. probably using tick timer of every 1 ms, so that only after every 4000ms, i can perform some task.
How do i implement it ?
Any API / example i can refer to ?
Hello,
Any more inputs / examples ?
Hello,
Any more inputs / examples ?
Hi Deep, very sorry for the delay.
Please have a look at this API: https://docs.zephyrproject.org/apidoc/latest/group__clock__apis.html
k_uptime_ticks is similar to SysTick. You should be able to run the same code, more or less. However, you need to be aware of the tick frequency possibly being different. Nordic's ticks are using 32.768kHz.
Hi Deep,
This is quite late, BUT in kernel.h you will also find uint32_t k_uptime_get() which returns you the milliseconds since boot. This will won't be affected by changes to the SysTick configuration presumably.
/** * @brief Get system uptime. * * This routine returns the elapsed time since the system booted, * in milliseconds. * * @note * While this function returns time in milliseconds, it does * not mean it has millisecond resolution. The actual resolution depends on * @kconfig{CONFIG_SYS_CLOCK_TICKS_PER_SEC} config option. * * @return Current uptime in milliseconds. */ static inline int64_t k_uptime_get(void) { return k_ticks_to_ms_floor64(k_uptime_ticks()); }