diff options
author | Damien <damien.p.george@gmail.com> | 2013-10-26 18:01:48 +0100 |
---|---|---|
committer | Damien <damien.p.george@gmail.com> | 2013-10-26 18:01:48 +0100 |
commit | 8f7491a109a555ca897ae49efe98f4cc2b080311 (patch) | |
tree | d988eec1cb50f28b2d193721e54ac277e568aa8b /stm/printf.c | |
parent | 9281cd66c9e0c82608259d8f345e4136cd6e0990 (diff) | |
download | micropython-8f7491a109a555ca897ae49efe98f4cc2b080311.tar.gz micropython-8f7491a109a555ca897ae49efe98f4cc2b080311.zip |
Add USART support, connected to stdio for REPL.
Diffstat (limited to 'stm/printf.c')
-rw-r--r-- | stm/printf.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/stm/printf.c b/stm/printf.c index 4c178b94be..d3f5a4d35c 100644 --- a/stm/printf.c +++ b/stm/printf.c @@ -3,6 +3,7 @@ #include "std.h" #include "misc.h" #include "lcd.h" +#include "usart.h" #include "usb.h" #define PF_FLAG_LEFT_ADJUST (0x01) @@ -213,10 +214,17 @@ int pfenv_printf(const pfenv_t *pfenv, const char *fmt, va_list args) { } void stdout_print_strn(void *data, const char *str, unsigned int len) { - // send stdout to LCD and USB CDC VCP + // send stdout to USART, USB CDC VCP, and LCD if nothing else + bool any = false; + if (usart_is_enabled()) { + usart_tx_strn_cooked(str, len); + any = true; + } if (usb_vcp_is_enabled()) { usb_vcp_send_strn_cooked(str, len); - } else { + any = true; + } + if (!any) { lcd_print_strn(str, len); } } |