olimex-e407 - hal_uart_close().

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/3a7f4e27
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/3a7f4e27
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/3a7f4e27

Branch: refs/heads/develop
Commit: 3a7f4e273004c88dc8c65bbfba7418caf5486a6c
Parents: fca8bc1
Author: Christopher Collins <[email protected]>
Authored: Tue Aug 2 12:40:46 2016 -0700
Committer: Christopher Collins <[email protected]>
Committed: Wed Aug 3 19:54:16 2016 -0700

----------------------------------------------------------------------
 hw/mcu/stm/stm32f4xx/src/hal_uart.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/3a7f4e27/hw/mcu/stm/stm32f4xx/src/hal_uart.c
----------------------------------------------------------------------
diff --git a/hw/mcu/stm/stm32f4xx/src/hal_uart.c 
b/hw/mcu/stm/stm32f4xx/src/hal_uart.c
index 3b2868f..43d83eb 100644
--- a/hw/mcu/stm/stm32f4xx/src/hal_uart.c
+++ b/hw/mcu/stm/stm32f4xx/src/hal_uart.c
@@ -371,3 +371,19 @@ hal_uart_config(int port, int32_t baudrate, uint8_t 
databits, uint8_t stopbits,
 
     return 0;
 }
+
+int
+hal_uart_close(int port)
+{
+    struct hal_uart *u;
+
+    if (port >= UART_CNT) {
+        return -1;
+    }
+    u = &uarts[port];
+
+    u->u_open = 0;
+    u->u_regs->CR1 = 0;
+
+    return 0;
+}

Reply via email to