Move to PFP block in main.c and use more standard logic

This commit is contained in:
2026-06-17 20:33:22 +02:00
parent 60849ebb78
commit 907c0b170d
2 changed files with 80 additions and 84 deletions
+3 -13
View File
@@ -47,20 +47,10 @@ extern "C" {
/* USER CODE BEGIN EM */ /* USER CODE BEGIN EM */
#define DEBUG #define DEBUG
#ifdef DEBUG #ifdef DEBUG
static inline void ITM_Print(const char *str) { #include <stdio.h>
while (*str) { #define DEBUG_PRINT(...) printf(__VA_ARGS__)
uint32_t timeout = 1000;
while ((ITM->PORT[0].u32 == 0) && (timeout-- > 0));
if (timeout > 0) {
ITM->PORT[0].u8 = (uint8_t)(*str);
}
str++;
}
}
#define DEBUG_PRINT(x) ITM_Print(x)
#else #else
#define DEBUG_PRINT(x) #define DEBUG_PRINT(...)
#endif #endif
/* USER CODE END EM */ /* USER CODE END EM */
+6
View File
@@ -76,6 +76,12 @@ static void MX_SDIO_SD_Init(void);
static void MX_USART1_UART_Init(void); static void MX_USART1_UART_Init(void);
/* USER CODE BEGIN PFP */ /* USER CODE BEGIN PFP */
int _write(int file, char *ptr, int len) {
for (int i = 0; i < len; i++) {
ITM_SendChar((*ptr++));
}
return len;
}
/* USER CODE END PFP */ /* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/ /* Private user code ---------------------------------------------------------*/