diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-12-17 00:48:56 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-12-17 00:48:56 +0300 |
commit | 56a514c193a246de3782a02cf0ae9b09b8563e9c (patch) | |
tree | 285a95d65b5b090b95cfe6a8bc58dd8033944d8d /zephyr/uart_core.c | |
parent | 0c59c30fdeba4479817fe8cf3e5f0e4345a0d927 (diff) | |
download | micropython-56a514c193a246de3782a02cf0ae9b09b8563e9c.tar.gz micropython-56a514c193a246de3782a02cf0ae9b09b8563e9c.zip |
zephyr/uart_core: Access console UART directly instead of printk() hack.
This is required to avoid extra level of output "cooking" ("\r\r\n") and
make test infrastructure work. On the other hand, this breaks somewhat
Zephyr console abstraction.
Diffstat (limited to 'zephyr/uart_core.c')
-rw-r--r-- | zephyr/uart_core.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/zephyr/uart_core.c b/zephyr/uart_core.c index 702c97d20a..1e85053cd2 100644 --- a/zephyr/uart_core.c +++ b/zephyr/uart_core.c @@ -26,9 +26,8 @@ #include <unistd.h> #include "py/mpconfig.h" #include "src/zephyr_getchar.h" - -// Stopgap -extern void printk(const char*, ...); +// Zephyr headers +#include <uart.h> /* * Core UART functions to implement for a port @@ -41,7 +40,12 @@ int mp_hal_stdin_rx_chr(void) { // Send string of given length void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) { + static struct device *uart_console_dev; + if (uart_console_dev == NULL) { + uart_console_dev = device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME); + } + while (len--) { - printk("%c", *str++); + uart_poll_out(uart_console_dev, *str++); } } |