From 5ebabcda4134dfac94967e43e7791354202c5b45 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Tue, 13 Jan 2015 04:02:56 +0200 Subject: minimal: Convert "bare-arm" port to "minimal" port. This enable libc functions, GC, and line-editing function. Also, UART emulation for POSIX systems is added. Emulation build is set as default. --- minimal/uart_core.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 minimal/uart_core.c (limited to 'minimal/uart_core.c') diff --git a/minimal/uart_core.c b/minimal/uart_core.c new file mode 100644 index 000000000..92c81ecc9 --- /dev/null +++ b/minimal/uart_core.c @@ -0,0 +1,24 @@ +#include +#include "py/mpconfig.h" + +/* + * Core UART functions to implement for a port + */ + +// Receive single character +int stdin_rx_chr(void) { + unsigned char c = 0; +#if MICROPY_MIN_USE_STDOUT + int r = read(0, &c, 1); + (void)r; +#endif + return c; +} + +// Send string of given length +void stdout_tx_strn(const char *str, mp_uint_t len) { +#if MICROPY_MIN_USE_STDOUT + int r = write(1, str, len); + (void)r; +#endif +} -- cgit v1.2.3