2015-01-12 21:02:56 -05:00
|
|
|
#include <unistd.h>
|
|
|
|
#include "py/mpconfig.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Core UART functions to implement for a port
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Receive single character
|
2015-02-13 10:26:53 -05:00
|
|
|
int mp_hal_stdin_rx_chr(void) {
|
2015-01-12 21:02:56 -05:00
|
|
|
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
|
2015-02-13 10:26:53 -05:00
|
|
|
void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
|
2015-01-12 21:02:56 -05:00
|
|
|
#if MICROPY_MIN_USE_STDOUT
|
|
|
|
int r = write(1, str, len);
|
|
|
|
(void)r;
|
|
|
|
#endif
|
|
|
|
}
|