Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Max32630_One_Wire_Interface
Diff: RomId.cpp
- Revision:
- 75:8b627804927c
- Parent:
- 74:23be10c32fa3
--- a/RomId.cpp Fri May 13 07:48:35 2016 -0500
+++ b/RomId.cpp Fri May 13 14:52:50 2016 -0500
@@ -34,13 +34,11 @@
using OneWire::RomId;
-uint8_t RomId::calculateCRC8(uint8_t crc8, uint8_t data)
+uint8_t RomId::calculateCrc8(uint8_t crc8, uint8_t data)
{
- int i;
-
// See Application Note 27
crc8 = crc8 ^ data;
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
if (crc8 & 1)
{
@@ -55,11 +53,11 @@
return crc8;
}
-uint8_t RomId::calculateCRC8(const uint8_t * data, size_t data_len, uint8_t crc)
+uint8_t RomId::calculateCrc8(const uint8_t * data, size_t dataLen, uint8_t crc)
{
- for (size_t i = 0; i < data_len; i++)
+ for (size_t i = 0; i < dataLen; i++)
{
- crc = calculateCRC8(crc, data[i]);
+ crc = calculateCrc8(crc, data[i]);
}
return crc;
}