![]() |
OneWire Library for Arduino
version: 1.0.0
|
DS1920 1-wire temperature i-button. More...
#include <DS1920.h>
Public Types | |
enum | CmdResult { Success, CommsReadError, CommsWriteError, OpFailure } |
Result of operations. More... | |
![]() | |
enum | CmdResult { Success, CommunicationError, CrcError, TimeoutError, OperationFailure } |
Public Member Functions | |
DS1920 (RandomAccessRomIterator &selector) | |
DS1920 constructor. More... | |
CmdResult | writeScratchPad (uint8_t th, uint8_t tl) |
Write Scratchpad Command. More... | |
CmdResult | readScratchPad (uint8_t *scratchPadBuff) |
Read Scratchpad Command. More... | |
CmdResult | copyScratchPad (void) |
Copy Scratchpad Command. More... | |
CmdResult | convertTemperature (float &temp) |
Convert Temperature Command. More... | |
CmdResult | recallEEPROM (void) |
Recall Command. More... | |
![]() | |
RomId | romId () const |
void | setRomId (const RomId &romId) |
Static Public Attributes | |
static const uint8_t | DS1920_FAMILY_CODE = 0x10 |
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... | |
DS1920 1-wire temperature i-button.
The iButton® temperature logger (DS1920) provides direct-to-digital 9-bit temperature readings over a range of -55°C to +100°C in 0.5° increments. The iButton communicates with a processor using the 1-Wire® protocol through a hardware port interface. The port interface provides both the physical link and handles the communication protocols that enable the processor to access iButton resources with simple commands. Two bytes of EEPROM can be used either to set alarm triggers or for storing user data.
DS1920::DS1920 | ( | RandomAccessRomIterator & | selector | ) |
DS1920 constructor.
On Entry:
[in] | selector | - Reference to RandomAccessRomiteraor object that encapsulates owm master that has access to this device and ROM function commands used to a select device |
On Exit:
DS1920::CmdResult DS1920::convertTemperature | ( | float & | temp | ) |
Convert Temperature Command.
This command begins a temperature conversion.
On Entry:
[in] | On | Exit: |
[out] | temp | - temperature conversion results |
DS1920::CmdResult DS1920::copyScratchPad | ( | void | ) |
Copy Scratchpad Command.
This command copies from the scratchpad into the EEPROM of the DS1920, storing the temperature trigger bytes in nonvolatile memory.
On Entry:
[in] | On | Exit: |
[out] | return CmdResult - result of operation |
DS1920::CmdResult DS1920::readScratchPad | ( | uint8_t * | scratchPadBuff | ) |
Read Scratchpad Command.
This command reads the complete scratchpad.
On Entry:
[in] | scratchPadBuff | - array for receiving contents of scratchpad, this buffer will be over written |
On Exit:
[out] | scratchPadBuff | - contents of scratchpad |
DS1920::CmdResult DS1920::recallEEPROM | ( | void | ) |
Recall Command.
This command recalls the temperature trigger values stored in EEPROM to the scratchpad
On Entry:
[in] | On | Exit: |
[out] | return CmdResult - result of operation |
DS1920::CmdResult DS1920::writeScratchPad | ( | uint8_t | th, |
uint8_t | tl | ||
) |
Write Scratchpad Command.
If the result of a temperature measurement is higher than TH or lower than TL, an alarm flag inside the device is set. This flag is updated with every temperature measurement. As long as the alarm flag is set, the DS1920 will respond to the alarm search command.
On Entry:
[in] | th | - 8-bit upper temperature threshold, MSB indicates sign |
[in] | tl | - 8-bit lower temperature threshold, MSB indicates sign |
On Exit:
[out] | return CmdResult - result of operation |
|
static |