8000 emscripten: rename stdout_core to stdio_core.c · matthewelse/micropython@0e42258 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0e42258

Browse files
committed
emscripten: rename stdout_core to stdio_core.c
1 parent 3112b4b commit 0e42258

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

emscripten/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ LIBS =
6262

6363
SRC_C = \
6464
main.c \
65-
uart_core.c \
65+
stdio_core.c \
6666
lib/utils/stdout_helpers.c \
6767
lib/utils/pyexec.c \
6868
lib/mp-readline/readline.c \

emscripten/stdio_core.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <unistd.h>
2+
#include "stdio.h"
3+
#include "py/mpconfig.h"
4+
5+
/*
6+
* Core UART functions to implement for a port
7+
*/
8+
9+
#if MICROPY_MIN_USE_STM32_MCU
10+
typedef struct {
11+
volatile uint32_t SR;
12+
volatile uint32_t DR;
13+
} periph_uart_t;
14+
#define USART1 ((periph_uart_t*)0x40011000)
15+
#endif
16+
17+
// Receive single character
18+
int mp_hal_stdin_rx_chr(void) {
19+
unsigned char c = 0;
20+
fread(&c, 1, 1, stdin);
21+
return c;
22+
}
23+
24+
// Send string of given length
25+
void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
26+
fwrite(str, len, 1, stdout);
27+
}

0 commit comments

Comments
 (0)
0