Implementation of 1-Wire with added Alarm Search Functionality

Dependents:   Max32630_One_Wire_Interface

Revision:
82:c11090a32471
Parent:
75:8b627804927c
diff -r e2a3ad98874e -r c11090a32471 RomId.h
--- a/RomId.h	Fri Jun 03 22:15:59 2016 +0000
+++ b/RomId.h	Mon Jun 06 09:55:33 2016 -0500
@@ -34,6 +34,7 @@
 #define OneWire_RomId
 
 #include "array.h"
+#include "crc.h"
 
 namespace OneWire
 {
@@ -47,19 +48,6 @@
       /// Built-in array representation.
       typedef array<uint8_t, byteLen>::Buffer ByteBuffer;
 
-      /// Perform a CRC8 calculation.
-      /// @param crc8 Beginning state of the CRC generator.
-      /// @param data Data to pass though the CRC generator.
-      /// @returns The calculated CRC8.
-      static uint8_t calculateCrc8(uint8_t crc8, uint8_t data);
-      
-      /// Perform a CRC8 calculation with variable length data.
-      /// @param[in] data Data array to pass through the CRC generator.
-      /// @param dataLen Length of the data array to process.
-      /// @param crc Beginning state of the CRC generator.
-      /// @returns The calculated CRC8.
-      static uint8_t calculateCrc8(const uint8_t * data, size_t dataLen, uint8_t crc = 0);
-
   private:
       static const size_t familyCodeIdx = 0;
       static const size_t crc8Idx = 7;
@@ -136,13 +124,13 @@
       /// @returns True if the CRC8 is valid.
       bool crc8Valid() const
       {
-          return (calculateCrc8(m_romId, (byteLen - 1), 0x00) == crc8());
+          return (crc::calculateCrc8(m_romId, (byteLen - 1), 0x00) == crc8());
       }
       
       /// Calculate and set the CRC8 for the ROM ID.
       void setValidCrc8()
       {
-          setCrc8(calculateCrc8(m_romId, (byteLen - 1), 0x00));
+          setCrc8(crc::calculateCrc8(m_romId, (byteLen - 1), 0x00));
       }
 
       /// Check if the ROM ID is valid (Family Code and CRC8 are both valid).