MAX20361 System Demo with Low Power 2 mode

Dependencies:   SX1276GenericLib USBDevice

Fork of NonPingPong_PICO_LoRa by Walter Luu

Revision:
3:85fc843a9d7d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils.cpp	Mon Oct 12 21:55:22 2020 +0000
@@ -0,0 +1,65 @@
+void dump(const char *title, const void *data, int len, bool dwords)
+{
+//    dprintf("dump(\"%s\", 0x%x, %d bytes)", title, data, len);
+//    pc.printf("dump(\"%s\", 0x%x, %d bytes)", title, data, len);
+
+    int i, j, cnt;
+    unsigned char *u;
+    const int width = 16;
+    const int seppos = 7;
+
+    cnt = 0;
+    u = (unsigned char *)data;
+    while (len > 0) {
+//        rprintf("%08x: ", (unsigned int)data + cnt);
+//        pc.printf("%08x: ", (unsigned int)data + cnt);          //comment out
+        if (dwords) {
+            unsigned int *ip = ( unsigned int *)u;
+//            rprintf(" 0x%08x\r\n", *ip);
+//            pc.printf(" 0x%08x\r\n", *ip);                         //comment out
+            u+= 4;
+            len -= 4;
+            cnt += 4;
+            continue;
+        }
+        cnt += width;
+        j = len < width ? len : width;
+        for (i = 0; i < j; i++) {
+//            rprintf("%2.2x ", *(u + i));
+//            pc.printf("%2.2x ", *(u + i));           //comment out
+//            if (i == seppos)
+//                rprintf(" ");
+//                pc.printf(" ");                        //comment out
+        }
+//        rprintf(" ");
+//        pc.printf(" ");                                 //comment out
+        if (j < width) {
+            i = width - j;
+//            if (i > seppos + 1)
+//                rprintf(" ");
+//                pc.printf(" ");                           //comment out
+            while (i--) {
+//                rprintf("%s", "   ");
+//                pc.printf("%s", "   ");                      //comment out
+            }
+        }
+        for (i = 0; i < j; i++) {
+            int c = *(u + i);
+//            if (c >= ' ' && c <= '~')
+//                rprintf("%c", c);
+//                pc.printf("%c", c);                              //comment out
+//            else
+//                rprintf(".");
+//                pc.printf(".");                              //comment out
+//            if (i == seppos)
+//                rprintf(" ");
+//                pc.printf(" ");                                 //comment out             
+        }
+        len -= width;
+        u += width;
+//        rprintf("\r\n");
+//        pc.printf("\r\n");                                       //comment out
+    }
+//    rprintf("--\r\n");
+//    pc.printf("--\r\n");                                         //comment out
+}
\ No newline at end of file