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

main.cpp

Committer:
Maciej Bocianski
Date:
2018-10-24
Revision:
3:d4c48b62da22
Parent:
2:834c44916a38

File content as of revision 3:d4c48b62da22:

#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%lx \"123456789\" is \"0xCBF43926\" Result: 0x%lx\n", 
                            ct.get_polynomial(), crc);
    
    return 0;
}