Remove UART DMA and use only semaphore and blocking transmit

This commit is contained in:
2026-06-24 14:01:59 +02:00
parent 54d7dfcfba
commit 069bca56a7
2 changed files with 9 additions and 33 deletions
+3 -12
View File
@@ -87,22 +87,17 @@ int _write(int file, char *ptr, int len)
return len;
}
#ifndef DEBUG_ITM
#ifndef DEBUG_ITW
#include <stdio.h>
#include <stdarg.h>
extern osSemaphoreId_t xUARTDMASemaphore;
extern osMutexId_t debugPrintMutex;
void uart_debug_print(const char *fmt, ...)
{
if (huart1.gState == HAL_UART_STATE_RESET) return;
if (osKernelGetState() == osKernelRunning)
{
osMutexAcquire(debugPrintMutex, osWaitForever);
osSemaphoreAcquire(xUARTDMASemaphore, osWaitForever);
}
if (osKernelGetState() == osKernelRunning) osSemaphoreAcquire(xUARTDMASemaphore, osWaitForever);
char buf[128];
va_list args;
@@ -113,11 +108,7 @@ void uart_debug_print(const char *fmt, ...)
if (len > 0) HAL_UART_Transmit(&huart1, (uint8_t*)buf, len, 100);
if (osKernelGetState() == osKernelRunning)
{
osSemaphoreRelease(xUARTDMASemaphore);
osMutexRelease(debugPrintMutex);
}
if (osKernelGetState() == osKernelRunning) osSemaphoreRelease(xUARTDMASemaphore);
}
#endif
/* USER CODE END PF */