May 2020
Intermediate to advanced
496 pages
13h 54m
English
Here is the code for USART2_IRQHandler:
void USART2_IRQHandler( void ){ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; SEGGER_SYSVIEW_RecordEnterISR(); //error flag clearing omitted for brevity if( USART2->ISR & USART_ISR_RXNE_Msk) { uint8_t tempVal = (uint8_t) USART2->RDR; if(rxInProgress) { xQueueSendFromISR(uart2_BytesReceived, &tempVal, &xHigherPriorityTaskWoken); } SEGGER_SYSVIEW_RecordExitISR(); portYIELD_FROM_ISR(xHigherPriorityTaskWoken);}
Let's take a closer look at each component of the ISR: