1-Wire® library for mbed. Complete 1-Wire library that supports our silicon masters along with a bit-bang master on the MAX32600MBED platform with one common interface for mbed. Slave support has also been included and more slaves will be added as time permits.

Dependents:   MAXREFDES131_Qt_Demo MAX32630FTHR_iButton_uSD_Logger MAX32630FTHR_DS18B20_uSD_Logger MAXREFDES130_131_Demo ... more

Superseded by MaximInterface.

Committer:
IanBenzMaxim
Date:
Wed Jun 15 15:00:06 2016 -0500
Revision:
86:2ce08ca58b9e
Parent:
crc.h@80:83b0d879cc32
Child:
104:3f48daed532b
Updated to match new directory structure.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IanBenzMaxim 78:0cbbac7f2016 1 #ifndef OneWire_CRC
IanBenzMaxim 78:0cbbac7f2016 2 #define OneWire_CRC
IanBenzMaxim 78:0cbbac7f2016 3
IanBenzMaxim 78:0cbbac7f2016 4 #include <stdint.h>
IanBenzMaxim 78:0cbbac7f2016 5 #include <stddef.h>
IanBenzMaxim 78:0cbbac7f2016 6
IanBenzMaxim 78:0cbbac7f2016 7 namespace OneWire
IanBenzMaxim 78:0cbbac7f2016 8 {
IanBenzMaxim 78:0cbbac7f2016 9 namespace crc
IanBenzMaxim 78:0cbbac7f2016 10 {
j3 80:83b0d879cc32 11 /// Perform a CRC8 calculation.
j3 80:83b0d879cc32 12 /// @param crc8 Beginning state of the CRC generator.
j3 80:83b0d879cc32 13 /// @param data Data to pass though the CRC generator.
j3 80:83b0d879cc32 14 /// @returns The calculated CRC8.
j3 80:83b0d879cc32 15 uint8_t calculateCrc8(uint8_t crc8, uint8_t data);
j3 80:83b0d879cc32 16
j3 80:83b0d879cc32 17 /// Perform a CRC8 calculation with variable length data.
j3 80:83b0d879cc32 18 /// @param[in] data Data array to pass through the CRC generator.
j3 80:83b0d879cc32 19 /// @param dataLen Length of the data array to process.
j3 80:83b0d879cc32 20 /// @param crc Beginning state of the CRC generator.
j3 80:83b0d879cc32 21 /// @returns The calculated CRC8.
j3 80:83b0d879cc32 22 uint8_t calculateCrc8(const uint8_t * data, size_t dataLen, uint8_t crc = 0);
j3 80:83b0d879cc32 23
IanBenzMaxim 78:0cbbac7f2016 24 /// Perform a CRC16 calculation.
IanBenzMaxim 78:0cbbac7f2016 25 /// @param crc16 Beginning state of the CRC generator.
IanBenzMaxim 78:0cbbac7f2016 26 /// @param data Data to pass though the CRC generator.
IanBenzMaxim 78:0cbbac7f2016 27 /// @returns The calculated CRC16.
IanBenzMaxim 78:0cbbac7f2016 28 uint16_t calculateCrc16(uint16_t crc16, uint16_t data);
IanBenzMaxim 78:0cbbac7f2016 29
IanBenzMaxim 78:0cbbac7f2016 30 /// Perform a CRC16 calculation with variable length data.
IanBenzMaxim 78:0cbbac7f2016 31 /// @param[in] data Data array to pass through the CRC generator.
IanBenzMaxim 78:0cbbac7f2016 32 /// @param data_offset Offset of the data array to begin processing.
IanBenzMaxim 78:0cbbac7f2016 33 /// @param data_len Length of the data array to process.
IanBenzMaxim 78:0cbbac7f2016 34 /// @param crc Beginning state of the CRC generator.
IanBenzMaxim 78:0cbbac7f2016 35 /// @returns The calculated CRC16.
IanBenzMaxim 78:0cbbac7f2016 36 uint16_t calculateCrc16(const uint8_t * data, size_t dataOffset, size_t dataLen, uint16_t crc = 0);
IanBenzMaxim 78:0cbbac7f2016 37 }
IanBenzMaxim 78:0cbbac7f2016 38 }
IanBenzMaxim 78:0cbbac7f2016 39
IanBenzMaxim 78:0cbbac7f2016 40 #endif