From 2b3436e87c41fa001f527baa19f9bb446f8b56c6 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 8 Jun 2018 15:59:38 +0700 Subject: [PATCH] add feather nrf52 uart rts, cts support --- .../nrf/boards/feather52840/bluefruit_nrf52840_s140_6.0.0.ld | 2 +- ports/nrf/hal/hal_uart.c | 2 +- ports/nrf/supervisor/serial.c | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ports/nrf/boards/feather52840/bluefruit_nrf52840_s140_6.0.0.ld b/ports/nrf/boards/feather52840/bluefruit_nrf52840_s140_6.0.0.ld index fc185a3736..1865092852 100644 --- a/ports/nrf/boards/feather52840/bluefruit_nrf52840_s140_6.0.0.ld +++ b/ports/nrf/boards/feather52840/bluefruit_nrf52840_s140_6.0.0.ld @@ -41,6 +41,6 @@ _estack = ORIGIN(RAM) + LENGTH(RAM); /* RAM extents for the garbage collector */ _ram_end = ORIGIN(RAM) + LENGTH(RAM); -_heap_end = 0x20007000; /* tunable */ +_heap_end = 0x20020000; /* tunable */ INCLUDE "boards/common.ld" diff --git a/ports/nrf/hal/hal_uart.c b/ports/nrf/hal/hal_uart.c index b0a57a2a6e..810449d836 100644 --- a/ports/nrf/hal/hal_uart.c +++ b/ports/nrf/hal/hal_uart.c @@ -114,7 +114,7 @@ int hal_uart_available(NRF_UART_Type * p_instance) void hal_uart_init(NRF_UART_Type * p_instance, hal_uart_init_t const * p_uart_init) { hal_gpio_cfg_pin(p_uart_init->tx_pin->port, p_uart_init->tx_pin->pin, HAL_GPIO_MODE_OUTPUT, HAL_GPIO_PULL_DISABLED); - hal_gpio_cfg_pin(p_uart_init->tx_pin->port, p_uart_init->rx_pin->pin, HAL_GPIO_MODE_INPUT, HAL_GPIO_PULL_DISABLED); + hal_gpio_cfg_pin(p_uart_init->rx_pin->port, p_uart_init->rx_pin->pin, HAL_GPIO_MODE_INPUT, HAL_GPIO_PULL_DISABLED); hal_gpio_pin_clear(p_uart_init->tx_pin->port, p_uart_init->tx_pin->pin); diff --git a/ports/nrf/supervisor/serial.c b/ports/nrf/supervisor/serial.c index 51e61bce7c..ce801e371a 100644 --- a/ports/nrf/supervisor/serial.c +++ b/ports/nrf/supervisor/serial.c @@ -49,8 +49,13 @@ void serial_init(void) { .id = 0, .rx_pin = &MICROPY_HW_UART1_RX, .tx_pin = &MICROPY_HW_UART1_TX, +#if MICROPY_HW_UART1_HWFC + .rts_pin = &MICROPY_HW_UART1_RTS, + .cts_pin = &MICROPY_HW_UART1_CTS, +#else .rts_pin = NULL, .cts_pin = NULL, +#endif .flow_control = MICROPY_HW_UART1_HWFC ? true : false, .use_parity = false, .baud_rate = HAL_UART_BAUD_115K2,