![]() |
OneWire Library for Arduino
version: 1.0.0
|
DS28E17 1-Wire®-to-I2C Master Bridge. More...
#include <DS28E17.h>
Public Types | |
enum | CmdResult { Success, CommsReadBitError, CommsWriteBitError, CommsReadByteError, CommsWriteByteError, CommsReadBlockError, CommsWriteBlockError, TimeoutError, OperationFailure } |
Result of all operations. More... | |
![]() | |
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... | |
![]() | |
RomId | romId () const |
void | setRomId (const RomId &romId) |
Static Public Attributes | |
static const uint8_t | DS28E17_FAMILY_CODE = 0x19 |
Additional Inherited Members | |
![]() | |
OneWireSlave (RandomAccessRomIterator &selector) | |
OneWireMaster::CmdResult | selectDevice () const |
Select this slave device by ROM ID. More... | |
OneWireMaster & | master () const |
The 1-Wire master for this slave device. More... | |
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.
DS28E17::DS28E17 | ( | RandomAccessRomIterator & | selector | ) |
DS28E17 constructor.
On Entry:
[in] | selector | - RandomAccessRomIterator object that encapsulates master associated with this device and rom control commands |
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.
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:
[in] | I2C_addr | Writes I2C address. The least significant bit of the I2C address is automatically cleared by the command. |
On Exit:
[out] | nu_bytes_read | Number of I2C bytes to read. A value of zero will assert the Error Detected pin (ED). |
[out] | status | Detects 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_data | Array of read data received from I2C. |
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:
[in] | I2C_addr | Writes I2C address. The least significant bit of the I2C address is automatically cleared by the command. |
[in] | length | The number of data bytes to be written ranging from 01h to FFh. A value of zero will assert the Error Detected pin (ED). |
[in] | *data | User defines write data ranging from 1-255 bytes. |
On Exit:
[out] | status | Detects 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_status | Indicates 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. |
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:
[in] | length | The number of data bytes to be written ranging from 01h to FFh. A value of zero will assert the Error Detected pin (ED). |
[in] | *data | User defines write data ranging from 1-255 bytes. |
On Exit:
[out] | status | Detects 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_status | Indicates 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. |
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:
[in] | length | The number of data bytes to be written ranging from 01h to FFh. A value of zero will assert the Error Detected pin (ED). |
[in] | *data | User defines write data ranging from 1-255 bytes. |
On Exit:
[out] | status | Detects 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_status | Indicates 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. |
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:
[in] | I2C_addr | - Writes I2C address. The least significant bit of the I2C address is automatically cleared by the command. |
[in] | length | The number of data bytes to be written ranging from 01h to FFh. A value of zero will assert the Error Detected pin (ED). |
[in] | *data | User defines write data ranging from 1-255 bytes. |
On Exit:
[out] | status | Detects 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_status | Indicates 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. |
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:
[in] | I2C_addr | Writes I2C address. The least significant bit of the I2C address is automatically cleared by the command. |
[in] | length | The number of data bytes to be written ranging from 01h to FFh. A value of zero will assert the Error Detected pin (ED). |
[in] | *data | User defines write data ranging from 1-255 bytes. |
[in] | nu_bytes_read | Number of I2C bytes to read. A value of zero will assert the Error Detected pin (ED). |
On Exit:
[out] | status | Detects 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_status | Indicates 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_data | Array of read data received from I2C. |
DS28E17::CmdResult DS28E17::ReadConfigReg | ( | uint8_t & | config | ) |
Read the Configuration Register of DS28E17.
On Exit:
[out] | config | - contents of configuration register |
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:
[out] | rev | - device revision |
DS28E17::CmdResult DS28E17::WriteConfigReg | ( | uint8_t | data | ) |
Write to Configuration Register of DS28E17.
On Entry:
[in] | data | sent to configuration register |
|
static |