summaryrefslogtreecommitdiff
path: root/zephyr/uart_core.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-07-22 20:18:17 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-10-10 01:35:14 +0300
commitcff9f02cd735d344552f8c1d6c176e51f5c7f94b (patch)
tree7a1982ba9f0c75aae88c22e4948657f34ab666e4 /zephyr/uart_core.c
parentfa5ac678fc628775a4c65a19bbaea02ef05b25dc (diff)
zephyr: Initial Zephyr RTOS port, MicroPython part.
Diffstat (limited to 'zephyr/uart_core.c')
-rw-r--r--zephyr/uart_core.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/zephyr/uart_core.c b/zephyr/uart_core.c
new file mode 100644
index 000000000..5f48f973f
--- /dev/null
+++ b/zephyr/uart_core.c
@@ -0,0 +1,22 @@
+#include <unistd.h>
+#include "py/mpconfig.h"
+#include "src/zephyr_getchar.h"
+
+// Stopgap
+extern void printk(const char*, ...);
+
+/*
+ * Core UART functions to implement for a port
+ */
+
+// Receive single character
+int mp_hal_stdin_rx_chr(void) {
+ return zephyr_getchar();
+}
+
+// Send string of given length
+void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
+ while (len--) {
+ printk("%c", *str++);
+ }
+}