circuitpython/minimal/uart_core.c
Paul Sokolovsky 5ebabcda41 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.
2015-01-13 04:02:56 +02:00

25 lines
437 B
C

#include <unistd.h>
#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
}