diff options
author | Damien George <damien@micropython.org> | 2025-06-23 12:56:04 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-07-08 10:10:16 +1000 |
commit | 4951a06bbb5b3987a8ac922c06b8764c083d168c (patch) | |
tree | efbc2a27cc67cab83770236bc8cb29fee5e2299d /ports/zephyr/src/zephyr_getchar.c | |
parent | 6b82eb75bef70d44ef583385301b7c483ac9ae94 (diff) |
zephyr: Enable sys.stdin/out/err.
This change enables `sys.stdin`, `sys.stdout` and `sys.stderr` objects.
They are useful for general IO, and also help with testing zephyr boards.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/zephyr/src/zephyr_getchar.c')
-rw-r--r-- | ports/zephyr/src/zephyr_getchar.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ports/zephyr/src/zephyr_getchar.c b/ports/zephyr/src/zephyr_getchar.c index 94e35e2e8..7660e3cc1 100644 --- a/ports/zephyr/src/zephyr_getchar.c +++ b/ports/zephyr/src/zephyr_getchar.c @@ -49,6 +49,11 @@ static int console_irq_input_hook(uint8_t ch) { return 1; } +// Returns true if a char is available for reading. +int zephyr_getchar_check(void) { + return i_get != i_put; +} + int zephyr_getchar(void) { mp_hal_wait_sem(&uart_sem, 0); if (k_sem_take(&uart_sem, K_MSEC(0)) == 0) { |