Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kanndil committed Jan 16, 2025
1 parent b03023a commit 3b534e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions fw/EF_UART.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion fw/EF_UART.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);


/******************************************************************************
Expand Down

0 comments on commit 3b534e0

Please sign in to comment.