Skip to content

Commit b68b54e

Browse files
committed
Introduce uart hardware flow control configuration using mbed configuraton system for nrf5x base-targets
1 parent 22acfbf commit b68b54e

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
@@ -1891,6 +1891,11 @@
18911891
"lf_clock_src": {
18921892
"value": "NRF_LF_SRC_XTAL",
18931893
"macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC"
1894+
},
1895+
"uart_hwfc": {
1896+
"help": "Value: 1 for enable, 0 for disable",
1897+
"value": 1,
1898+
"macro_name": "MBED_CONF_NORDIC_UART_HWFC"
18941899
}
18951900
}
18961901
},
@@ -1936,6 +1941,11 @@
19361941
"lf_clock_src": {
19371942
"value": "NRF_LF_SRC_XTAL",
19381943
"macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC"
1944+
},
1945+
"uart_hwfc": {
1946+
"help": "Value: 1 for enable, 0 for disable",
1947+
"value": 1,
1948+
"macro_name": "MBED_CONF_NORDIC_UART_HWFC"
19391949
}
19401950
}
19411951
},

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)