Skip to Content
Hands-On RTOS with Microcontrollers
book

Hands-On RTOS with Microcontrollers

by Brian Amos
May 2020
Intermediate to advanced
496 pages
13h 54m
English
Packt Publishing
Content preview from Hands-On RTOS with Microcontrollers

Oneshot timers

A oneshot is a timer that fires only one time. These types of timers are common in both hardware and software and come in very handy when a fixed delay is desired. A oneshot timer can be used when you wish to execute a short piece of code after a fixed delay, without blocking the calling code by using vTaskDelay(). To set up a oneshot timer, a timer callback must be specified and a timer created.

The following is an excerpt from mainSoftwareTimers.c:

  1. Declare a Timer callback function that can be passed to xTimerCreate(). This callback is executed when the timer fires. Keep in mind that the callback is executed within the timer task, so it needs to be non-blocking!
void oneShotCallBack( TimerHandle_t xTimer );
  1. Create a timer. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On RTOS with Microcontrollers - Second Edition

Hands-On RTOS with Microcontrollers - Second Edition

Jim Yuill, Penn Linder

Publisher Resources

ISBN: 9781838826734Supplemental Content