diff options
author | Damien George <damien.p.george@gmail.com> | 2015-02-13 15:04:53 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-02-13 15:04:53 +0000 |
commit | 0b32e50365b6e36474e183a7240ccfc8fa56830a (patch) | |
tree | 101cf35f6844c50672af4f15b5866e226bcb47d9 /stmhal/main.c | |
parent | c385a639e6316cba4ff0e7a859325807857d8f00 (diff) |
stmhal: Make pybstdio usable by other ports, and use it.
Now all ports can use pybstdio.c to provide sys.stdin/stdout/stderr, so
long as they implement mp_hal_stdin_* and mp_hal_stdout_* functions.
Diffstat (limited to 'stmhal/main.c')
-rw-r--r-- | stmhal/main.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/stmhal/main.c b/stmhal/main.c index 2cb25d864..a53fd05ca 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -57,8 +57,8 @@ #include "accel.h" #include "servo.h" #include "dac.h" -#include "pybstdio.h" #include "modnetwork.h" +#include MICROPY_HAL_H void SystemClock_Config(void); @@ -86,8 +86,8 @@ void NORETURN __fatal_error(const char *msg) { led_state(2, 1); led_state(3, 1); led_state(4, 1); - stdout_tx_strn("\nFATAL ERROR:\n", 14); - stdout_tx_strn(msg, strlen(msg)); + mp_hal_stdout_tx_strn("\nFATAL ERROR:\n", 14); + mp_hal_stdout_tx_strn(msg, strlen(msg)); for (uint i = 0;;) { led_toggle(((i++) & 3) + 1); for (volatile uint delay = 0; delay < 10000000; delay++) { @@ -383,7 +383,7 @@ soft_reset: MP_OBJ_NEW_SMALL_INT(PYB_UART_6), MP_OBJ_NEW_SMALL_INT(115200), }; - pyb_stdio_uart = pyb_uart_type.make_new((mp_obj_t)&pyb_uart_type, MP_ARRAY_SIZE(args), 0, args); + MP_STATE_PORT(pyb_stdio_uart) = pyb_uart_type.make_new((mp_obj_t)&pyb_uart_type, MP_ARRAY_SIZE(args), 0, args); } #else MP_STATE_PORT(pyb_stdio_uart) = NULL; |