From 164219c942e5c2c804d7d69e1b9ef5e34e503d6b Mon Sep 17 00:00:00 2001 From: EmanuelFeru Date: Thu, 10 Dec 2020 19:43:12 +0100 Subject: [PATCH] Update util.c missed some #ifdef --- Src/util.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/Src/util.c b/Src/util.c index d2add04..bfae6ce 100644 --- a/Src/util.c +++ b/Src/util.c @@ -201,27 +201,27 @@ static uint8_t standstillAcv = 0; /* =========================== Retargeting printf =========================== */ /* retarget the C library printf function to the USART */ #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) - #ifdef __GNUC__ - #define PUTCHAR_PROTOTYPE int __io_putchar(int ch) - #else - #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) + #ifdef __GNUC__ + #define PUTCHAR_PROTOTYPE int __io_putchar(int ch) + #else + #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) + #endif + PUTCHAR_PROTOTYPE { + #if defined(DEBUG_SERIAL_USART2) + HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 1000); + #elif defined(DEBUG_SERIAL_USART3) + HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 1000); #endif - PUTCHAR_PROTOTYPE { - #if defined(DEBUG_SERIAL_USART2) - HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 1000); - #elif defined(DEBUG_SERIAL_USART3) - HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 1000); - #endif - return ch; + return ch; + } + + #ifdef __GNUC__ + int _write(int file, char *data, int len) { + int i; + for (i = 0; i < len; i++) { __io_putchar( *data++ );} + return len; } - - #ifdef __GNUC__ - int _write(int file, char *data, int len) { - int i; - for (i = 0; i < len; i++) { __io_putchar( *data++ );} - return len; - } - #endif + #endif #endif @@ -572,7 +572,9 @@ void adcCalibLim(void) { HAL_Delay(5); } + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) printf("Input1 is "); + #endif INPUT1_TYP_CAL = checkInputType(INPUT1_MIN_temp, INPUT1_MID_temp, INPUT1_MAX_temp); if (INPUT1_TYP_CAL == INPUT1_TYPE || INPUT1_TYPE == 3) { // Accept calibration only if the type is correct OR type was set to 3 (auto) INPUT1_MIN_CAL = INPUT1_MIN_temp + INPUT_MARGIN; @@ -588,7 +590,9 @@ void adcCalibLim(void) { #endif } + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) printf("Input2 is "); + #endif INPUT2_TYP_CAL = checkInputType(INPUT2_MIN_temp, INPUT2_MID_temp, INPUT2_MAX_temp); if (INPUT2_TYP_CAL == INPUT2_TYPE || INPUT2_TYPE == 3) { // Accept calibration only if the type is correct OR type was set to 3 (auto) INPUT2_MIN_CAL = INPUT2_MIN_temp + INPUT_MARGIN;