Implementation of CRC16 using polynomial 0x8005 = X^16 + X^15 + X^2 + 1

Dependents:   Manchester_Transmitter Manchester_Receiver ManchesterUART_Transmitter ManchesterUART_Receiver

Fork of CRC16 by Emilie Laverge

Committer:
hudakz
Date:
Sun Sep 03 08:28:01 2017 +0000
Revision:
3:3f5622979e77
Parent:
2:a01521fb2fe1
Function parameter added for setting initial CRC value. Defaults to 0x0000.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hudakz 1:352debdce7b3 1 /*
hudakz 1:352debdce7b3 2 * This is a fork of the CRC16 library COPYRIGHT(c) Emilie Laverge
hudakz 1:352debdce7b3 3 * published at [https://developer.mbed.org/users/EmLa/code/CRC16/]
hudakz 3:3f5622979e77 4 * using the polynomial 0x8005: X^16 + X^15 + X^2 + 1.
hudakz 3:3f5622979e77 5 * Default initial CRC value = 0x0000
hudakz 1:352debdce7b3 6 *
hudakz 1:352debdce7b3 7 * Modified by Zoltan Hudak
hudakz 1:352debdce7b3 8 */
hudakz 1:352debdce7b3 9
EmLa 0:585ead300cab 10 #ifndef CRC16_H
EmLa 0:585ead300cab 11 #define CRC16_H
EmLa 0:585ead300cab 12
hudakz 1:352debdce7b3 13 class CRC16
EmLa 0:585ead300cab 14 {
hudakz 1:352debdce7b3 15 private:
hudakz 1:352debdce7b3 16 static const unsigned int SHIFTER;
hudakz 1:352debdce7b3 17 static const unsigned short TABLE[];
hudakz 1:352debdce7b3 18 public:
hudakz 3:3f5622979e77 19 CRC16(void){};
hudakz 3:3f5622979e77 20 ~CRC16(void){};
hudakz 3:3f5622979e77 21 unsigned short calc(char input[], int length, unsigned short crc = 0x0000);
EmLa 0:585ead300cab 22 };
hudakz 1:352debdce7b3 23 #endif // CRC16_H