Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
40:1324da35afd4
Parent:
38:9070c17536cd
--- a/SnCRCUtils.h	Tue Jul 30 02:03:21 2013 +0000
+++ b/SnCRCUtils.h	Sat Oct 05 04:45:22 2013 +0000
@@ -70,7 +70,7 @@
 //
 template<typename T>
 static
-uint32_t GetCRC32for(const T* data, const uint32_t len) {
+uint32_t GetUpdatedCRC32for(uint32_t crc, const T* const data, const uint32_t len) {
     // calculate the 32bit CRC for an array of data
     // len = number of array elements; not number of bytes
   
@@ -79,7 +79,6 @@
         const uint8_t* c;
     } d;
     d.x = data;
-    uint32_t crc(0);
     const uint32_t bytes = len * sizeof(T);
     for (register uint32_t i=0; i<bytes; ++i, ++d.c) {
         crc = update_crc32_xfer(crc, *(d.c));
@@ -87,26 +86,15 @@
     return crc;
 }
 
-/*
-inline
-uint32_t update_crc32_xfer_short( uint32_t crc, const uint16_t c) {
-    SnBitUtils::tmp.s[0] = c;
-    for (uint8_t i=0; i<sizeof(uint16_t); i++) {
-        crc = update_crc32_xfer(crc, SnBitUtils::tmp.c[i]);
-    }
-    return crc;
+template<typename T>
+static
+uint32_t GetCRC32for(const T* const data, const uint32_t len) {
+    // calculate the 32bit CRC for an array of data
+    // len = number of array elements; not number of bytes
+    uint32_t crc(0);
+    return GetUpdatedCRC32for(crc, data, len);
 }
 
-inline
-uint32_t update_crc32_xfer_int( uint32_t crc, const uint32_t c) {
-    SnBitUtils::tmp.i = c;
-    for (uint8_t i=0; i<sizeof(uint32_t); i++) {
-        crc = update_crc32_xfer(crc, SnBitUtils::tmp.c[i]);
-    }
-    return crc;
-}
-*/
-
 };
 
 #endif // SN_SnCRCUtils
\ No newline at end of file