BaseType_t xQueueSendFromISR
(
QueueHandle_t xQueue,
const void *pvItemToQueue,
BaseType_t *pxHigherPriorityTaskWoken
);
This is a macro that calls xQueueGenericSendFromISR(). It is included
for backward compatibility with versions of FreeRTOS that did not
include the xQueueSendToBackFromISR() and xQueueSendToFrontFromISR()
macros.
Post an item into the back of a queue. It is safe to use this function from within an interrupt service routine.
Items are queued by copy not reference so it is preferable to only queue small items, especially when called from
an ISR. In most cases it would be preferable to store a pointer to the item being queued.
void vBufferISR( void )
{
char cIn;
BaseType_t xHigherPriorityTaskWoken;
/* We have not woken a task at the start of the ISR. */
xHigherPriorityTaskWoken = pdFALSE;
/* Loop until the buffer is empty. */
do
{
/* Obtain a byte from the buffer. */
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
/* Post the byte. */
xQueueSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );
} while( portINPUT_BYTE( BUFFER_COUNT ) );
/* Now the buffer is empty we can switch context if necessary. */
if( xHigherPriorityTaskWoken )
{
/* Actual macro used here is port specific. */
taskYIELD_FROM_ISR ();
}
}
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.