mbed_example
/
CRC_partial_example
Example to show the usage of compute_partial API from CRC class.
main.cpp
- Committer:
- deepikabhavnani
- Date:
- 2017-12-18
- Revision:
- 0:8e16fea6a7d2
- Child:
- 1:77ae554366b9
File content as of revision 0:8e16fea6a7d2:
#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; }