Skip to content

Commit 39310b2

Browse files
authored
Merge pull request #2535 from nvlsianpu/uart_hwfc_config_2
nRF5x uart hardware flow control configuration using mbed configuration systsem
2 parents a4b5730 + b68b54e commit 39310b2

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

hal/targets.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,6 +1898,11 @@
18981898
"lf_clock_src": {
18991899
"value": "NRF_LF_SRC_XTAL",
19001900
"macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC"
1901+
},
1902+
"uart_hwfc": {
1903+
"help": "Value: 1 for enable, 0 for disable",
1904+
"value": 1,
1905+
"macro_name": "MBED_CONF_NORDIC_UART_HWFC"
19011906
}
19021907
}
19031908
},
@@ -1943,6 +1948,11 @@
19431948
"lf_clock_src": {
19441949
"value": "NRF_LF_SRC_XTAL",
19451950
"macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC"
1951+
},
1952+
"uart_hwfc": {
1953+
"help": "Value: 1 for enable, 0 for disable",
1954+
"value": 1,
1955+
"macro_name": "MBED_CONF_NORDIC_UART_HWFC"
19461956
}
19471957
}
19481958
},

hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/serial_api.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,19 @@
5858

5959
#define UART_DEFAULT_BAUDRATE UART0_CONFIG_BAUDRATE
6060
#define UART_DEFAULT_PARITY UART0_CONFIG_PARITY
61-
#define UART_DEFAULT_HWFC UART0_CONFIG_HWFC
61+
62+
// expected the macro from mbed configuration system
63+
#ifndef MBED_CONF_NORDIC_UART_HWFC
64+
#define MBED_CONF_NORDIC_UART_HWFC 1
65+
#warning None of UART flow control configuration (expected macro MBED_CONF_NORDIC_UART_HWFC). The RTSCTS flow control is used by default .
66+
#endif
67+
68+
#if MBED_CONF_NORDIC_UART_HWFC == 1
69+
#define UART_DEFAULT_HWFC UART0_CONFIG_HWFC
70+
#else
71+
#define UART_DEFAULT_HWFC NRF_UART_HWFC_DISABLED
72+
#endif
73+
6274
#define UART_DEFAULT_CTS UART0_CONFIG_PSEL_CTS
6375
#define UART_DEFAULT_RTS UART0_CONFIG_PSEL_RTS
6476

0 commit comments

Comments
 (0)