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:
3:644fc630f958
Parent:
2:02d228c25fd4
Child:
5:ce108eeb878d
--- a/OneWire_Masters/DS248x/ds248x.h	Sun Jan 31 06:15:24 2016 +0000
+++ b/OneWire_Masters/DS248x/ds248x.h	Sun Jan 31 22:42:01 2016 +0000
@@ -67,6 +67,14 @@
         DS248X_I2C_ADRS7,
     }ds248x_i2c_adrs_t;
     
+    /**
+    * Member functions that directly support DS248x I2C to 1-wire
+    * masters are documented in this file.  Virtual function 
+    * inerited from the interface class 'OneWireInterface'
+    * are documented in 'OneWireInterface.h', trying to follow
+    * a 'DRY' methodology, Don't Repeat Yourself.
+    */ 
+    
     /**********************************************************//**
     * @brief Ds248x constructor
     * 
@@ -84,7 +92,8 @@
     /**********************************************************//**
     * @brief Ds248x constructor
     * 
-    * @details allows user to use existing I2C object
+    * @details Object instantiates a new I2C object with no 
+    *          public access
     *
     * On Entry:
     *     @param[in] sda - sda pin of I2C bus
@@ -213,338 +222,46 @@
     **************************************************************/
     uint8_t search_triplet(uint8_t search_direction);
     
-    
-    /**********************************************************//**
-    * @brief Reset all of the devices on the 1-Wire Net and return 
-    *        the result.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *
-    * On Exit:
-    *    @return TRUE(1):  presence pulse(s) detected, device(s) reset
-    *            FALSE(0): no presence pulses detected
-    **************************************************************/
+    /***** OW API ****************************************************/
     virtual bool OWReset();
     
-    
-    /**********************************************************//**
-    * @brief Send 1 bit of communication to the 1-Wire Net.
-    *        The parameter 'sendbit' least significant bit is used.
-    * 
-    * @details
-    *
-    * On Entry:
-    *     @param[in] 'sendbit' - 1 bit to send (least significant byte)
-    *
-    * On Exit:
-    *    @return 
-    **************************************************************/
     virtual void OWWriteBit(uint8_t sendbit);
     
-    
-    /**********************************************************//**
-    * @brief Reads 1 bit of communication from the 1-Wire Net and 
-    *        returns the result
-    * 
-    * @details 
-    *
-    * On Entry:
-    *
-    * On Exit:
-    *    @return 1 bit read from 1-Wire Net
-    **************************************************************/
     virtual uint8_t OWReadBit();
     
-    
-    /**********************************************************//**
-    * @brief Send 1 bit of communication to the 1-Wire Net and return 
-    *        the result 1 bit read from the 1-Wire Net.  The 
-    *        parameter 'sendbit' least significant bit is used and 
-    *        the least significant bit of the result is the return 
-    *        bit.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *     @param[in] 'sendbit' - the least significant bit is the bit to send
-    *
-    * On Exit:
-    *    @return 0:   0 bit read from sendbit
-    *            1:   1 bit read from sendbit
-    **************************************************************/
     virtual uint8_t OWTouchBit(uint8_t sendbit);
-    
-    
-    /**********************************************************//**
-    * @brief Send 8 bits of communication to the 1-Wire Net and 
-    *        verify that the 8 bits read from the 1-Wire Net is the 
-    *        same (write operation).The parameter 'sendbyte' least 
-    *        significant 8 bits are used.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *     @param[in] 'sendbyte' - 8 bits to send (least significant byte)
-    *
-    * On Exit:
-    *    @return TRUE: bytes written and echo was the same
-    *            FALSE: echo was not the same
-    **************************************************************/
+
     virtual bool OWWriteByte(uint8_t sendbyte);
-    
-    
-    /**********************************************************//**
-    * @brief Send 8 bits of read communication to the 1-Wire Net and 
-    *        return the result 8 bits read from the 1-Wire Net.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *
-    * On Exit:
-    *    @return 8 bits read from 1-Wire Net
-    **************************************************************/
+
     virtual uint8_t OWReadByte(void);
-    
-    
-    /**********************************************************//**
-    * @brief Send 8 bits of communication to the 1-Wire Net and 
-    *        return the result 8 bits read from the 1-Wire Net.  The 
-    *        parameter 'sendbyte' least significant 8 bits are used 
-    *        and the least significant 8 bits of the result is the 
-    *        return byte.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *     @param[in] 'sendbyte' - 8 bits to send (least significant byte)
-    *
-    * On Exit:
-    *    @return 8 bits read from sendbyte
-    **************************************************************/
+
     virtual uint8_t OWTouchByte(uint8_t sendbyte);
-    
-    
-    /**********************************************************//**
-    * @brief The 'OWBlock' transfers a block of data to and from the
-    *        1-Wire Net. The result is returned in the same buffer.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *     @param[in] 'tran_buf' - pointer to a block of unsigned
-    *                             chars of length 'tran_len' that 
-    *                             will be sent to the 1-Wire Net
-    *     @param[in] 'tran_len' - length in bytes to transfer
-    *
-    * On Exit:
-    *    @return 
-    **************************************************************/
+
     virtual void OWBlock(uint8_t *tran_buf, uint8_t tran_len);
-    
-    
-    /**********************************************************//**
-    * @brief Find the 'first' devices on the 1-Wire network
-    * 
-    * @details 
-    *
-    * On Entry:
-    *
-    * On Exit:
-    *    @return TRUE  : device found, ROM number in ROM_NO buffer
-    *            FALSE : no device present
-    **************************************************************/
+
     virtual bool OWFirst(void);
-    
-    
-    /**********************************************************//**
-    * @brief Find the 'next' devices on the 1-Wire network
-    * 
-    * @details 
-    *
-    * On Entry:
-    *
-    * On Exit:
-    *    @return TRUE  : device found, ROM number in ROM_NO buffer
-    *            FALSE : device not found, end of search
-    **************************************************************/
+
     virtual bool OWNext(void);
-    
-    
-    /**********************************************************//**
-    * @brief Verify the device with the ROM number in ROM_NO buffer 
-    *        is present.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *
-    * On Exit:
-    *    @return TRUE  : device verified present
-    *            FALSE : device not present
-    **************************************************************/
+
     virtual bool OWVerify(void);
-    
-    
-    /**********************************************************//**
-    * @brief Setup the search to find the device type 'family_code' 
-    *        on the next call to OWNext() if it is present.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *     @param[in] family_code - family code of device
-    *
-    * On Exit:
-    *    @return 
-    **************************************************************/
+
     virtual void OWTargetSetup(uint8_t family_code);
-    
-    
-    /**********************************************************//**
-    * @brief Setup the search to skip the current device type on the 
-    *        next call to OWNext().
-    * 
-    * @details 
-    *
-    * On Entry:
-    *
-    * On Exit:
-    *    @return 
-    **************************************************************/
+
     virtual void OWFamilySkipSetup(void);
     
-    
-    /**********************************************************//**
-    * @brief The 'OWSearch' function does a general search.  This 
-    *        function continues from the previous search state. The 
-    *        search state can be reset by using the 'OWFirst' 
-    *        function. This function contains one parameter 
-    *        'alarm_only'. When 'alarm_only' is TRUE (1) the find 
-    *        alarm command 0xEC is sent instead of the normal search 
-    *        command 0xF0. Using the find alarm command 0xEC will 
-    *        limit the search to only 1-Wire devices that are in an 
-    *        'alarm' state.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *
-    * On Exit:
-    *    @return TRUE (1) : when a 1-Wire device was found and its
-    *                       Serial Number placed in the global ROM 
-    *            FALSE (0): when no new device was found.  Either the
-    *                       last search was the last device or there
-    *                       are no devices on the 1-Wire Net.
-    **************************************************************/
     virtual bool OWSearch(void);
-    
-    
-    /**********************************************************//**
-    * @brief Set the 1-Wire Net communication speed.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *     @param[in] 'new_speed' - new speed defined as
-    *                              MODE_STANDARD   0x00
-    *                              MODE_OVERDRIVE  0x01
-    *
-    * On Exit:
-    *    @return current 1-Wire Net speed
-    **************************************************************/
+
     virtual uint8_t OWSpeed(uint8_t new_speed);
-    
-    
-    /**********************************************************//**
-    * @brief Set the 1-Wire Net line level pull-up to normal. The 
-    *        Ds248x does only allows enabling strong pull-up on a 
-    *        bit or byte event. Consequently this function only 
-    *        allows the MODE_STANDARD argument. To enable strong 
-    *        pull-up use OWWriteBytePower or OWReadBitPower. 
-    * 
-    * @details 
-    *
-    * On Entry:
-    *     @param[in] 'new_level' - new level defined as
-    *                              MODE_STANDARD     0x00
-    *
-    * On Exit:
-    *    @return current 1-Wire Net level
-    **************************************************************/
+
     virtual uint8_t OWLevel(uint8_t new_level);
-    
-    
-    /**********************************************************//**
-    * @brief Send 8 bits of communication to the 1-Wire Net and 
-    *        verify that the 8 bits read from the 1-Wire Net is the 
-    *        same (write operation).  The parameter 'sendbyte' least 
-    *        significant 8 bits are used.  After the 8 bits are sent 
-    *        change the level of the 1-Wire net.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *     @param[in] 'sendbyte' - 8 bits to send (least significant bit)
-    *
-    * On Exit:
-    *    @return TRUE: bytes written and echo was the same, strong pullup now on
-    *            FALSE: echo was not the same 
-    **************************************************************/
+
     virtual bool OWWriteBytePower(uint8_t sendbyte);
-    
-    
-    /**********************************************************//**
-    * @brief Send 1 bit of communication to the 1-Wire Net and verify
-    *        that the response matches the 'applyPowerResponse' bit 
-    *        and apply power delivery to the 1-Wire net.  Note that 
-    *        some implementations may apply the power first and then 
-    *        turn it off if the response is incorrect.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *     @param[in] 'applyPowerResponse' - 1 bit response to check, 
-    *                                       if correct 
-    *                                       then start power delivery 
-    *
-    * On Exit:
-    *    @return TRUE: bit written and response correct, strong pullup now on
-    *            FALSE: response incorrect
-    **************************************************************/
+
     virtual bool OWReadBitPower(uint8_t applyPowerResponse);
-    
-    
-    /**********************************************************//**
-    * @brief Calculate the CRC8 of the byte value provided with the 
-    *        current global 'crc8' value.
-    * 
-    * @details 
-    *
-    * On Entry:
-    *     @param[in] data
-    *
-    * On Exit:
-    *    @return current global crc8 value
-    **************************************************************/
-    virtual uint8_t calc_crc8(uint8_t data);
-    
-    
-    /**********************************************************//**
-    * @brief get_rom_number()
-    * 
-    * @details Get the ROM ID currently held in the private buffer
-    *
-    * On Entry:
-    *     @param[in] p_rom_buff - pointer to buffer for storing 
-    *                             rom number
-    *
-    * On Exit:
-    *    @return none
-    **************************************************************/
-    virtual void get_rom_number(uint8_t *p_rom_buff);
+
+    virtual uint8_t OWCalc_crc8(uint8_t data);
+
+    virtual void OWgetROMnumber(uint8_t *p_rom_buff);
     
     private: