Don't flush USB all the time in dbg-arch
#include "uarte-arch.h"
#include "usb.h"
/*---------------------------------------------------------------------------*/
+#if PLATFORM_DBG_CONF_USB
+#define write_byte(b) usb_write((uint8_t *)&b, sizeof(uint8_t))
+#define flush() usb_flush()
+#else /* PLATFORM_DBG_CONF_USB */
+#define write_byte(b) uarte_write(b)
+#define flush()
+#endif /* PLATFORM_DBG_CONF_USB */
+/*---------------------------------------------------------------------------*/
+int
+dbg_putchar(int c)
+{
+ write_byte(c);
+
+ if(c == '\n') {
+ flush();
+ }
+
+ return c;
+}
+/*---------------------------------------------------------------------------*/
unsigned int
dbg_send_bytes(const unsigned char *s, unsigned int len)
{
-#if PLATFORM_DBG_CONF_USB
- usb_write((uint8_t *)s, len);
-
- return len;
-#else /* PLATFORM_DBG_CONF_USB */
unsigned int i = 0;
while(s && *s != 0) {
if(i >= len) {
break;
}
- uarte_write(*s);
- s++;
+ dbg_putchar(*s++);
i++;
}
- return i;
-#endif /* PLATFORM_DBG_CONF_USB */
-
+ flush();
-}
-/*---------------------------------------------------------------------------*/
-int
-dbg_putchar(int c)
-{
-#if PLATFORM_DBG_CONF_USB
- usb_write((uint8_t *)&c, sizeof(c));
-#else /* PLATFORM_DBG_CONF_USB */
- uarte_write(c);
-#endif /* PLATFORM_DBG_CONF_USB */
- return c;
+ return i;
}
/*---------------------------------------------------------------------------*/
/**
