CRC example for SD driver

Files at this revision

API Documentation at this revision

Comitter:
Maciej Bocianski
Date:
Wed Oct 24 11:58:37 2018 +0200
Parent:
2:ee110889fa99
Commit message:
fix compilation warnings

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Mar 23 15:47:30 2018 +0000
+++ b/main.cpp	Wed Oct 24 11:58:37 2018 +0200
@@ -15,7 +15,7 @@
     ct.compute((void *)test, 5, &crc);
     // CRC 7-bit as 8-bit data
     crc = (crc | 0x01) & 0xFF;
-    printf("The CRC of 0x%x \"CMD0\" is \"0x95\" Result: 0x%x\n",
+    printf("The CRC of 0x%lx \"CMD0\" is \"0x95\" Result: 0x%lx\n",
            ct.get_polynomial(), crc);
 
     test[0] = 0x48;
@@ -27,7 +27,7 @@
     ct.compute((void *)test, 5, &crc);
     // CRC 7-bit as 8-bit data
     crc = (crc | 0x01) & 0xFF;
-    printf("The CRC of 0x%x \"CMD8\" is \"0x87\" Result: 0x%x\n",
+    printf("The CRC of 0x%lx \"CMD8\" is \"0x87\" Result: 0x%lx\n",
            ct.get_polynomial(), crc);
 
     test[0] = 0x51;
@@ -39,7 +39,7 @@
     ct.compute((void *)test, 5, &crc);
     // CRC 7-bit as 8-bit data
     crc = (crc | 0x01) & 0xFF;
-    printf("The CRC of 0x%x \"CMD17\" is \"0x55\" Result: 0x%x\n",
+    printf("The CRC of 0x%lx \"CMD17\" is \"0x55\" Result: 0x%lx\n",
            ct.get_polynomial(), crc);
 
     return 0;
@@ -54,7 +54,7 @@
     memset(test, 0xFF, 512);
     // 512 bytes with 0xFF data --> CRC16 = 0x7FA1
     sd.compute((void *)test, 512, &crc);
-    printf("16BIT SD CRC (512 bytes 0xFF) is \"0x7FA1\" Result: 0x%x\n", crc);
+    printf("16BIT SD CRC (512 bytes 0xFF) is \"0x7FA1\" Result: 0x%lx\n", crc);
     return 0;
 }