Implementation of 1-Wire with added Alarm Search Functionality

Dependents:   Max32630_One_Wire_Interface

Revision:
74:23be10c32fa3
Parent:
73:2cecc1372acc
Child:
75:8b627804927c
--- a/Masters/DS248x/DS248x.h	Thu May 12 14:38:16 2016 -0500
+++ b/Masters/DS248x/DS248x.h	Fri May 13 07:48:35 2016 -0500
@@ -42,7 +42,7 @@
 {
     namespace Masters
     {
-        class DS248x: public OneWireMaster
+        class DS248x : public OneWireMaster
         {
         public:
             enum Register
@@ -53,8 +53,8 @@
                 PortConfigReg = 0xB4,
                 ChannelSelectReg = 0xD2 // DS2482-800 only
             };
-            
-            // DS2484 only
+
+            /// @note DS2484 only
             enum OwAdjustParam
             {
                 tRSTL = 0,
@@ -66,7 +66,7 @@
                 tREC0, //OD NA
                 RWPU = 8 //OD NA, see DS2484 datasheet page 13
             };
-            
+
             /// Represents a DS2465 configuration.
             class Config
             {
@@ -107,24 +107,24 @@
             private:
                 bool m_1WS, m_SPU, m_PDN, m_APU;
             };
-            
+
             /**********************************************************//**
             * @brief DS248x constructor
-            * 
+            *
             * @details allows user to use existing I2C object
             *
             * On Entry:
             *     @param[in] p_i2c_bus - pointer to existing I2C object
             *
             * On Exit:
-            *    @return 
+            *    @return
             **************************************************************/
             DS248x(mbed::I2C & i2c_bus, uint8_t adrs);
-            
+
             /**********************************************************//**
             * @brief DS248x constructor
-            * 
-            * @details Object instantiates a new I2C object with no 
+            *
+            * @details Object instantiates a new I2C object with no
             *          public access
             *
             * On Entry:
@@ -132,25 +132,25 @@
             *     @param[in] scl - scl pin of I2C bus
             *
             * On Exit:
-            *    @return 
+            *    @return
             **************************************************************/
             DS248x(PinName sda, PinName scl, uint8_t adrs);
-            
+
             /**********************************************************//**
-            * @brief DS248x destructor 
-            * 
-            * @details deletes I2C object if owner 
+            * @brief DS248x destructor
+            *
+            * @details deletes I2C object if owner
             *
             * On Entry:
             *
             * On Exit:
-            *    @return 
+            *    @return
             **************************************************************/
             virtual ~DS248x();
-            
+
             /**********************************************************//**
             * @brief reset()
-            * 
+            *
             * @details Perform a device reset on the DS248x
             *
             * On Entry:
@@ -160,7 +160,7 @@
             *            FALSE device not detected or failure to perform reset
             **************************************************************/
             OneWireMaster::CmdResult reset(void);
-            
+
             /// Write a new configuration to the DS2465.
             /// @param[in] config New configuration to write.
             /// @param verify Verify that the configuration was written successfully.
@@ -169,14 +169,14 @@
             /// Read the current DS2465 configuration.
             /// @returns The cached current configuration.
             Config currentConfig() const { return m_curConfig; }
-            
-            
+
+
             OneWireMaster::CmdResult readRegister(Register reg, uint8_t & buf, bool skipSetPointer = false) const;
-            
+
             /**********************************************************//**
             * @brief channel_select()
-            * 
-            * @details Select the 1-Wire channel on a DS2482-800. 
+            *
+            * @details Select the 1-Wire channel on a DS2482-800.
             *          Min channel = 1
             *
             * On Entry:
@@ -187,15 +187,15 @@
             *            FALSE device not detected or failure to perform select
             **************************************************************/
             OneWireMaster::CmdResult selectChannel(uint8_t channel);
-            
+
             /**********************************************************//**
             * @brief adjust_timing()
-            * 
+            *
             * @details adjustable timming available in DS2484 only
             *
             * On Entry:
             *     @param[in] param - 1 of 8 adjustable parameters
-            *     @param[in] val - new value for parameter, see datasheet 
+            *     @param[in] val - new value for parameter, see datasheet
             *                      for codes
             *
             * On Exit:
@@ -203,16 +203,16 @@
             *            FALSE: failed to adjust parameter
             **************************************************************/
             OneWireMaster::CmdResult adjustOwPort(OwAdjustParam param, uint8_t val);
-            
+
             /**********************************************************//**
             * @brief search_triplet()
-            * 
-            * @details Use the DS248x help command '1-Wire triplet' to perform 
-            *          one bit of a 1-Wire search. This command does two read 
-            *          bits and one write bit. The write bit is either the 
-            *          default direction (all device have same bit) or in case 
-            *          of a discrepancy, the 'search_direction' parameter is 
-            *          used. 
+            *
+            * @details Use the DS248x help command '1-Wire triplet' to perform
+            *          one bit of a 1-Wire search. This command does two read
+            *          bits and one write bit. The write bit is either the
+            *          default direction (all device have same bit) or in case
+            *          of a discrepancy, the 'search_direction' parameter is
+            *          used.
             *
             * On Entry:
             *     @param[in] search_direction
@@ -221,15 +221,12 @@
             *    @return The DS248x status byte result from the triplet command
             **************************************************************/
             virtual OneWireMaster::CmdResult OWTriplet(SearchDirection & search_direction, uint8_t & sbr, uint8_t & tsb);
-            
-            //Part of OneWireMaster that should be implemented for each master
-            //See OneWireMaster.h for documentation
-            
+
             /**********************************************************//**
             * @brief
-            * 
-            * @details Detect routine that performs a device reset 
-            *          followed by writing the configuration byte to default 
+            *
+            * @details Detect routine that performs a device reset
+            *          followed by writing the configuration byte to default
             *          values:
             *          1-Wire speed (c1WS) = standard (0)
             *          Strong pull-up (cSPU) = off (0)
@@ -240,23 +237,23 @@
             *
             * On Exit:
             *    @return TRUE if device was detected and written
-            *            FALSE device not detected or failure to write 
+            *            FALSE device not detected or failure to write
             *            configuration byte
             **************************************************************/
             virtual OneWireMaster::CmdResult OWInitMaster(void);
-            
+
             virtual OneWireMaster::CmdResult OWReset(void);
-            
+
             virtual OneWireMaster::CmdResult OWTouchBitSetLevel(uint8_t & sendrecvbit, OWLevel after_level);
-            
+
             virtual OneWireMaster::CmdResult OWReadByteSetLevel(uint8_t & recvbyte, OWLevel after_level);
-            
+
             virtual OneWireMaster::CmdResult OWWriteByteSetLevel(uint8_t sendbyte, OWLevel after_level);
 
             virtual OneWireMaster::CmdResult OWSetSpeed(OWSpeed new_speed);
 
             virtual OneWireMaster::CmdResult OWSetLevel(OWLevel new_level);
-            
+
         private:
             enum DS248X_CMDS
             {
@@ -271,11 +268,11 @@
                 CMD_1WSB = 0x87,
                 CMD_1WT = 0x78
             };
-            
+
             mbed::I2C *_p_i2c_bus;
             uint8_t _adrs;
             bool _i2c_owner;
-            
+
             Config m_curConfig;
 
             /// Polls the DS2465 status waiting for the 1-Wire Busy bit (1WB) to be cleared.
@@ -289,7 +286,7 @@
 
             /// @note Allow marking const since not public.
             OneWireMaster::CmdResult sendCommand(DS248X_CMDS cmd) const;
-            
+
             /// @note Allow marking const since not public.
             OneWireMaster::CmdResult sendCommand(DS248X_CMDS cmd, uint8_t param) const;
         };