Tool to dump contents of a data buffer in traditional terminal format. Some VT100 color commands used.

Dependents:   KL25Z_MLX90620

Revision:
3:4a6123f2a4c9
Parent:
2:e7f3ba216a14
Child:
4:c3c8b072f80f
--- a/PrintBuffer.cpp	Thu Jan 29 19:18:27 2015 +0000
+++ b/PrintBuffer.cpp	Thu May 14 16:40:04 2015 +0000
@@ -24,7 +24,7 @@
 // many 16 byte lines to print.
 
 int PrintBuffer::dump(const char* title, int BufferLines, int BufferOffset, const char buffer[]) {
-    pc.printf("\n%s%s - lines: %d   starting at: 0x%04x%s\n", DOMAGENTA, title, BufferLines, BufferOffset, DONONE);
+    pc.printf("\n%s%s - lines: %d   starting at: 0x%04x%s\r\n", DOMAGENTA, title, BufferLines, BufferOffset, DONONE);
     for(int i = BufferOffset; i < BufferLines * 16 + BufferOffset; i = i + 16) {
         pc.printf("%04x  ", i);
         for(int s = 0; s < 8; s++) {
@@ -50,9 +50,9 @@
                 pc.printf("%c", buffer[s + i + 8]);
             }
         }
-        pc.printf("\n");
+        pc.printf("\r\n");
     }
-    pc.printf("\n");
+    pc.printf("\r\n");
     return(0);
 }
 
@@ -61,7 +61,7 @@
 // many 16 byte lines to print.
 
 int PrintBuffer::dump_t(const char* title, int BufferLines, int BufferOffset, const uint8_t buffer[]) {
-    pc.printf("\n%s%s - lines: %d   starting at: 0x%04x%s\n", DOMAGENTA, title, BufferLines, BufferOffset, DONONE);
+    pc.printf("\n%s%s - lines: %d   starting at: 0x%04x%s\r\n", DOMAGENTA, title, BufferLines, BufferOffset, DONONE);
     for(int i = BufferOffset; i < BufferLines * 16 + BufferOffset; i = i + 16) {
         pc.printf("%04x  ", i);
         for(int s = 0; s < 8; s++) {
@@ -87,9 +87,9 @@
                 pc.printf("%c", buffer[s + i + 8]);
             }
         }
-        pc.printf("\n");
+        pc.printf("\r\n");
     }
-    pc.printf("\n");
+    pc.printf("\r\n");
     return(0);
 }
 
@@ -98,7 +98,7 @@
 // many 16 byte lines to print.
 
 int PrintBuffer::dump_uc(const char* title, int BufferLines, int BufferOffset, const unsigned char buffer[]) {
-    pc.printf("\n%s%s - lines: %d   starting at: 0x%04x%s\n", DOMAGENTA, title, BufferLines, BufferOffset, DONONE);
+    pc.printf("\n%s%s - lines: %d   starting at: 0x%04x%s\r\n", DOMAGENTA, title, BufferLines, BufferOffset, DONONE);
     for(int i = BufferOffset; i < BufferLines * 16 + BufferOffset; i = i + 16) {
         pc.printf("%04x  ", i);
         for(int s = 0; s < 8; s++) {
@@ -124,9 +124,9 @@
                 pc.printf("%c", buffer[s + i + 8]);
             }
         }
-        pc.printf("\n");
+        pc.printf("\r\n");
     }
-    pc.printf("\n");
+    pc.printf("\r\n");
     return(0);
 }