Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Documentation): Fixed misleading return doc for MXC_UART_INit #1214

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
*/
/*************************************************************************************************/

#include "util/terminal.h"

#include "pal_uart.h"
#include "pal_led.h"
#include "pal_sys.h"
Expand Down Expand Up @@ -92,7 +94,12 @@ void UART_CommonHandler(mxc_uart_regs_t *uart)
{
const uint8_t uartIdx = MXC_UART_GET_IDX(uart);

if( uartIdx == CONSOLE_UART || uartIdx == HCI_UART)
if(uartIdx == CONSOLE_UART)
{
TerminalFlush();
MXC_UART_ClearRXFIFO(uart);
}
else if(uartIdx == HCI_UART)
{
MXC_UART_ClearRXFIFO(uart);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
*/
/*************************************************************************************************/

#include "util/terminal.h"

#include "pal_uart.h"
#include "pal_led.h"
#include "pal_sys.h"
Expand Down Expand Up @@ -90,10 +92,16 @@ void UART_CommonHandler(mxc_uart_regs_t *uart)
{
const uint8_t uartIdx = MXC_UART_GET_IDX(uart);

if( uartIdx == CONSOLE_UART || uartIdx == HCI_UART)
if( uartIdx == CONSOLE_UART)
{
TerminalFlush();
MXC_UART_ClearRXFIFO(uart);
}
else if(uartIdx == HCI_UART)
{
MXC_UART_ClearRXFIFO(uart);
}

else
{
PAL_SYS_ASSERT(err == E_NO_ERROR);
Expand Down
7 changes: 7 additions & 0 deletions Libraries/Cordio/wsf/include/util/terminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ void TerminalTxPrint(const char *pStr, ...);
/*************************************************************************************************/
void TerminalTx(const uint8_t *pData, uint16_t len);

/*************************************************************************************************/
/*!
* \brief Flush terminal parser
*/
/*************************************************************************************************/
void TerminalFlush(void);

/*! \} */ /* WSF_UTIL_API */

#endif /* TERMINAL_H */
6 changes: 6 additions & 0 deletions Libraries/Cordio/wsf/sources/util/terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,3 +496,9 @@ static uint8_t terminalCommandEchoHandler(uint32_t argc, char **argv)
return TERMINAL_ERROR_OK;
}


void TerminalFlush(void)
{
memset(terminalCb.buf, 0, TERMINAL_MAX_COMMAND_LEN + 1);
terminalCb.bufOffset = 0;
}
2 changes: 1 addition & 1 deletion Libraries/PeriphDrivers/Include/MAX32665/uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ struct _mxc_uart_req_t {
* @param map MAP_A or MAP_B uart pins select, Has no effect incase of
* MSDK_NO_GPIO_CLK_INIT has been defined.
*
* @return If successful, the actual clock frequency is returned. Otherwise, see
* @return E_NO_ERROR if successful, the actual clock frequency is returned. Otherwise, see
* \ref MXC_Error_Codes for a list of return codes.
*/
int MXC_UART_Init(mxc_uart_regs_t *uart, unsigned int baud, sys_map_t map);
Expand Down
Loading