RTC (Real Time Counter) or Application Timer example for nrf52840 in nRF_Connect_SDK

Nordic DevZone
Nordic DevZone

Hello, 

I want to keep perform some task periodically .. probably using tick timer / rtc / application timerof every 5 ms, to perform some task, without keeping the thread to sleep.

How do i implement it ?

Any API / example i can refer to ?

#define TIMEOUT_MS 5000 //milliseconds

main()
{
    uint32_t myTimer = 0;

    while(1)
    {
        //Do something every 5ms, indefinetely
        if (myTimer > ( get_systick() + TIMEOUT))
        {
            myTimer = get_systick();
            //do something
        }
    }
}

Parents Reply Children
Related