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.

Revision:
139:f0e0a7976846
Parent:
121:4bee07064d0d
Child:
141:cf38f48a2a49
diff -r 5bd0a7a82bb4 -r f0e0a7976846 Slaves/Memory/DS2431/DS2431.cpp
--- a/Slaves/Memory/DS2431/DS2431.cpp	Fri Dec 02 19:21:55 2016 +0000
+++ b/Slaves/Memory/DS2431/DS2431.cpp	Tue Dec 13 13:31:30 2016 -0800
@@ -69,10 +69,10 @@
         
         if(startOffset != 0)
         {
-            result = this->readMemory(startRowAddress, scratchpadData, 8);
+            result = this->readMemory(startRowAddress, scratchpadData.data(), 8);
             if(result == OneWireSlave::Success)
             {
-                std::memcpy((scratchpadData + startOffset), data, (8 - startOffset));
+                std::memcpy((scratchpadData.data() + startOffset), data, (8 - startOffset));
                 result = this->writeScratchpad(startRowAddress, scratchpadData);
                 if(result == OneWireSlave::Success)
                 {
@@ -91,7 +91,7 @@
         {
             for(uint16_t row = startRowAddress; row < endRowAddress; row += 8)
             {
-                std::memcpy(scratchpadData, dataIdx, 8);
+                std::memcpy(scratchpadData.data(), dataIdx, 8);
                 
                 result = this->writeScratchpad(row, scratchpadData);
                 if(result != OneWireSlave::Success)
@@ -119,10 +119,10 @@
         {
             if(endOffset != 0)
             {
-                result = this->readMemory(endRowAddress, scratchpadData, 8);
+                result = this->readMemory(endRowAddress, scratchpadData.data(), 8);
                 if(result == OneWireSlave::Success)
                 {
-                    std::memcpy(scratchpadData, dataIdx, endOffset);
+                    std::memcpy(scratchpadData.data(), dataIdx, endOffset);
                     result = this->writeScratchpad(endRowAddress, scratchpadData);
                     if(result == OneWireSlave::Success)
                     {
@@ -178,7 +178,7 @@
         sendBlock[0] = WRITE_SCRATCHPAD;
         sendBlock[1] = (targetAddress &0xFF);
         sendBlock[2] = ((targetAddress >> 8) &0xFF);
-        std::memcpy((sendBlock + 3), data, 8);
+        std::memcpy((sendBlock + 3), data.data(), 8);
         
         owmResult = master().OWWriteBlock(sendBlock, 11);
         
@@ -190,7 +190,7 @@
         invCRC16 |= (recvbyte << 8); 
         
         //calc our own inverted CRC16 to compare with one returned
-        uint16_t calculatedInvCRC16 = ~calculateCrc16(sendBlock, 0, 11);
+        uint16_t calculatedInvCRC16 = ~calculateCrc16(sendBlock, 11);
         
         if(invCRC16 == calculatedInvCRC16)
         {
@@ -225,12 +225,12 @@
             recvBlock[0] = READ_SCRATCHPAD;
             
             //calc our own inverted CRC16 to compare with one returned
-            uint16_t calculatedInvCRC16 = ~calculateCrc16(recvBlock, 0, 12);
+            uint16_t calculatedInvCRC16 = ~calculateCrc16(recvBlock, 12);
             
             if(invCRC16 == calculatedInvCRC16)
             {
                 esByte = recvBlock[3];
-                std::memcpy(data, (recvBlock + 4), 8);
+                std::memcpy(data.data(), (recvBlock + 4), 8);
                 result = OneWireSlave::Success;
             }
         }