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.
crc.h@78:0cbbac7f2016, 2016-05-16 (annotated)
- Committer:
- IanBenzMaxim
- Date:
- Mon May 16 15:18:09 2016 -0500
- Revision:
- 78:0cbbac7f2016
- Child:
- 80:83b0d879cc32
Code cleanup.
Who changed what in which revision?
User | Revision | Line number | New 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 | { |
IanBenzMaxim | 78:0cbbac7f2016 | 11 | /// Perform a CRC16 calculation. |
IanBenzMaxim | 78:0cbbac7f2016 | 12 | /// @param crc16 Beginning state of the CRC generator. |
IanBenzMaxim | 78:0cbbac7f2016 | 13 | /// @param data Data to pass though the CRC generator. |
IanBenzMaxim | 78:0cbbac7f2016 | 14 | /// @returns The calculated CRC16. |
IanBenzMaxim | 78:0cbbac7f2016 | 15 | uint16_t calculateCrc16(uint16_t crc16, uint16_t data); |
IanBenzMaxim | 78:0cbbac7f2016 | 16 | |
IanBenzMaxim | 78:0cbbac7f2016 | 17 | /// Perform a CRC16 calculation with variable length data. |
IanBenzMaxim | 78:0cbbac7f2016 | 18 | /// @param[in] data Data array to pass through the CRC generator. |
IanBenzMaxim | 78:0cbbac7f2016 | 19 | /// @param data_offset Offset of the data array to begin processing. |
IanBenzMaxim | 78:0cbbac7f2016 | 20 | /// @param data_len Length of the data array to process. |
IanBenzMaxim | 78:0cbbac7f2016 | 21 | /// @param crc Beginning state of the CRC generator. |
IanBenzMaxim | 78:0cbbac7f2016 | 22 | /// @returns The calculated CRC16. |
IanBenzMaxim | 78:0cbbac7f2016 | 23 | uint16_t calculateCrc16(const uint8_t * data, size_t dataOffset, size_t dataLen, uint16_t crc = 0); |
IanBenzMaxim | 78:0cbbac7f2016 | 24 | } |
IanBenzMaxim | 78:0cbbac7f2016 | 25 | } |
IanBenzMaxim | 78:0cbbac7f2016 | 26 | |
IanBenzMaxim | 78:0cbbac7f2016 | 27 | #endif |