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.
Diff: OneWire_Masters/OneWireMaster.cpp
- Revision:
- 48:6f9208ae280e
- Parent:
- 43:23017dcd2ec3
- Child:
- 57:1635f247ceae
diff -r 307dc45952db -r 6f9208ae280e OneWire_Masters/OneWireMaster.cpp --- a/OneWire_Masters/OneWireMaster.cpp Thu Apr 07 10:26:26 2016 -0500 +++ b/OneWire_Masters/OneWireMaster.cpp Thu Apr 07 11:26:20 2016 -0500 @@ -387,10 +387,6 @@ } -//-------------------------------------------------------------------------- -// Calculate a new CRC16 from the input data shorteger. Return the current -// CRC16 and also update the global variable CRC16. -// uint16_t OneWireMaster::calculateCRC16(uint16_t CRC16, uint16_t data) { const uint16_t _oddparity[] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 }; @@ -409,9 +405,10 @@ return CRC16; } + uint16_t OneWireMaster::calculateCRC16(const uint8_t * data, size_t data_offset, size_t data_len, uint16_t crc) { for (size_t i = data_offset; i < (data_len + data_offset); i++) crc = calculateCRC16(crc, data[i]); return crc; -} \ No newline at end of file +}