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

startReceiveInt

The startReceiveInt function is very similar to the one used for the queue-based driver:

static bool rxInProgress = false;static uint_fast16_t rxLen = 0;static uint8_t* rxBuff = NULL;static uint_fast16_t rxItr = 0;int32_t startReceiveInt( uint8_t* Buffer, uint_fast16_t Len ){    if(!rxInProgress && (Buffer != NULL))    {        rxInProgress = true;        rxLen = Len;        rxBuff = Buffer;        rxItr = 0;        USART2->CR3 |= USART_CR3_EIE; //enable error interrupts        USART2->CR1 |= (USART_CR1_UE | USART_CR1_RXNEIE);        NVIC_SetPriority(USART2_IRQn, 6);        NVIC_EnableIRQ(USART2_IRQn);        return 0;    }    return -1;}

Here are the notable differences in this setup:

  • This variant takes in a pointer to a buffer (Buffer), as well as the desired length of the transfer (Len). A couple ...
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