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/deee95e6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/deee95e6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/deee95e6 Branch: refs/heads/sterly_refactor Commit: deee95e61b1051f7870fcbf60b36397657d435f4 Parents: d6e6a6b Author: Christopher Collins <[email protected]> Authored: Tue Aug 2 12:40:46 2016 -0700 Committer: Sterling Hughes <[email protected]> Committed: Tue Aug 9 16:05:21 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/deee95e6/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 3bc3e44..6c8d433 100644 --- a/hw/mcu/stm/stm32f4xx/src/hal_uart.c +++ b/hw/mcu/stm/stm32f4xx/src/hal_uart.c @@ -372,3 +372,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; +}
