Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Max32630_One_Wire_Interface
Revision 3:644fc630f958, committed 2016-01-31
- Comitter:
- j3
- Date:
- Sun Jan 31 22:42:01 2016 +0000
- Parent:
- 2:02d228c25fd4
- Child:
- 4:ca27db159b10
- Commit message:
- DS248X masters implemented, skeletons for the others, working on porting code for the DS28E17 1-wire to I2C bridge
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/OneWire_Masters/DS2480B/ds2480b.cpp Sun Jan 31 22:42:01 2016 +0000
@@ -0,0 +1,274 @@
+/******************************************************************//**
+* @file ds2480b.cpp
+*
+* @author Justin Jordan
+*
+* @version 0.0.0
+*
+* Started: 31JAN16
+*
+* Updated:
+*
+* @brief Source file for DS2480B Async Serial to 1-wire master
+***********************************************************************
+* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
+* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*
+* Except as contained in this notice, the name of Maxim Integrated
+* Products, Inc. shall not be used except as stated in the Maxim Integrated
+* Products, Inc. Branding Policy.
+*
+* The mere transfer of this software does not imply any licenses
+* of trade secrets, proprietary technology, copyrights, patents,
+* trademarks, maskwork rights, or any other form of intellectual
+* property whatsoever. Maxim Integrated Products, Inc. retains all
+* ownership rights.
+**********************************************************************/
+
+
+#include "ds2480b.h"
+
+
+//*********************************************************************
+Ds2480b::Ds2480b(Serial *p_serial)
+{
+ _p_serial = p_serial;
+ _serial_owner = false;
+}
+
+
+//*********************************************************************
+Ds2480b::Ds2480b(PinName tx, PinName rx, uint32_t baud)
+{
+ _p_serial = new Serial(tx, rx);
+ _p_serial->baud(baud);
+ _serial_owner = true;
+}
+
+
+//*********************************************************************
+Ds2480b::~Ds2480b()
+{
+ if(_serial_owner)
+ {
+ delete _p_serial;
+ }
+}
+
+
+//*********************************************************************
+bool Ds2480b::OWReset()
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+void Ds2480b::OWWriteBit(uint8_t sendbit)
+{
+ //TODO
+}
+
+
+//*********************************************************************
+uint8_t Ds2480b::OWReadBit()
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+//*********************************************************************
+uint8_t Ds2480b::OWTouchBit(uint8_t sendbit)
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+
+//*********************************************************************
+bool Ds2480b::OWWriteByte(uint8_t sendbyte)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+uint8_t Ds2480b::OWReadByte(void)
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+//*********************************************************************
+uint8_t Ds2480b::OWTouchByte(uint8_t sendbyte)
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+//*********************************************************************
+void Ds2480b::OWBlock(uint8_t *tran_buf, uint8_t tran_len)
+{
+ //TODO
+}
+
+
+//*********************************************************************
+bool Ds2480b::OWFirst(void)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+bool Ds2480b::OWNext(void)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+bool Ds2480b::OWVerify(void)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+void Ds2480b::OWTargetSetup(uint8_t family_code)
+{
+ //TODO
+}
+
+
+//*********************************************************************
+void Ds2480b::OWFamilySkipSetup(void)
+{
+ //TODO
+}
+
+
+//*********************************************************************
+bool Ds2480b::OWSearch(void)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+uint8_t Ds2480b::OWSpeed(uint8_t new_speed)
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+//*********************************************************************
+uint8_t Ds2480b::OWLevel(uint8_t new_level)
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+//*********************************************************************
+bool Ds2480b::OWWriteBytePower(uint8_t sendbyte)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+bool Ds2480b::OWReadBitPower(uint8_t applyPowerResponse)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+uint8_t Ds2480b::OWCalc_crc8(uint8_t data)
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+//*********************************************************************
+void Ds2480b::OWgetROMnumber(uint8_t *p_rom_buff)
+{
+ //TODO
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/OneWire_Masters/DS2480B/ds2480b.h Sun Jan 31 22:42:01 2016 +0000
@@ -0,0 +1,150 @@
+/******************************************************************//**
+* @file ds2480b.h
+*
+* @author Justin Jordan
+*
+* @version 0.0.0
+*
+* Started: 31JAN16
+*
+* Updated:
+*
+* @brief Header file for DS2480B Async Serial to 1-wire master
+***********************************************************************
+* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
+* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*
+* Except as contained in this notice, the name of Maxim Integrated
+* Products, Inc. shall not be used except as stated in the Maxim Integrated
+* Products, Inc. Branding Policy.
+*
+* The mere transfer of this software does not imply any licenses
+* of trade secrets, proprietary technology, copyrights, patents,
+* trademarks, maskwork rights, or any other form of intellectual
+* property whatsoever. Maxim Integrated Products, Inc. retains all
+* ownership rights.
+**********************************************************************/
+
+
+#ifndef DS2480B_H
+#define DS2480B_H
+
+
+#include "mbed.h"
+#include "OneWireInterface.h"
+
+
+class Ds2480b: public OneWireInterface
+{
+ public:
+
+ /**********************************************************//**
+ * @brief Ds2480b constructor
+ *
+ * @details allows user to use existing Serial object
+ *
+ * On Entry:
+ * @param[in] p_serial - pointer to existing serial object
+ *
+ * On Exit:
+ * @return
+ **************************************************************/
+ Ds2480b(Serial *p_serial);
+
+
+ /**********************************************************//**
+ * @brief Ds2480b constructor
+ *
+ * @details Object instantiates a new serial object with no
+ * public access
+ *
+ * On Entry:
+ * @param[in] tx - tx pin of uart to be used
+ * @param[in] rx - rx pin of uart to be used
+ * @param[in] baud - baudrate for uart
+ *
+ * On Exit:
+ * @return
+ **************************************************************/
+ Ds2480b(PinName tx, PinName rx, uint32_t baud);
+
+
+ /**********************************************************//**
+ * @brief Ds2480b destructor
+ *
+ * @details deletes serial object if owner
+ *
+ * On Entry:
+ *
+ * On Exit:
+ * @return
+ **************************************************************/
+ ~Ds2480b();
+
+
+ /***** OW API ****************************************************/
+ virtual bool OWReset();
+
+ virtual void OWWriteBit(uint8_t sendbit);
+
+ virtual uint8_t OWReadBit();
+
+ virtual uint8_t OWTouchBit(uint8_t sendbit);
+
+ virtual bool OWWriteByte(uint8_t sendbyte);
+
+ virtual uint8_t OWReadByte(void);
+
+ virtual uint8_t OWTouchByte(uint8_t sendbyte);
+
+ virtual void OWBlock(uint8_t *tran_buf, uint8_t tran_len);
+
+ virtual bool OWFirst(void);
+
+ virtual bool OWNext(void);
+
+ virtual bool OWVerify(void);
+
+ virtual void OWTargetSetup(uint8_t family_code);
+
+ virtual void OWFamilySkipSetup(void);
+
+ virtual bool OWSearch(void);
+
+ virtual uint8_t OWSpeed(uint8_t new_speed);
+
+ virtual uint8_t OWLevel(uint8_t new_level);
+
+ virtual bool OWWriteBytePower(uint8_t sendbyte);
+
+ virtual bool OWReadBitPower(uint8_t applyPowerResponse);
+
+ virtual uint8_t OWCalc_crc8(uint8_t data);
+
+ virtual void OWgetROMnumber(uint8_t *p_rom_buff);
+
+ private:
+
+ Serial *_p_serial;
+ bool _serial_owner;
+};
+
+#endif /*DS2480B_H*/
+
--- a/OneWire_Masters/DS248x/ds248x.cpp Sun Jan 31 06:15:24 2016 +0000
+++ b/OneWire_Masters/DS248x/ds248x.cpp Sun Jan 31 22:42:01 2016 +0000
@@ -772,7 +772,7 @@
// if the mask is 0 then go to new SerialNum byte rom_byte_number and reset mask
if (rom_byte_mask == 0)
{
- calc_crc8(_rom_number[rom_byte_number]); // accumulate the CRC
+ OWCalc_crc8(_rom_number[rom_byte_number]); // accumulate the CRC
rom_byte_number++;
rom_byte_mask = 1;
}
@@ -909,7 +909,7 @@
//*********************************************************************
-uint8_t Ds248x::calc_crc8(uint8_t data)
+uint8_t Ds248x::OWCalc_crc8(uint8_t data)
{
unsigned char i;
@@ -932,7 +932,7 @@
//*********************************************************************
-void Ds248x::get_rom_number(uint8_t *p_rom_buff)
+void Ds248x::OWgetROMnumber(uint8_t *p_rom_buff)
{
for(uint8_t idx = 0; idx < 8; idx++)
{
--- 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:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/OneWire_Masters/GPIO/owgpio.cpp Sun Jan 31 22:42:01 2016 +0000
@@ -0,0 +1,275 @@
+/******************************************************************//**
+* @file owgpio.cpp
+*
+* @author Justin Jordan
+*
+* @version 0.0.0
+*
+* Started: 31JAN16
+*
+* Updated:
+*
+* @brief Source file for bit-banging a 1-wire master
+***********************************************************************
+* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
+* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*
+* Except as contained in this notice, the name of Maxim Integrated
+* Products, Inc. shall not be used except as stated in the Maxim Integrated
+* Products, Inc. Branding Policy.
+*
+* The mere transfer of this software does not imply any licenses
+* of trade secrets, proprietary technology, copyrights, patents,
+* trademarks, maskwork rights, or any other form of intellectual
+* property whatsoever. Maxim Integrated Products, Inc. retains all
+* ownership rights.
+**********************************************************************/
+
+
+#include "owgpio.h"
+
+
+//*********************************************************************
+OwGpio::OwGpio(PinName ow_gpio)
+{
+ _ow_gpio = new DigitalInOut(ow_gpio);
+ _ow_gpio->input();
+ _ow_gpio->mode(PullUp);
+
+}
+
+
+//*********************************************************************
+OwGpio::OwGpio(PinName ow_gpio, PinName ext_spu)
+{
+ _ow_gpio = new DigitalInOut(ow_gpio);
+ _ow_gpio->input();
+ _ow_gpio->mode(PullUp);
+ _ext_spu = new DigitalOut(ext_spu, 1);
+}
+
+
+//*********************************************************************
+OwGpio::~OwGpio()
+{
+ delete _ow_gpio;
+ delete _ext_spu;
+}
+
+
+//*********************************************************************
+bool OwGpio::OWReset()
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+void OwGpio::OWWriteBit(uint8_t sendbit)
+{
+ //TODO
+}
+
+
+//*********************************************************************
+uint8_t OwGpio::OWReadBit()
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+//*********************************************************************
+uint8_t OwGpio::OWTouchBit(uint8_t sendbit)
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+
+//*********************************************************************
+bool OwGpio::OWWriteByte(uint8_t sendbyte)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+uint8_t OwGpio::OWReadByte(void)
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+//*********************************************************************
+uint8_t OwGpio::OWTouchByte(uint8_t sendbyte)
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+//*********************************************************************
+void OwGpio::OWBlock(uint8_t *tran_buf, uint8_t tran_len)
+{
+ //TODO
+}
+
+
+//*********************************************************************
+bool OwGpio::OWFirst(void)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+bool OwGpio::OWNext(void)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+bool OwGpio::OWVerify(void)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+void OwGpio::OWTargetSetup(uint8_t family_code)
+{
+ //TODO
+}
+
+
+//*********************************************************************
+void OwGpio::OWFamilySkipSetup(void)
+{
+ //TODO
+}
+
+
+//*********************************************************************
+bool OwGpio::OWSearch(void)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+uint8_t OwGpio::OWSpeed(uint8_t new_speed)
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+//*********************************************************************
+uint8_t OwGpio::OWLevel(uint8_t new_level)
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+//*********************************************************************
+bool OwGpio::OWWriteBytePower(uint8_t sendbyte)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+bool OwGpio::OWReadBitPower(uint8_t applyPowerResponse)
+{
+ bool rtn_val;
+
+ //TODO
+
+ return rtn_val;
+}
+
+
+//*********************************************************************
+uint8_t OwGpio::OWCalc_crc8(uint8_t data)
+{
+ uint8_t rtn_val;
+
+ //TODO
+
+ return(rtn_val);
+}
+
+
+//*********************************************************************
+void OwGpio::OWgetROMnumber(uint8_t *p_rom_buff)
+{
+ //TODO
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/OneWire_Masters/GPIO/owgpio.h Sun Jan 31 22:42:01 2016 +0000
@@ -0,0 +1,144 @@
+/******************************************************************//**
+* @file owgpio.h
+*
+* @author Justin Jordan
+*
+* @version 0.0.0
+*
+* Started: 31JAN16
+*
+* Updated:
+*
+* @brief Header file for bit-banging a 1-wire master
+***********************************************************************
+* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
+* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*
+* Except as contained in this notice, the name of Maxim Integrated
+* Products, Inc. shall not be used except as stated in the Maxim Integrated
+* Products, Inc. Branding Policy.
+*
+* The mere transfer of this software does not imply any licenses
+* of trade secrets, proprietary technology, copyrights, patents,
+* trademarks, maskwork rights, or any other form of intellectual
+* property whatsoever. Maxim Integrated Products, Inc. retains all
+* ownership rights.
+**********************************************************************/
+
+
+#ifndef OWGPIO_H
+#define OWGPIO_H
+
+
+#include "mbed.h"
+#include "OneWireInterface.h"
+
+
+class OwGpio: public OneWireInterface
+{
+ public:
+
+ /**********************************************************//**
+ * @brief
+ *
+ * @details
+ *
+ * On Entry:
+ *
+ * On Exit:
+ * @return
+ **************************************************************/
+ OwGpio(PinName ow_gpio);
+
+
+ /**********************************************************//**
+ * @brief
+ *
+ * @details
+ *
+ * On Entry:
+ *
+ * On Exit:
+ * @return
+ **************************************************************/
+ OwGpio(PinName ow_gpio, PinName ext_spu);
+
+
+ /**********************************************************//**
+ * @brief
+ *
+ * @details
+ *
+ * On Entry:
+ *
+ * On Exit:
+ * @return
+ **************************************************************/
+ ~OwGpio();
+
+
+ /***** OW API ****************************************************/
+ virtual bool OWReset();
+
+ virtual void OWWriteBit(uint8_t sendbit);
+
+ virtual uint8_t OWReadBit();
+
+ virtual uint8_t OWTouchBit(uint8_t sendbit);
+
+ virtual bool OWWriteByte(uint8_t sendbyte);
+
+ virtual uint8_t OWReadByte(void);
+
+ virtual uint8_t OWTouchByte(uint8_t sendbyte);
+
+ virtual void OWBlock(uint8_t *tran_buf, uint8_t tran_len);
+
+ virtual bool OWFirst(void);
+
+ virtual bool OWNext(void);
+
+ virtual bool OWVerify(void);
+
+ virtual void OWTargetSetup(uint8_t family_code);
+
+ virtual void OWFamilySkipSetup(void);
+
+ virtual bool OWSearch(void);
+
+ virtual uint8_t OWSpeed(uint8_t new_speed);
+
+ virtual uint8_t OWLevel(uint8_t new_level);
+
+ virtual bool OWWriteBytePower(uint8_t sendbyte);
+
+ virtual bool OWReadBitPower(uint8_t applyPowerResponse);
+
+ virtual uint8_t OWCalc_crc8(uint8_t data);
+
+ virtual void OWgetROMnumber(uint8_t *p_rom_buff);
+
+ private:
+
+ DigitalInOut *_ow_gpio;
+ DigitalOut *_ext_spu;
+};
+
+#endif /*OWGPIO_H*/
--- a/OneWire_Masters/OneWireInterface.h Sun Jan 31 06:15:24 2016 +0000
+++ b/OneWire_Masters/OneWireInterface.h Sun Jan 31 22:42:01 2016 +0000
@@ -386,7 +386,7 @@
* On Exit:
* @return current global crc8 value
**************************************************************/
- virtual uint8_t calc_crc8(uint8_t data) = 0;
+ virtual uint8_t OWCalc_crc8(uint8_t data) = 0;
/**********************************************************//**
@@ -401,7 +401,7 @@
* On Exit:
* @return none
**************************************************************/
- virtual void get_rom_number(uint8_t *p_rom_buff) = 0;
+ virtual void OWgetROMnumber(uint8_t *p_rom_buff) = 0;
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/readme.txt Sun Jan 31 22:42:01 2016 +0000 @@ -0,0 +1,65 @@ +/****************************************************************************** +* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included +* in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES +* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Except as contained in this notice, the name of Maxim Integrated +* Products, Inc. shall not be used except as stated in the Maxim Integrated +* Products, Inc. Branding Policy. +* +* The mere transfer of this software does not imply any licenses +* of trade secrets, proprietary technology, copyrights, patents, +* trademarks, maskwork rights, or any other form of intellectual +* property whatsoever. Maxim Integrated Products, Inc. retains all +* ownership rights. +* +* mbed OneWire library +* version 0.0.0 +* 1/31/16 +* +* This source code is designed for the online development enviroment mbed 2.0 +******************************************************************************/ + + + +OneWire - CONTENTS: +| +|-->OneWire_Bridge - source code in this folder supports devices that convert +| 1-wire to another serial protocol +| +|---->ds28e17 +| +|-->OneWire_Dataloggers - source code in this folder supports i-button +| dataloggers +| +|-->OneWire_Masters - source code in this folder supports 1-wire masters. +| The interface class 'OneWireInterface' can be found in this folder. +| +|---->OneWireInterface - defines interface that all masters should provide, follow +|---->ds2480b +|---->ds248x +|---->gpio - bitbang +| +|-->OneWire_Memory +| +|-->OneWire_Switches +| +|-->OneWire_Temperature +| +|-->This readme.txt file