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:
77:529edb329ee0
Parent:
76:84e6c4994e29
--- a/Switches/DS2413/DS2413.cpp	Sat May 14 14:27:56 2016 -0500
+++ b/Switches/DS2413/DS2413.cpp	Mon May 16 10:36:30 2016 -0500
@@ -32,11 +32,9 @@
 
 #include "DS2413.h"
 #include "Masters/OneWireMasters.h"
-#include "RomCommands.h"
 
 using OneWire::DS2413;
 using OneWire::OneWireMaster;
-using namespace OneWire::RomCommands;
 
 enum DS2413_CMDS
 {
@@ -51,7 +49,7 @@
     PIOAB
 };
 
-DS2413::DS2413(OneWireMaster &owm) : OneWireSlave(&owm)
+DS2413::DS2413(RandomAccessRomIterator &selector) : OneWireSlave(selector)
 {
 }
 
@@ -134,15 +132,15 @@
 {
     DS2413::CmdResult result = DS2413::OpFailure;
 
-    OneWireMaster::CmdResult ow_result = OWMatchRom(*p_owMaster, romId);
+    OneWireMaster::CmdResult ow_result = selectDevice();
 
     if (ow_result == OneWireMaster::Success)
     {
-        ow_result = p_owMaster->OWWriteByte(PIO_ACCESS_READ);
+        ow_result = master().OWWriteByte(PIO_ACCESS_READ);
 
         if (ow_result == OneWireMaster::Success)
         {
-            ow_result = p_owMaster->OWReadByte(val);
+            ow_result = master().OWReadByte(val);
 
             if (ow_result == OneWireMaster::Success)
             {
@@ -166,20 +164,20 @@
 {
     DS2413::CmdResult result = DS2413::OpFailure;
 
-    OneWireMaster::CmdResult ow_result = OWMatchRom(*p_owMaster, romId);
+    OneWireMaster::CmdResult ow_result = selectDevice();
 
     if (ow_result == OneWireMaster::Success)
     {
         uint8_t send_block[] = { PIO_ACCESS_WRITE, val, ~val };
 
-        ow_result = p_owMaster->OWWriteBlock(send_block, 3);
+        ow_result = master().OWWriteBlock(send_block, 3);
         if (ow_result == OneWireMaster::Success)
         {
             uint8_t expected_status = ((0x01 & val) | ((0x01 & val) << 1) |
                 ((0x02 & val) << 1) | ((0x02 & val) << 2));
 
             uint8_t rcv_block[2];
-            ow_result = p_owMaster->OWReadBlock(rcv_block, 2);
+            ow_result = master().OWReadBlock(rcv_block, 2);
 
             if (ow_result == OneWireMaster::Success)
             {