desloges-libioulle / Mbed 2 deprecated app4_clockless

Dependencies:   mbed-rtos mbed

Committer:
libv2001
Date:
Mon Mar 06 21:35:31 2017 +0000
Revision:
1:9ba4618df7b5
Parent:
0:fc7bc75ace9b
Final Version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
libv2001 0:fc7bc75ace9b 1 #ifndef CRC_16_H
libv2001 0:fc7bc75ace9b 2 #define CRC_16_H
libv2001 0:fc7bc75ace9b 3
libv2001 0:fc7bc75ace9b 4 #include <stdint.h>
libv2001 0:fc7bc75ace9b 5
libv2001 0:fc7bc75ace9b 6 #define DEFAULT_POLYNOME 0x8005
libv2001 0:fc7bc75ace9b 7 #define DEFAULT_INITIAL_VALUE 0x0000
libv2001 0:fc7bc75ace9b 8 #define DEFAULT_XOR_OUT_VALUE 0x0000
libv2001 0:fc7bc75ace9b 9 #define DEFAULT_REVERSE_INPUT true
libv2001 0:fc7bc75ace9b 10 #define DEFUALT_REVERSE_OUTPUT true
libv2001 0:fc7bc75ace9b 11
libv2001 0:fc7bc75ace9b 12 struct crc_t{
libv2001 0:fc7bc75ace9b 13 uint16_t polynome;
libv2001 0:fc7bc75ace9b 14 uint16_t registre;
libv2001 0:fc7bc75ace9b 15 uint16_t initialValue;
libv2001 0:fc7bc75ace9b 16 uint16_t xorOut;
libv2001 0:fc7bc75ace9b 17 bool reverseIn;
libv2001 0:fc7bc75ace9b 18 bool reverseOut;
libv2001 0:fc7bc75ace9b 19 };
libv2001 0:fc7bc75ace9b 20
libv2001 0:fc7bc75ace9b 21 void initLookup(uint16_t polynome = DEFAULT_POLYNOME);
libv2001 0:fc7bc75ace9b 22
libv2001 0:fc7bc75ace9b 23 crc_t initCrc(uint16_t polynome = DEFAULT_POLYNOME,
libv2001 0:fc7bc75ace9b 24 uint16_t initialValue = DEFAULT_INITIAL_VALUE,
libv2001 0:fc7bc75ace9b 25 uint16_t xorOut = DEFAULT_XOR_OUT_VALUE,
libv2001 0:fc7bc75ace9b 26 bool reverseIn = DEFAULT_REVERSE_INPUT,
libv2001 0:fc7bc75ace9b 27 bool reverseOut = DEFUALT_REVERSE_OUTPUT);
libv2001 0:fc7bc75ace9b 28
libv2001 0:fc7bc75ace9b 29 void resetCrc(crc_t & crc);
libv2001 0:fc7bc75ace9b 30
libv2001 0:fc7bc75ace9b 31 void addByteToCrc(crc_t & crc, uint8_t byte);
libv2001 0:fc7bc75ace9b 32
libv2001 0:fc7bc75ace9b 33 uint16_t getCrc(crc_t & crc);
libv2001 0:fc7bc75ace9b 34
libv2001 0:fc7bc75ace9b 35 #endif