Do check UART only with semaphore protection
This commit is contained in:
+1
-2
@@ -131,14 +131,13 @@ void vUARTLogger(void *argument)
|
||||
|
||||
if (osMessageQueueGet(xUARTQueue, &message, NULL, queue_timeout) == osOK)
|
||||
{
|
||||
osSemaphoreAcquire(xUARTDMASemaphore, osWaitForever);
|
||||
if (huart1.gState != HAL_UART_STATE_READY)
|
||||
{
|
||||
HAL_UART_Abort(&huart1);
|
||||
HAL_UART_Init(&huart1);
|
||||
}
|
||||
|
||||
osSemaphoreAcquire(xUARTDMASemaphore, osWaitForever);
|
||||
|
||||
int len = format_can_message(tx_buffer, message.source, &message);
|
||||
HAL_UART_Transmit(&huart1, (uint8_t*)tx_buffer, len, 100);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user