Example to show the usage of compute_partial API from CRC class.

main.cpp

Committer:
deepikabhavnani
Date:
20 months ago
Revision:
2:834c44916a38
Parent:
1:77ae554366b9
Child:
3:d4c48b62da22

File content as of revision 2:834c44916a38:

#include "mbed.h"

int main() {
    MbedCRC<POLY_32BIT_ANSI, 32> ct;

    char  test[] = "123456789";
    uint32_t 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);
    
    return 0;
}