Hi,
I am using LP-CC1311P3 and I wrote a callback function to receive data from UART.
I am using UART2 driver from TI.
My callback function is listed below:
void ReceiveUartCallback(UART2_Handle handle, void *buffer, size_t count, void *userArg, int_fast16_t status)
{
size_t i;
size_t numBytesRead;
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
if (handle == uart)
{
if (status == UART2_STATUS_SUCCESS)
{
numBytesRead = count;
if (numBytesRead > 0)
{
for (i = 0; i < numBytesRead; i++)
{
xQueueSendFromISR(queueConsoleRx, &buffer[i], &xHigherPriorityTaskWoken);
}
UART2_read(uart, consoleBufferRx, CONSOLE_BUFFER_LEN_RX, NULL);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
}
}
}
My questions are:
Can I call 'UART2_read' from inside the readCallback function?
Is the 'UART2_read' function ISR-safe ?
OBS: I am assuming the readCallback function is called from a ISR (hardware interrupt context).
Thanks,
Fabiano