Device interface library for multiple platforms including Mbed.

Dependents:   DeepCover Embedded Security in IoT MaximInterface MAXREFDES155#

Embed: (wiki syntax)

« Back to documentation index

DS2482_DS2484 Class Reference

Interface to the DS2484, DS2482-100, DS2482-101, DS2482-800 1-Wire masters. More...

#include <DS2482_DS2484.hpp>

Inherits MaximInterfaceCore::OneWireMaster.

Inherited by DS2482_100, DS2482_800, and DS2484.

Data Structures

class  Config
 Represents a device configuration. More...

Public Types

enum  ErrorValue
 

Result of all 1-Wire commands.

More...
enum  Speed
 

Speed of the 1-Wire bus.

More...
enum  Level
 

Level of the 1-Wire bus.

More...

Public Member Functions

MaximInterfaceDevices_EXPORT
Core::Result< void > 
initialize (Config config=Config())
 Initialize hardware for use.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
writeConfig (Config config)
 Write a new configuration to the device.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< TripletData
triplet (bool sendBit)
 1-Wire Triplet operation.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< void > 
reset ()
 Reset all of the devices on the 1-Wire bus and check for a presence pulse.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< bool > 
touchBitSetLevel (bool sendBit, Level afterLevel)
 Send and receive one bit of communication and set a new level on the 1-Wire bus.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< uint_least8_t > 
readByteSetLevel (Level afterLevel)
 Receive one byte of communication and set a new level on the 1-Wire bus.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< void > 
writeByteSetLevel (uint_least8_t sendByte, Level afterLevel)
 Send one byte of communication and set a new level on the 1-Wire bus.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< void > 
setSpeed (Speed newSpeed)
 Set the 1-Wire bus communication speed.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< void > 
setLevel (Level newLevel)
 Set the 1-Wire bus level.
virtual
MaximInterfaceCore_EXPORT
Result< void > 
writeBlock (span< const uint_least8_t > sendBuf)
 Send a block of communication on the 1-Wire bus.
virtual
MaximInterfaceCore_EXPORT
Result< void > 
readBlock (span< uint_least8_t > recvBuf)
 Receive a block of communication on the 1-Wire bus.
Result< void > writeBitSetLevel (bool sendBit, Level afterLevel)
 Send one bit of communication and set a new level on the 1-Wire bus.
Result< bool > readBitSetLevel (Level afterLevel)
 Receive one bit of communication and set a new level on the 1-Wire bus.

Protected Member Functions

Core::Result< void > sendCommand (uint_least8_t cmd) const
Core::Result< void > sendCommand (uint_least8_t cmd, uint_least8_t param) const
Core::Result< uint_least8_t > readRegister (uint_least8_t reg) const
 Reads a register from the device.
Core::Result< uint_least8_t > readRegister () const
 Reads the current register from the device.

Detailed Description

Interface to the DS2484, DS2482-100, DS2482-101, DS2482-800 1-Wire masters.

Definition at line 43 of file DS2482_DS2484.hpp.


Member Enumeration Documentation

enum ErrorValue

Result of all 1-Wire commands.

Reimplemented from OneWireMaster.

Definition at line 45 of file DS2482_DS2484.hpp.

enum Level [inherited]

Level of the 1-Wire bus.

Definition at line 51 of file OneWireMaster.hpp.

enum Speed [inherited]

Speed of the 1-Wire bus.

Definition at line 48 of file OneWireMaster.hpp.


Member Function Documentation

Result< void > initialize ( Config  config = Config() )

Initialize hardware for use.

Definition at line 51 of file DS2482_DS2484.cpp.

Result<bool> readBitSetLevel ( Level  afterLevel ) [inherited]

Receive one bit of communication and set a new level on the 1-Wire bus.

Parameters:
afterLevelLevel to set the 1-Wire bus to after communication.
Returns:
Received data from the 1-Wire bus.

Definition at line 135 of file OneWireMaster.hpp.

Result< void > readBlock ( span< uint_least8_t >  recvBuf ) [virtual, inherited]

Receive a block of communication on the 1-Wire bus.

Parameters:
[out]recvBufBuffer to receive the data from the 1-Wire bus.

Reimplemented in DS2465.

Definition at line 72 of file OneWireMaster.cpp.

Result< uint_least8_t > readByteSetLevel ( Level  afterLevel ) [virtual]

Receive one byte of communication and set a new level on the 1-Wire bus.

Parameters:
afterLevelLevel to set the 1-Wire bus to after communication.
Returns:
Data received from the 1-Wire bus.

Reimplemented from OneWireMaster.

Definition at line 151 of file DS2482_DS2484.cpp.

Result< uint_least8_t > readRegister ( uint_least8_t  reg ) const [protected]

Reads a register from the device.

Parameters:
regRegister to read from.
Returns:
Read data from register.

Definition at line 203 of file DS2482_DS2484.cpp.

Result< uint_least8_t > readRegister (  ) const [protected]

Reads the current register from the device.

Returns:
Read data from register.

Definition at line 208 of file DS2482_DS2484.cpp.

Result< void > reset (  ) [virtual]

Reset all of the devices on the 1-Wire bus and check for a presence pulse.

Returns:
NoSlaveError if reset was performed but no presence pulse was detected.

Implements OneWireMaster.

Definition at line 99 of file DS2482_DS2484.cpp.

Result< void > sendCommand ( uint_least8_t  cmd,
uint_least8_t  param 
) const [protected]
Note:
Allow marking const since not public.

Definition at line 245 of file DS2482_DS2484.cpp.

Result< void > sendCommand ( uint_least8_t  cmd ) const [protected]
Note:
Allow marking const since not public.

Definition at line 241 of file DS2482_DS2484.cpp.

Result< void > setLevel ( Level  newLevel ) [virtual]

Set the 1-Wire bus level.

Implements OneWireMaster.

Definition at line 180 of file DS2482_DS2484.cpp.

Result< void > setSpeed ( Speed  newSpeed ) [virtual]

Set the 1-Wire bus communication speed.

Implements OneWireMaster.

Definition at line 167 of file DS2482_DS2484.cpp.

Result< bool > touchBitSetLevel ( bool  sendBit,
Level  afterLevel 
) [virtual]

Send and receive one bit of communication and set a new level on the 1-Wire bus.

Parameters:
sendBitBit to send on the 1-Wire bus.
afterLevelLevel to set the 1-Wire bus to after communication.
Returns:
Bit received from the 1-Wire bus.

Implements OneWireMaster.

Definition at line 121 of file DS2482_DS2484.cpp.

Result< OneWireMaster::TripletData > triplet ( bool  sendBit ) [virtual]

1-Wire Triplet operation.

Perform one bit of a 1-Wire search. This command does two read bits and one write bit. The write bit is either the default direction (all devices have same bit) or in case of a discrepancy, the data.writeBit parameter is used.

Parameters:
sendBitBit to send in case both read bits are zero.

Reimplemented from OneWireMaster.

Definition at line 79 of file DS2482_DS2484.cpp.

Result<void> writeBitSetLevel ( bool  sendBit,
Level  afterLevel 
) [inherited]

Send one bit of communication and set a new level on the 1-Wire bus.

Parameters:
sendBitBit to send on the 1-Wire bus.
afterLevelLevel to set the 1-Wire bus to after communication.

Definition at line 126 of file OneWireMaster.hpp.

Result< void > writeBlock ( span< const uint_least8_t >  sendBuf ) [virtual, inherited]

Send a block of communication on the 1-Wire bus.

Parameters:
[in]sendBufBuffer to send on the 1-Wire bus.

Reimplemented in DS2465.

Definition at line 65 of file OneWireMaster.cpp.

Result< void > writeByteSetLevel ( uint_least8_t  sendByte,
Level  afterLevel 
) [virtual]

Send one byte of communication and set a new level on the 1-Wire bus.

Parameters:
sendByteByte to send on the 1-Wire bus.
afterLevelLevel to set the 1-Wire bus to after communication.

Reimplemented from OneWireMaster.

Definition at line 136 of file DS2482_DS2484.cpp.

Result< void > writeConfig ( Config  config )

Write a new configuration to the device.

Parameters:
[in]configNew configuration to write.

Definition at line 188 of file DS2482_DS2484.cpp.