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

Setting up the code

There are only two significant differences in this example:

  • We'll use xSemaphoreCreateMutex() instead of xSemaphoreCreateBinarySemaphore().
  • No initial xSemaphoreGive() call is required since the mutex will be initialized with a value of 1. Mutexes are designed to be taken only when needed and then given back.

Here's our updated example with the only significant change. This excerpt can be found in mainMutexExample.c:

mutexPtr = xSemaphoreCreateMutex();assert_param(mutexPtr != NULL);

There are some additional name changes related to the semPtr to mutexPtr variable name change, but there is nothing functionally different.

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