Remove UART DMA and use only semaphore and blocking transmit
This commit is contained in:
+3
-12
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user