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
Child:
78:0cbbac7f2016
--- a/OneWireSlave.h	Sat May 14 14:27:56 2016 -0500
+++ b/OneWireSlave.h	Mon May 16 10:36:30 2016 -0500
@@ -35,6 +35,7 @@
 
 #include <stddef.h>
 #include "RomId.h"
+#include "RomIterator.h"
 
 namespace OneWire
 {
@@ -48,17 +49,29 @@
         {
             Success,
             CommunicationError,
+            CrcError,
             TimeoutError,
             OperationFailure
         };
 
         /// 1-Wire ROM ID for this slave device.
         RomId romId;
+       
+    private:
+        RandomAccessRomIterator & selector;
         
     protected:
-        OneWireMaster * p_owMaster;
+        /// @param selector Provides 1-Wire ROM selection and bus access. 
+        OneWireSlave(RandomAccessRomIterator & selector) : selector(selector) { }
         
-        OneWireSlave(OneWireMaster * p_owMaster = NULL) : p_owMaster(p_owMaster) { }
+        /// Select this slave device by ROM ID.
+        OneWireMaster::CmdResult selectDevice() const
+        {
+            return selector.selectDevice(romId);
+        }
+        
+        /// The 1-Wire master for this slave device.
+        OneWireMaster & master() const { return selector.master(); }
     };
 }