Hello!
I want switch tasking in my way of code execution
For do this I use queues, but it doesnt resolve all cases
I have several threads
Threads data is on the queues
But I need to check UART data comming in another threads by default or in IDLE state. This thread do not reveive anything from queue.
How can I take control to switch to this thread from another thread, without queue?
In UART thread I check uart->Instance->SR on UART_IDLEFL
UART Thread:
void startUartProc(void *argument)
{
UART_HandleTypeDef* uartRx = uartProc;
char* bufferPoint = uartProcBuffer;
for(;;)
{
if (uart_idle(uartRx) == uY)
{
if(TCP_en)
{
bufferPoint = data_proc(TCPProcHandle, bPoint);
}
else
bufferPoint = data_proc(uartProcHandle, bPoint);
}
osDelay(10);
}
}
UART init
static void MX_UART7_Init(void)
{
/* USER CODE BEGIN UART7_Init 0 */
/* USER CODE END UART7_Init 0 */
/* USER CODE BEGIN UART7_Init 1 */
/* USER CODE END UART7_Init 1 */
huart7.Instance = UART7;
huart7.Init.BaudRate = 115200;
huart7.Init.WordLength = UART_WORDLENGTH_8B;
huart7.Init.StopBits = UART_STOPBITS_1;
huart7.Init.Parity = UART_PARITY_NONE;
huart7.Init.Mode = UART_MODE_TX_RX;
huart7.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart7.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(&huart7) != HAL_OK)
{
Error_Handler();
}
}
Thanks in advance