Implementation of 1-Wire with added Alarm Search Functionality

Dependents:   Max32630_One_Wire_Interface

Revision:
23:e8e403d61359
Parent:
22:686273e55cdc
Child:
27:d5aaefa252f1
diff -r 686273e55cdc -r e8e403d61359 OneWire_Bridge/DS28E17/ds28e17.cpp
--- a/OneWire_Bridge/DS28E17/ds28e17.cpp	Mon Mar 21 21:41:36 2016 +0000
+++ b/OneWire_Bridge/DS28E17/ds28e17.cpp	Mon Mar 21 23:18:45 2016 +0000
@@ -68,9 +68,9 @@
     size_t send_cnt = 0;
     uint8_t send_block[0xff];
     
-    OneWireInterface::CmdResult ow_result = _owm.OWMatchROM(_romId);
+    OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(_romId);
     
-    if(ow_result == OneWireInterface::Success)
+    if(ow_result == OneWireMaster::Success)
     {
         //seed the crc
         _crc16 = 0;
@@ -119,9 +119,9 @@
     size_t send_cnt = 0;
     uint8_t send_block[0xff];
     
-    OneWireInterface::CmdResult ow_result = _owm.OWMatchROM(_romId);
+    OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(_romId);
     
-    if(ow_result == OneWireInterface::Success)
+    if(ow_result == OneWireMaster::Success)
     {
         // seed the crc
         _crc16 = 0;
@@ -167,9 +167,9 @@
     size_t send_cnt = 0;
     uint8_t send_block[0xff];
     
-    OneWireInterface::CmdResult ow_result = _owm.OWMatchROM(_romId);
+    OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(_romId);
     
-    if(ow_result == OneWireInterface::Success)
+    if(ow_result == OneWireMaster::Success)
     {
         // seed the crc
         _crc16 = 0;
@@ -213,9 +213,9 @@
     size_t send_cnt = 0;
     uint8_t send_block[0xff];
     
-    OneWireInterface::CmdResult ow_result = _owm.OWMatchROM(_romId);
+    OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(_romId);
     
-    if(ow_result == OneWireInterface::Success)
+    if(ow_result == OneWireMaster::Success)
     {
         //seed the crc
         _crc16 = 0;
@@ -262,9 +262,9 @@
     size_t idx = 0;
     uint8_t send_block[0xff];
     
-    OneWireInterface::CmdResult ow_result = _owm.OWMatchROM(_romId);
+    OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(_romId);
     
-    if(ow_result == OneWireInterface::Success)
+    if(ow_result == OneWireMaster::Success)
     {
         //seed the crc
         _crc16 = 0;
@@ -304,7 +304,7 @@
         if(bridge_result == Ds28e17::Success)
         {
             ow_result = _owm.OWReadBlock(read_data, nu_bytes_read);
-            if(ow_result == OneWireInterface::Success)
+            if(ow_result == OneWireMaster::Success)
             {
                 bridge_result = Ds28e17::Success;
             }
@@ -328,9 +328,9 @@
     size_t send_cnt = 0;
     uint8_t send_block[0xff];
     
-    OneWireInterface::CmdResult ow_result = _owm.OWMatchROM(_romId);
+    OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(_romId);
     
-    if(ow_result == OneWireInterface::Success)
+    if(ow_result == OneWireMaster::Success)
     {
         //seed the crc for transmit bytes
         _crc16 = 0;
@@ -359,7 +359,7 @@
         if(bridge_result == Ds28e17::Success)
         {
             ow_result = _owm.OWReadBlock(read_data, nu_bytes_read);
-            if(ow_result == OneWireInterface::Success)
+            if(ow_result == OneWireMaster::Success)
             {
                 bridge_result = Ds28e17::Success;
             }
@@ -379,15 +379,15 @@
 {
     Ds28e17::CmdResult bridge_result = Ds28e17::OperationFailure;
     
-    OneWireInterface::CmdResult ow_result = _owm.OWMatchROM(_romId);
+    OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(_romId);
     
-    if(ow_result == OneWireInterface::Success)
+    if(ow_result == OneWireMaster::Success)
     {
         // Send CMD and Data
         uint8_t send_block[] = {CMD_WRITE_CONFIG_REG, data};
         
         ow_result = _owm.OWWriteBlock(send_block, 2);
-        if(ow_result == OneWireInterface::Success)
+        if(ow_result == OneWireMaster::Success)
         {
             _i2c_speed = data & 0x03; // Save off _i2c_speed setting to be used by other functions
             bridge_result = Ds28e17::Success;
@@ -407,16 +407,16 @@
 {
     Ds28e17::CmdResult bridge_result = Ds28e17::OperationFailure;
     
-    OneWireInterface::CmdResult ow_result = _owm.OWMatchROM(_romId);
+    OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(_romId);
     
-    if(ow_result == OneWireInterface::Success)
+    if(ow_result == OneWireMaster::Success)
     {
         // Send CMD and receive Data
         ow_result = _owm.OWWriteByte(CMD_READ_CONFIG_REG);
-        if(ow_result == OneWireInterface::Success)
+        if(ow_result == OneWireMaster::Success)
         {
             ow_result = _owm.OWReadByte(config);
-            if(ow_result == OneWireInterface::Success)
+            if(ow_result == OneWireMaster::Success)
             {
                 bridge_result = Ds28e17::Success;
             }
@@ -440,13 +440,13 @@
 {
     Ds28e17::CmdResult bridge_result = Ds28e17::OperationFailure;
     
-    OneWireInterface::CmdResult ow_result = _owm.OWMatchROM(_romId);
+    OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(_romId);
     
-    if(ow_result == OneWireInterface::Success)
+    if(ow_result == OneWireMaster::Success)
     {
         // Send CMD
         ow_result = _owm.OWWriteByte(CMD_DISABLE_OW_MODE);
-        if(ow_result == OneWireInterface::Success)
+        if(ow_result == OneWireMaster::Success)
         {
             bridge_result = Ds28e17::Success;
         }
@@ -465,13 +465,13 @@
 {
     Ds28e17::CmdResult bridge_result = Ds28e17::OperationFailure;
     
-    OneWireInterface::CmdResult ow_result = _owm.OWMatchROM(_romId);
+    OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(_romId);
     
-    if(ow_result == OneWireInterface::Success)
+    if(ow_result == OneWireMaster::Success)
     {
         // Send CMD
         ow_result = _owm.OWWriteByte(CMD_ENABLE_SLEEP_MODE);
-        if(ow_result == OneWireInterface::Success)
+        if(ow_result == OneWireMaster::Success)
         {
             bridge_result = Ds28e17::Success;
         }
@@ -490,16 +490,16 @@
 {
     Ds28e17::CmdResult bridge_result = Ds28e17::OperationFailure;
     
-    OneWireInterface::CmdResult ow_result = _owm.OWMatchROM(_romId);
+    OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(_romId);
     
-    if(ow_result == OneWireInterface::Success)
+    if(ow_result == OneWireMaster::Success)
     {
         // Send CMD and receive Data
         ow_result = _owm.OWWriteByte(CMD_READ_DEVICE_REV);
-        if(ow_result == OneWireInterface::Success)
+        if(ow_result == OneWireMaster::Success)
         {
             ow_result = _owm.OWReadByte(rev);
-            if(ow_result == OneWireInterface::Success)
+            if(ow_result == OneWireMaster::Success)
             {
                 bridge_result = Ds28e17::Success;
             }
@@ -545,9 +545,9 @@
     Ds28e17::CmdResult bridge_result = Ds28e17::CommsWriteBlockError;
     uint32_t poll_count = 0;
     
-    OneWireInterface::CmdResult ow_result = _owm.OWWriteBlock(data, data_length);
+    OneWireMaster::CmdResult ow_result = _owm.OWWriteBlock(data, data_length);
     
-    if(ow_result == OneWireInterface::Success) 
+    if(ow_result == OneWireMaster::Success) 
     {
         // Poll for Zero 1-Wire bit and return if an error occurs
         uint8_t recvbit = 0x01;
@@ -555,9 +555,9 @@
         {
             ow_result = _owm.OWReadBit(recvbit);
         } 
-        while(recvbit && (poll_count++ < POLL_LIMIT) && (ow_result == OneWireInterface::Success));
+        while(recvbit && (poll_count++ < POLL_LIMIT) && (ow_result == OneWireMaster::Success));
 
-        if(ow_result == OneWireInterface::Success) 
+        if(ow_result == OneWireMaster::Success) 
         {
             if(poll_count < POLL_LIMIT) 
             {
@@ -566,7 +566,7 @@
                 
                 ow_result = _owm.OWReadBlock(read_block, 2);
                 
-                if(ow_result == OneWireInterface::Success) 
+                if(ow_result == OneWireMaster::Success) 
                 {
                     status = read_block[0];
                     wr_status = read_block[1];
@@ -599,9 +599,9 @@
     Ds28e17::CmdResult bridge_result = Ds28e17::CommsWriteBlockError;
     uint32_t poll_count = 0;
     
-    OneWireInterface::CmdResult ow_result = _owm.OWWriteBlock(data, data_length);
+    OneWireMaster::CmdResult ow_result = _owm.OWWriteBlock(data, data_length);
     
-    if(ow_result == OneWireInterface::Success) 
+    if(ow_result == OneWireMaster::Success) 
     {
         // Poll for Zero 1-Wire bit and return if an error occurs
         uint8_t recvbit = 0x01;
@@ -609,15 +609,15 @@
         {
             ow_result = _owm.OWReadBit(recvbit);
         } 
-        while(recvbit && (poll_count++ < POLL_LIMIT) && (ow_result == OneWireInterface::Success));
+        while(recvbit && (poll_count++ < POLL_LIMIT) && (ow_result == OneWireMaster::Success));
 
-        if(ow_result == OneWireInterface::Success) 
+        if(ow_result == OneWireMaster::Success) 
         {
             if(poll_count < POLL_LIMIT) 
             {
                 //Read Status 
                 ow_result = _owm.OWReadByte(status);
-                if(ow_result == OneWireInterface::Success) 
+                if(ow_result == OneWireMaster::Success) 
                 {
                     bridge_result = Ds28e17::Success;
                 }