From 3b534e094ea281470255ed0356e6d0f4c023f05b Mon Sep 17 00:00:00 2001 From: Youssef Kandil Date: Thu, 16 Jan 2025 17:33:54 +0200 Subject: [PATCH] minor fixes --- fw/EF_UART.c | 15 ++++++++------- fw/EF_UART.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fw/EF_UART.c b/fw/EF_UART.c index 3dbb927..6968ea0 100644 --- a/fw/EF_UART.c +++ b/fw/EF_UART.c @@ -802,17 +802,18 @@ EF_DRIVER_STATUS UART_Init(EF_UART_TYPE_PTR uart, uint32_t baud_rate, uint32_t b if (status == EF_DRIVER_OK) {status = EF_UART_setTimeoutBits(uart, timeout);} else {} // Set RX and TX FIFO thresholds - if (status != EF_DRIVER_OK) {status = EF_UART_setRxFIFOThreshold(uart, rx_threshold);} else {} - if (status != EF_DRIVER_OK) {status = EF_UART_setTxFIFOThreshold(uart, tx_threshold);} else {} + if (status == EF_DRIVER_OK) {status = EF_UART_setRxFIFOThreshold(uart, rx_threshold);} else {} + if (status == EF_DRIVER_OK) {status = EF_UART_setTxFIFOThreshold(uart, tx_threshold);} else {} // Enable the UART and both RX and TX - if (status != EF_DRIVER_OK) {status = EF_UART_enable(uart);} else {} - if (status != EF_DRIVER_OK) {status = EF_UART_enableRx(uart);} else {} - if (status != EF_DRIVER_OK) {status = EF_UART_enableTx(uart);} else {} + if (status == EF_DRIVER_OK) {status = EF_UART_enable(uart);} else {} + if (status == EF_DRIVER_OK) {status = EF_UART_setGclkEnable(uart, (uint32_t)1);} else {} + if (status == EF_DRIVER_OK) {status = EF_UART_enableRx(uart);} else {} + if (status == EF_DRIVER_OK) {status = EF_UART_enableTx(uart);} else {} // Optionally enable glitch filter and loopback for testing - if (status != EF_DRIVER_OK) {status = EF_UART_enableGlitchFilter(uart);} else {} - if (status != EF_DRIVER_OK) {status = EF_UART_enableLoopBack(uart);} else {} + if (status == EF_DRIVER_OK) {status = EF_UART_enableGlitchFilter(uart);} else {} + if (status == EF_DRIVER_OK) {status = EF_UART_enableLoopBack(uart);} else {} return EF_DRIVER_OK; } diff --git a/fw/EF_UART.h b/fw/EF_UART.h index 41d1cfd..9763fbf 100644 --- a/fw/EF_UART.h +++ b/fw/EF_UART.h @@ -576,7 +576,7 @@ EF_DRIVER_STATUS UART_Init(EF_UART_TYPE_PTR uart, uint32_t baud_rate, uint32_t b \return status A value of type \ref EF_DRIVER_STATUS : returns a success or error code */ -EF_DRIVER_STATUS EF_UART_readCharArr(EF_UART_TYPE_PTR uart, char *buffer, size_t buffer_size); +EF_DRIVER_STATUS EF_UART_readCharArr(EF_UART_TYPE_PTR uart, char *buffer, uint32_t buffer_size); /******************************************************************************