This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Software Timers using zephyr

I followed the  description Timers — Zephyr Project Documentation here.and implemented a basic timer functionality in thingy91.

volatile bool update_timer_expired=false;

static void update_timer_handler(struct k_timer *timer_id)
{
    LOG_INF("Timer expired in handler");
   update_timer_expired=true;

}

K_TIMER_DEFINE(update_timer, update_timer_handler, NULL);

and inside the main function and I am starting the timer and checking the if the flag is set or not .

void main()

{

LOG_INF("Starting timer");
k_timer_start(&update_timer, K_SECONDS(5),K_SECONDS(5));


while(1)
{
   if(update_timer_expired)
   {
       LOG_INF("Timer expired in main");
       update_timer_expired=false;

   }

}

}

but I dont get any info regaarding the expiration of the timer from the expiry function and also in main..there is no compilation errors or warnings...Is there anything else that I need to take care ? for eg. In thingy91_nrf9160ns.overlay file or prj.conf file ?

Parents Reply Children
Related