summaryrefslogtreecommitdiffstatshomepage
path: root/stm/printf.c
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-10-21 23:46:04 +0100
committerDamien <damien.p.george@gmail.com>2013-10-21 23:46:04 +0100
commit3f69aca2e23c9479320b9de545eae1d3d8983d35 (patch)
tree169c0a479165ba8e18d7b20ccdcf472c7a556576 /stm/printf.c
parentdcced92c265ba67d467251cf8cacac427ec5951c (diff)
downloadmicropython-3f69aca2e23c9479320b9de545eae1d3d8983d35.tar.gz
micropython-3f69aca2e23c9479320b9de545eae1d3d8983d35.zip
Make stm use garbage collector.
Diffstat (limited to 'stm/printf.c')
-rw-r--r--stm/printf.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/stm/printf.c b/stm/printf.c
index 31ab8c3d27..821b790b4b 100644
--- a/stm/printf.c
+++ b/stm/printf.c
@@ -1,5 +1,8 @@
#include <stdarg.h>
#include "std.h"
+#include "misc.h"
+#include "lcd.h"
+#include "usb.h"
#define PF_FLAG_LEFT_ADJUST (0x01)
#define PF_FLAG_SHOW_SIGN (0x02)
@@ -208,13 +211,13 @@ int pfenv_printf(const pfenv_t *pfenv, const char *fmt, va_list args) {
return chrs;
}
-void lcd_print_strn(const char *str, unsigned int len);
-void usb_vcp_send_strn(const char* str, int len);
-
void stdout_print_strn(void *data, const char *str, unsigned int len) {
// send stdout to LCD and USB CDC VCP
- lcd_print_strn(str, len);
- usb_vcp_send_strn(str, len);
+ if (usb_vcp_is_enabled()) {
+ usb_vcp_send_strn(str, len);
+ } else {
+ lcd_print_strn(str, len);
+ }
}
static const pfenv_t pfenv_stdout = {0, stdout_print_strn};