mbed_example / Mbed OS CRC_partial_example
Revision:
0:8e16fea6a7d2
Child:
1:77ae554366b9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Dec 18 22:40:37 2017 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "mbed_crc.h"
+#include "FastCRC.h"
+
+int main() {
+    FastCRC<uint32_t> ct(CRC_32BIT);
+
+    char  test[] = "123456789";
+    uint32_t crc;
+
+    ct.init();
+    ct.compute((void *)test, strlen((const char*)test), &crc);
+    
+    printf("The CRC of 0x%x \"123456789\" is \"0xCBF43926\" Result: 0x%x\n", 
+                            ct.get_polynomial(), crc);
+    
+    
+    ct.compute_partial_start(&crc);
+    ct.compute_partial((void *)&test, 4, &crc);
+    ct.compute_partial((void *)&test[4], 5, &crc);
+    ct.compute_partial_stop(&crc);
+    
+    printf("The CRC of 0x%x \"123456789\" is \"0xCBF43926\" Result: 0x%x\n", 
+                            ct.get_polynomial(), crc);
+    
+    ct.deinit();
+    return 0;
+}