mbed_example
/
CRC_partial_example
Example to show the usage of compute_partial API from CRC class.
Diff: main.cpp
- Revision:
- 2:834c44916a38
- Parent:
- 1:77ae554366b9
- Child:
- 3:d4c48b62da22
--- a/main.cpp Tue Jan 02 15:49:06 2018 +0000 +++ b/main.cpp Fri Mar 23 16:22:33 2018 +0000 @@ -1,19 +1,11 @@ #include "mbed.h" -#include "FastCRC.h" int main() { - FastCRC ct(CRC_32BIT); + MbedCRC<POLY_32BIT_ANSI, 32> ct; 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); @@ -22,6 +14,5 @@ printf("The CRC of 0x%x \"123456789\" is \"0xCBF43926\" Result: 0x%x\n", ct.get_polynomial(), crc); - ct.deinit(); return 0; }