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

uartPrintOutTask

The uartPrintOutTask function that is responsible for printing out data received by USART2 is a bit more complex in this example. This example is also capable of comparing the received data against an expected length, as well as some rudimentary error detection:

  1. The buffer and length variables are initialized and the UART peripheral is set up:
void uartPrintOutTask( void* NotUsed){  uint8_t rxData[20];  uint8_t expectedLen = 16;  memset((void*)rxData, 0, 20);  STM_UartInit(USART2, 9600, NULL, NULL);
  1. Then, the body of the while loop starts a reception by calling startReceiveInt and then waits for the rxDone semaphore for up to 100 RTOS ticks for the transfer to complete.
  2. If the transfer completes in time, the total number of ...
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