Maxim Integrated / OneWire

Dependents:   MAXREFDES131_Qt_Demo MAX32630FTHR_iButton_uSD_Logger MAX32630FTHR_DS18B20_uSD_Logger MAXREFDES130_131_Demo ... more

Embed: (wiki syntax)

« Back to documentation index

DS28E17 Class Reference

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

#include <DS28E17.h>

Inherits OneWire::OneWireSlave.

Public Types

enum  CmdResult
 

Result of all operations.

More...

Public Member Functions

 DS28E17 (RandomAccessRomIterator &selector)
 DS28E17 constructor.
CmdResult 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.
CmdResult 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.
CmdResult writeDataOnly (uint8_t length, uint8_t *data, uint8_t &status, uint8_t &wr_status)
 Write to selected DS28E17's I2C with Data only.
CmdResult writeDataOnlyWithStop (uint8_t length, uint8_t *data, uint8_t &status, uint8_t &wr_status)
 Write to selected DS28E17's I2C with Stop.
CmdResult 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.
CmdResult 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.
CmdResult writeConfigReg (uint8_t data)
 Write to Configuration Register of DS28E17.
CmdResult readConfigReg (uint8_t &config)
 Read the Configuration Register of DS28E17.
CmdResult enableSleepMode ()
 The Enable Sleep Mode command puts the device into a low current mode.
CmdResult readDeviceRevision (uint8_t &rev)
 Read the Device Revision of DS28E17.
RomId romId () const

Protected Member Functions

OneWireMaster::CmdResult selectDevice () const
 Select this slave device by ROM ID.
OneWireMastermaster () const
 The 1-Wire master for this slave device.

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.

Definition at line 61 of file DS28E17.h.


Member Enumeration Documentation

enum CmdResult

Result of all operations.

Reimplemented from OneWireSlave.

Definition at line 66 of file DS28E17.h.


Constructor & Destructor Documentation

DS28E17 ( RandomAccessRomIterator selector )

DS28E17 constructor.

On Entry:

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

Definition at line 57 of file DS28E17.cpp.


Member Function Documentation

DS28E17::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.

Returns:
CmdResult - result of operation

Definition at line 441 of file DS28E17.cpp.

OneWireMaster& master (  ) const [protected, inherited]

The 1-Wire master for this slave device.

Definition at line 77 of file OneWireSlave.h.

DS28E17::CmdResult readConfigReg ( uint8_t &  config )

Read the Configuration Register of DS28E17.

On Exit:

Parameters:
[out]config- contents of configuration register
Returns:
CmdResult - result of operation

Definition at line 408 of file DS28E17.cpp.

DS28E17::CmdResult 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_addrDefines the 7-bit I2C address to be written. The least significant bit must be set, indicating an I2C read.

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

Definition at line 326 of file DS28E17.cpp.

DS28E17::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.

On Exit:

Parameters:
[out]rev- device revision
Returns:
CmdResult - result of operation

Definition at line 466 of file DS28E17.cpp.

RomId romId (  ) const [inherited]

1-Wire ROM ID for this slave device.

Definition at line 59 of file OneWireSlave.h.

OneWireMaster::CmdResult selectDevice (  ) const [protected, inherited]

Select this slave device by ROM ID.

Definition at line 74 of file OneWireSlave.h.

DS28E17::CmdResult writeConfigReg ( uint8_t  data )

Write to Configuration Register of DS28E17.

On Entry:

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

Definition at line 381 of file DS28E17.cpp.

DS28E17::CmdResult 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

Definition at line 116 of file DS28E17.cpp.

DS28E17::CmdResult 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

Definition at line 165 of file DS28E17.cpp.

DS28E17::CmdResult 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

Definition at line 211 of file DS28E17.cpp.

DS28E17::CmdResult 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

Definition at line 65 of file DS28E17.cpp.

DS28E17::CmdResult 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

Definition at line 257 of file DS28E17.cpp.