diff options
Diffstat (limited to 'watch-library/simulator/watch/watch_uart.c')
-rw-r--r-- | watch-library/simulator/watch/watch_uart.c | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/watch-library/simulator/watch/watch_uart.c b/watch-library/simulator/watch/watch_uart.c index e37fabff..7043383c 100644 --- a/watch-library/simulator/watch/watch_uart.c +++ b/watch-library/simulator/watch/watch_uart.c @@ -22,37 +22,30 @@ * SOFTWARE. */ - /* - * UART methods are Copyright (c) 2014-2017, Alex Taradov <alex@taradov.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - #include "watch_uart.h" #include "peripheral_clk_config.h" +static bool tx_enable = false; +static bool rx_enable = false; + +void watch_enable_uart(const uint8_t tx_pin, const uint8_t rx_pin, uint32_t baud) { + tx_enable = !!tx_pin; + rx_enable = !!rx_pin; +} + +void watch_uart_puts(char *s) { + if (tx_enable) { + // TODO: hook up to UI + } +} + +char watch_uart_getc(void) { + if (rx_enable) { + // TODO: hook up to UI + } + return 0; +} + void watch_enable_debug_uart(uint32_t baud) {} void watch_debug_putc(char c) {} |