[feat][uart] add uart de-glitch value setting

This commit is contained in:
qqwang 2021-08-05 17:52:45 +08:00
parent 41def8e82e
commit 34a81fbe16
2 changed files with 5 additions and 0 deletions

View file

@ -26,6 +26,8 @@
#include "drv_device.h"
#include "bl702_config.h"
#define UART_FIFO_LEN 128
#define DEVICE_CTRL_UART_GET_TX_FIFO 0x10
#define DEVICE_CTRL_UART_GET_RX_FIFO 0x11

View file

@ -74,12 +74,15 @@ int uart_open(struct device *dev, uint16_t oflag)
uart_cfg.txLinMode = UART_TX_LINMODE_ENABLE;
uart_cfg.rxLinMode = UART_RX_LINMODE_ENABLE;
uart_cfg.txBreakBitCnt = UART_TX_BREAKBIT_CNT;
uart_cfg.rxDeglitch = ENABLE;
/* uart init with default configuration */
UART_Init(uart_device->id, &uart_cfg);
/* Enable tx free run mode */
UART_TxFreeRun(uart_device->id, ENABLE);
/*set de-glitch function cycle count value*/
UART_SetDeglitchCount(uart_device->id, 2);
/* Set rx time-out value */
UART_SetRxTimeoutValue(uart_device->id, UART_DEFAULT_RTO_TIMEOUT);