OneWire Library for Arduino  version: 1.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
OneWire::DS28E17 Class Reference

DS28E17 1-Wire®-to-I2C Master Bridge. More...

#include <DS28E17.h>

Inheritance diagram for OneWire::DS28E17:
OneWire::OneWireSlave

Public Types

enum  CmdResult {
  Success, CommsReadBitError, CommsWriteBitError, CommsReadByteError,
  CommsWriteByteError, CommsReadBlockError, CommsWriteBlockError, TimeoutError,
  OperationFailure
}
 Result of all operations. More...
 
- Public Types inherited from OneWire::OneWireSlave
enum  CmdResult {
  Success, CommunicationError, CrcError, TimeoutError,
  OperationFailure
}
 

Public Member Functions

 DS28E17 (RandomAccessRomIterator &selector)
 DS28E17 constructor. More...
 
CmdResult I2C_WriteDataWithStop (uint8_t I2C_addr, uint8_t length, uint8_t *data, uint8_t &status, uint8_t &wr_status)
 Write to selected DS28E17's I2C with Stop. Poll until I2C write complete and receive status info. More...
 
CmdResult I2C_WriteDataNoStop (uint8_t I2C_addr, uint8_t length, uint8_t *data, uint8_t &status, uint8_t &wr_status)
 Write to selected DS28E17's I2C No Stop. Poll until I2C write complete and receive status info. More...
 
CmdResult I2C_WriteDataOnly (uint8_t length, uint8_t *data, uint8_t &status, uint8_t &wr_status)
 Write to selected DS28E17's I2C with Data only. Poll until I2C write complete and receive status info. More...
 
CmdResult I2C_WriteDataOnlyWithStop (uint8_t length, uint8_t *data, uint8_t &status, uint8_t &wr_status)
 Write to selected DS28E17's I2C with Stop. Poll until I2C write complete and receive status info. More...
 
CmdResult I2C_WriteReadDataWithStop (uint8_t I2C_addr, uint8_t length, uint8_t *data, uint8_t nu_bytes_read, uint8_t &status, uint8_t &wr_status, uint8_t *read_data)
 Write to selected DS28E17's I2C with Stop and poll until I2C write complete receive status info, and read data with a stop at the end. More...
 
CmdResult I2C_ReadDataWithStop (uint8_t I2C_addr, uint8_t nu_bytes_read, uint8_t &status, uint8_t *read_data)
 Selected DS28E17's and send I2C address and poll until I2C read address complete, receive status info, and read data with a stop at the end. More...
 
CmdResult WriteConfigReg (uint8_t data)
 Write to Configuration Register of DS28E17. More...
 
CmdResult ReadConfigReg (uint8_t &config)
 Read the Configuration Register of DS28E17. More...
 
CmdResult EnableSleepMode ()
 The Enable Sleep Mode command puts the device into a low current mode. All 1-Wire communication is ignored until woken up. Immediately after the command, the device monitors the WAKEUP input pin and exits sleep mode on a rising edge. More...
 
CmdResult ReadDeviceRevision (uint8_t &rev)
 Read the Device Revision of DS28E17. The revision value should never be zero. The upper nibble is the major revision and the lower nibble is the minor revision. More...
 
- Public Member Functions inherited from OneWire::OneWireSlave
RomId romId () const
 
void setRomId (const RomId &romId)
 

Static Public Attributes

static const uint8_t DS28E17_FAMILY_CODE = 0x19
 

Additional Inherited Members

- Protected Member Functions inherited from OneWire::OneWireSlave
 OneWireSlave (RandomAccessRomIterator &selector)
 
OneWireMaster::CmdResult selectDevice () const
 Select this slave device by ROM ID. More...
 
OneWireMastermaster () const
 The 1-Wire master for this slave device. More...
 

Detailed Description

DS28E17 1-Wire®-to-I2C Master Bridge.

The DS28E17 is a 1-Wire slave to I2C master bridge device that interfaces directly to I2C slaves at standard (100kHz max) or fast (400kHz max). Data transfers serially by means of the 1-Wire® protocol, which requires only a single data lead and a ground return. Every DS28E17 is guaranteed to have a unique 64-bit ROM registration number that serves as a node address in the 1-Wire network. Multiple DS28E17 devices can coexist with other devices in the 1-Wire network and be accessed individually without affecting other devices. The DS28E17 allows using complex I2C devices such as display controllers, ADCs, DACs, I2C sensors, etc. in a 1-Wire environment. Each self-timed DS28E17 provides 1-Wire access for a single I2C interface.

Member Enumeration Documentation

Result of all operations.

Enumerator
Success 
CommsReadBitError 
CommsWriteBitError 
CommsReadByteError 
CommsWriteByteError 
CommsReadBlockError 
CommsWriteBlockError 
TimeoutError 
OperationFailure 

Constructor & Destructor Documentation

DS28E17::DS28E17 ( RandomAccessRomIterator selector)

DS28E17 constructor.

On Entry:

Parameters
[in]selector- RandomAccessRomIterator object that encapsulates master associated with this device and rom control commands

Member Function Documentation

DS28E17::CmdResult DS28E17::EnableSleepMode ( )

The Enable Sleep Mode command puts the device into a low current mode. All 1-Wire communication is ignored until woken up. Immediately after the command, the device monitors the WAKEUP input pin and exits sleep mode on a rising edge.

Returns
CmdResult - result of operation
DS28E17::CmdResult DS28E17::I2C_ReadDataWithStop ( uint8_t  I2C_addr,
uint8_t  nu_bytes_read,
uint8_t &  status,
uint8_t *  read_data 
)

Selected DS28E17's and send I2C address and poll until I2C read address complete, receive status info, and read data with a stop at the end.

Output on I2C: S, Slave Address + Read, Read Data [1-255], P (NACK last read byte)

On Entry:

Parameters
[in]I2C_addrWrites I2C address. The least significant bit of the I2C address is automatically cleared by the command.

On Exit:

Parameters
[out]nu_bytes_readNumber of I2C bytes to read. A value of zero will assert the Error Detected pin (ED).
[out]statusDetects the condition of the Start (bit3), N/A (bit2), Address(bit1) and CRC16(bit0) bits. b3;0=No Err|1=I2CStart prev-not issued, b2;0=No Err|1=I2C N/A Err, b1;0=No Err|1=Addr Err, b0;0=Valid CRC16|1=Invalid CRC16
[out]*read_dataArray of read data received from I2C.
Returns
CmdResult - result of operation
DS28E17::CmdResult DS28E17::I2C_WriteDataNoStop ( uint8_t  I2C_addr,
uint8_t  length,
uint8_t *  data,
uint8_t &  status,
uint8_t &  wr_status 
)

Write to selected DS28E17's I2C No Stop. Poll until I2C write complete and receive status info.

Output on I2C: S, Address + Write, Write Data [1-255]

On Entry:

Parameters
[in]I2C_addrWrites I2C address. The least significant bit of the I2C address is automatically cleared by the command.
[in]lengthThe number of data bytes to be written ranging from 01h to FFh. A value of zero will assert the Error Detected pin (ED).
[in]*dataUser defines write data ranging from 1-255 bytes.

On Exit:

Parameters
[out]statusDetects the condition of the Start (bit3), N/A (bit2), Address(bit1) and CRC16(bit0) bits. b3;0=No Err|1=I2CStart prev-not issued, b2;0=No Err|1=I2C N/A Err, b1;0=No Err|1=Addr Err, b0;0=Valid CRC16|1=Invalid CRC16
[out]wr_statusIndicates which write byte NACK’d. A value of 00h indicates all bytes were acknowledged by the slave. A non-zero value indicates the byte number that NACK’d.
Returns
CmdResult - result of operation
DS28E17::CmdResult DS28E17::I2C_WriteDataOnly ( uint8_t  length,
uint8_t *  data,
uint8_t &  status,
uint8_t &  wr_status 
)

Write to selected DS28E17's I2C with Data only. Poll until I2C write complete and receive status info.

Output on I2C: Write Data [1-255]

On Entry:

Parameters
[in]lengthThe number of data bytes to be written ranging from 01h to FFh. A value of zero will assert the Error Detected pin (ED).
[in]*dataUser defines write data ranging from 1-255 bytes.

On Exit:

Parameters
[out]statusDetects the condition of the Start (bit3), N/A (bit2), Address(bit1) and CRC16(bit0) bits. b3;0=No Err|1=I2CStart prev-not issued, b2;0=No Err|1=I2C N/A Err, b1;0=No Err|1=Addr Err, b0;0=Valid CRC16|1=Invalid CRC16
[out]wr_statusIndicates which write byte NACK’d. A value of 00h indicates all bytes were acknowledged by the slave. A non-zero value indicates the byte number that NACK’d.
Returns
CmdResult - result of operation
DS28E17::CmdResult DS28E17::I2C_WriteDataOnlyWithStop ( uint8_t  length,
uint8_t *  data,
uint8_t &  status,
uint8_t &  wr_status 
)

Write to selected DS28E17's I2C with Stop. Poll until I2C write complete and receive status info.

Output on I2C: Write Data [1-255], P

On Entry:

Parameters
[in]lengthThe number of data bytes to be written ranging from 01h to FFh. A value of zero will assert the Error Detected pin (ED).
[in]*dataUser defines write data ranging from 1-255 bytes.

On Exit:

Parameters
[out]statusDetects the condition of the Start (bit3), N/A (bit2), Address(bit1) and CRC16(bit0) bits. b3;0=No Err|1=I2CStart prev-not issued, b2;0=No Err|1=I2C N/A Err, b1;0=No Err|1=Addr Err, b0;0=Valid CRC16|1=Invalid CRC16
[out]wr_statusIndicates which write byte NACK’d. A value of 00h indicates all bytes were acknowledged by the slave. A non-zero value indicates the byte number that NACK’d.
Returns
CmdResult - result of operation
DS28E17::CmdResult DS28E17::I2C_WriteDataWithStop ( uint8_t  I2C_addr,
uint8_t  length,
uint8_t *  data,
uint8_t &  status,
uint8_t &  wr_status 
)

Write to selected DS28E17's I2C with Stop. Poll until I2C write complete and receive status info.

Output on I2C: S, Address + Write, Write Data [1-255], P

On Entry:

Parameters
[in]I2C_addr- Writes I2C address. The least significant bit of the I2C address is automatically cleared by the command.
[in]lengthThe number of data bytes to be written ranging from 01h to FFh. A value of zero will assert the Error Detected pin (ED).
[in]*dataUser defines write data ranging from 1-255 bytes.

On Exit:

Parameters
[out]statusDetects the condition of the Start (bit3), N/A (bit2), Address(bit1) and CRC16(bit0) bits. b3;0=No Err|1=I2CStart prev-not issued, b2;0=No Err|1=I2C N/A Err, b1;0=No Err|1=Addr Err, b0;0=Valid CRC16|1=Invalid CRC16
[out]wr_statusIndicates which write byte NACK’d. A value of 00h indicates all bytes were acknowledged by the slave. A non-zero value indicates the byte number that NACK’d.
Returns
CmdResult - result of operation
DS28E17::CmdResult DS28E17::I2C_WriteReadDataWithStop ( uint8_t  I2C_addr,
uint8_t  length,
uint8_t *  data,
uint8_t  nu_bytes_read,
uint8_t &  status,
uint8_t &  wr_status,
uint8_t *  read_data 
)

Write to selected DS28E17's I2C with Stop and poll until I2C write complete receive status info, and read data with a stop at the end.

Output on I2C: S, Slave Address + Write, Write Data [1-255], Sr, Address + Read, Read Data [1-255], P (NACK last read byte)

On Entry:

Parameters
[in]I2C_addrWrites I2C address. The least significant bit of the I2C address is automatically cleared by the command.
[in]lengthThe number of data bytes to be written ranging from 01h to FFh. A value of zero will assert the Error Detected pin (ED).
[in]*dataUser defines write data ranging from 1-255 bytes.
[in]nu_bytes_readNumber of I2C bytes to read. A value of zero will assert the Error Detected pin (ED).

On Exit:

Parameters
[out]statusDetects the condition of the Start (bit3), N/A (bit2), Address(bit1) and CRC16(bit0) bits. b3;0=No Err|1=I2CStart prev-not issued, b2;0=No Err|1=I2C N/A Err, b1;0=No Err|1=Addr Err, b0;0=Valid CRC16|1=Invalid CRC16
[out]wr_statusIndicates which write byte NACK’d. A value of 00h indicates all bytes were acknowledged by the slave. A non-zero value indicates the byte number that NACK’d.
[out]*read_dataArray of read data received from I2C.
Returns
CmdResult - result of operation
DS28E17::CmdResult DS28E17::ReadConfigReg ( uint8_t &  config)

Read the Configuration Register of DS28E17.

On Exit:

Parameters
[out]config- contents of configuration register
Returns
CmdResult - result of operation
DS28E17::CmdResult DS28E17::ReadDeviceRevision ( uint8_t &  rev)

Read the Device Revision of DS28E17. The revision value should never be zero. The upper nibble is the major revision and the lower nibble is the minor revision.

On Exit:

Parameters
[out]rev- device revision
Returns
CmdResult - result of operation
DS28E17::CmdResult DS28E17::WriteConfigReg ( uint8_t  data)

Write to Configuration Register of DS28E17.

On Entry:

Parameters
[in]datasent to configuration register
Returns
CmdResult - result of operation

Member Data Documentation

const uint8_t OneWire::DS28E17::DS28E17_FAMILY_CODE = 0x19
static

The documentation for this class was generated from the following files: