You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/03/29 01:07:13 UTC

[10/17] incubator-mynewt-core git commit: native UART: Allow flow control.

native UART: Allow flow control.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/54086ace
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/54086ace
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/54086ace

Branch: refs/heads/develop
Commit: 54086acef681f69cea9aaa24aad1fb946614bded
Parents: 4fa3357
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Mar 27 17:03:46 2017 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Mar 28 16:58:41 2017 -0700

----------------------------------------------------------------------
 hw/mcu/native/src/native_uart_cfg.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/54086ace/hw/mcu/native/src/native_uart_cfg.c
----------------------------------------------------------------------
diff --git a/hw/mcu/native/src/native_uart_cfg.c b/hw/mcu/native/src/native_uart_cfg.c
index de6bd0b..75c1c22 100644
--- a/hw/mcu/native/src/native_uart_cfg.c
+++ b/hw/mcu/native/src/native_uart_cfg.c
@@ -167,8 +167,20 @@ uart_dev_set_attr(int fd, int32_t baudrate, uint8_t databits,
 
     tty.c_cflag |= (speed | CLOCAL | CREAD);
 
-    /* Disable flow control. */
-    tty.c_cflag &= ~CRTSCTS;
+    /* Set flow control. */
+    switch (flow_ctl) {
+    case HAL_UART_FLOW_CTL_NONE:
+        tty.c_cflag &= ~CRTSCTS;
+        break;
+
+    case HAL_UART_FLOW_CTL_RTS_CTS:
+        tty.c_cflag |= CRTSCTS;
+        break;
+
+    default:
+        fprintf(stderr, "invalid flow control setting: %d\n", flow_ctl);
+        return -1;
+    }
 
     errno = 0;
     rc = cfsetospeed(&tty, speed);