]> git.friedersdorff.com Git - max/tmk_keyboard.git/blobdiff - print.c
Refactored bootloader jumping. Added USBaspLoader support.
[max/tmk_keyboard.git] / print.c
diff --git a/print.c b/print.c
index 59b4bca1800f85576d01ad5004fc1b6cf63c7cd2..558181ea728f98e60b80ce9f43526854ae517aef 100644 (file)
--- a/print.c
+++ b/print.c
  * THE SOFTWARE.
  */
 
-// Version 1.0: Initial Release
-
 #include <avr/io.h>
 #include <avr/pgmspace.h>
 #include "print.h"
+#include "sendchar.h"
 
 
 bool print_enable = false;
 
+void print_S(const char *s)
+{
+       if (!print_enable) return;
+       char c;
+
+       while (1) {
+               c = *s++;
+               if (!c) break;
+               if (c == '\n') sendchar('\r');
+               sendchar(c);
+       }
+}
+
 void print_P(const char *s)
 {
        if (!print_enable) return;
@@ -38,15 +50,15 @@ void print_P(const char *s)
        while (1) {
                c = pgm_read_byte(s++);
                if (!c) break;
-               if (c == '\n') usb_debug_putchar('\r');
-               usb_debug_putchar(c);
+               if (c == '\n') sendchar('\r');
+               sendchar(c);
        }
 }
 
 void phex1(unsigned char c)
 {
        if (!print_enable) return;
-       usb_debug_putchar(c + ((c < 10) ? '0' : 'A' - 10));
+       sendchar(c + ((c < 10) ? '0' : 'A' - 10));
 }
 
 void phex(unsigned char c)
@@ -68,7 +80,7 @@ void pbin(unsigned char c)
 {
     if (!print_enable) return;
     for (int i = 7; i >= 0; i--) {
-        usb_debug_putchar((c & (1<<i)) ? '1' : '0');
+        sendchar((c & (1<<i)) ? '1' : '0');
     }
 }
 
@@ -76,6 +88,6 @@ void pbin_reverse(unsigned char c)
 {
     if (!print_enable) return;
     for (int i = 0; i < 8; i++) {
-        usb_debug_putchar((c & (1<<i)) ? '1' : '0');
+        sendchar((c & (1<<i)) ? '1' : '0');
     }
 }