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:
113:13e2865603df
Parent:
86:2ce08ca58b9e
Child:
139:f0e0a7976846
--- a/Slaves/Authenticators/DS28E15_22_25/DS28E15_22_25.h	Mon Aug 08 23:25:51 2016 +0000
+++ b/Slaves/Authenticators/DS28E15_22_25/DS28E15_22_25.h	Tue Aug 09 12:35:22 2016 -0500
@@ -39,40 +39,10 @@
 
 namespace OneWire
 {
-    class OneWireMaster;
-
-    /// Interface to the DS28E15/22/25 series of authenticators
-    /// including low power variants.
+    /// Interface to the DS28E15/22/25 series of authenticators including low power variants.
     class DS28E15_22_25 : public OneWireSlave
     {
     public:
-        /// Family code for each device.
-        enum FamilyCode
-        {
-            DS28E25_Family = 0x47,
-            DS28E22_Family = 0x48,
-            DS28E15_Family = 0x17,
-            Unknown_Family = 0
-        };
-
-        /// Number for memory pages for each device.
-        enum MemoryPages
-        {
-            DS28E25_Pages = 16,
-            DS28E22_Pages = 8,
-            DS28E15_Pages = 2,
-            Unknown_Pages = 0
-        };
-
-        /// Number of protection blocks for each device.
-        enum ProtectionBlocks
-        {
-            DS28E25_Blocks = 8,
-            DS28E22_Blocks = 4,
-            DS28E15_Blocks = 4,
-            Unknown_Blocks = 0
-        };
-
         /// Holds the contents of a device memory segment.
         typedef array<uint8_t, 4> Segment;
 
@@ -304,19 +274,9 @@
         void setLowVoltage(bool lowVoltage) { m_lowVoltage = lowVoltage; }
         /// @}
 
-        /// @param owMaster 1-Wire Master to use for communication with DS28E15/22/25.
-        /// @param lowVoltage Enable low voltage timing.
-        DS28E15_22_25(RandomAccessRomIterator & selector, bool lowVoltage = false);
-
         // Const member functions should not affect the state of the memory, block protection, or secret on the DS28Exx.
         // Scratchpad on the DS28Exx is considered mutable.
 
-        /// Get the number of memory pages from the ROM ID of this device.
-        MemoryPages memoryPages();
-
-        /// Get the number of protection blocks from the ROM ID of this device.
-        ProtectionBlocks protectionBlocks();
-
         /// Perform Load and Lock Secret command on the device.
         /// @note The secret should already be stored in the scratchpad on the device.
         /// @param lock Prevent further changes to the secret on the device after loading.
@@ -378,14 +338,6 @@
         /// @param[out] protection Receives protection status read from device.
         CmdResult readBlockProtection(unsigned int blockNum, BlockProtection & protection);
 
-        /// @{
-        /// Read the status of all memory protection blocks using the Read Status command.
-        /// @note 1-Wire ROM selection should have already occurred.
-        /// @param[out] protection Receives protection statuses read from device.
-        CmdResult readAllBlockProtection(BlockProtection(&protection)[DS28E15_Blocks]) const;
-        CmdResult readAllBlockProtection(BlockProtection(&protection)[DS28E25_Blocks]) const;
-        /// @}
-
         /// Read the personality bytes using the Read Status command.
         /// @note 1-Wire ROM selection should have already occurred.
         /// @param[out] personality Receives personality read from device.
@@ -439,10 +391,26 @@
                                       const Segment & newData,
                                       const Mac & mac,
                                       bool continuing = false);
+                                      
+    protected:
+        /// Family code for each device.
+        enum FamilyCode
+        {
+            DS28E25_Family = 0x47,
+            DS28E22_Family = 0x48,
+            DS28E15_Family = 0x17
+        };
+    
+        /// @param owMaster 1-Wire Master to use for communication with DS28E15/22/25.
+        /// @param lowVoltage Enable low voltage timing.
+        DS28E15_22_25(RandomAccessRomIterator & selector, bool lowVoltage, FamilyCode variant);
+        
+        ~DS28E15_22_25() { }
 
     private:
         ManId m_manId;
         bool m_lowVoltage;
+        const FamilyCode m_variant;
     
         static const unsigned int shaComputationDelayMs = 3;
         static const unsigned int eepromWriteDelayMs = 10;
@@ -455,10 +423,6 @@
         /// @param pageNum Page number if reading block protection.
         /// @param rdbuf Buffer to receive data read from device.
         CmdResult readStatus(bool personality, bool allpages, unsigned int blockNum, uint8_t * rdbuf) const;
-
-        /// Extends readStatus() to use the BlockProtection wrapper.
-        /// @see readAllBlockProtection(BlockProtection (&)[DS28E15_BLOCKS])
-        template <ProtectionBlocks blocks> CmdResult readAllBlockProtection(BlockProtection(&protection)[blocks]) const;
     };
 }