summaryrefslogtreecommitdiffstatshomepage
path: root/zephyr/uart_core.c
diff options
context:
space:
mode:
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 0000000000..5f48f973f6
--- /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++);
+ }
+}