[nrf52840] fix uart configuration of HWFC (#3277)

This commit is contained in:
Łukasz Duda
2018-11-12 15:52:20 -08:00
committed by Jonathan Hui
parent 90593db103
commit 90dd7a42d0
2 changed files with 9 additions and 12 deletions
@@ -73,17 +73,13 @@
#endif
/**
* @def UART_HWFC
* @def UART_HWFC_ENABLED
*
* UART Hardware Flow Control.
*
* @brief Possible values:
* \ref NRF_UART_HWFC_ENABLED - HW Flow control enabled.
* \ref NRF_UART_HWFC_DISABLED - HW Flow control disabled.
* Enable UART Hardware Flow Control.
*
*/
#ifndef UART_HWFC
#define UART_HWFC NRF_UART_HWFC_ENABLED
#ifndef UART_HWFC_ENABLED
#define UART_HWFC_ENABLED 1
#endif
/**
+5 -4
View File
@@ -175,20 +175,21 @@ otError otPlatUartEnable(void)
nrf_gpio_cfg_input(UART_PIN_RX, NRF_GPIO_PIN_NOPULL);
nrf_uart_txrx_pins_set(UART_INSTANCE, UART_PIN_TX, UART_PIN_RX);
#if (UART_HWFC == NRF_UART_HWFC_ENABLED)
#if (UART_HWFC_ENABLED == 1)
// Set up CTS and RTS pins.
nrf_gpio_cfg_input(UART_PIN_CTS, NRF_GPIO_PIN_NOPULL);
nrf_gpio_pin_set(UART_PIN_RTS);
nrf_gpio_cfg_output(UART_PIN_RTS);
nrf_uart_hwfc_pins_set(UART_INSTANCE, UART_PIN_RTS, UART_PIN_CTS);
nrf_uart_configure(UART_INSTANCE, UART_PARITY, NRF_UART_HWFC_ENABLED);
#else
nrf_uart_configure(UART_INSTANCE, UART_PARITY, NRF_UART_HWFC_DISABLED);
#endif
// Configure baudrate.
nrf_uart_baudrate_set(UART_INSTANCE, UART_BAUDRATE);
// Configure parity and hardware flow control.
nrf_uart_configure(UART_INSTANCE, UART_PARITY, UART_HWFC);
// Clear UART specific events.
nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_TXDRDY);
nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_ERROR);