Implement safe UART semaphore release inside ISR
- It uses safe way to release semaphore - Yields in case task interrupted was of lower priority: UART has minimal latency
This commit is contained in:
+14
-2
@@ -20,5 +20,17 @@
|
||||
#include "cmsis_os.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart);
|
||||
void vUARTLogger(void *argument);
|
||||
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
|
||||
{
|
||||
if (huart->Instance == USART1)
|
||||
{
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
osSemaphoreReleaseFromISR(xUartDmaSem, &xHigherPriorityTaskWoken);
|
||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||
}
|
||||
}
|
||||
|
||||
void vUARTLogger(void *argument)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user