Aleksandrs Gumenuks / MaximInterface_Extended

Dependents:   mbed_DS28EC20_GPIO

Embed: (wiki syntax)

« Back to documentation index

DS2465 Class Reference

Interface to the DS2465 1-Wire master and SHA-256 coprocessor. More...

#include <DS2465.hpp>

Inherits MaximInterface::OneWireMaster.

Data Structures

class  Config
 Represents a DS2465 configuration. More...

Public Types

enum  ErrorValue
 

Result of all 1-Wire commands.

More...
enum  PortParameter
 

1-Wire port adjustment parameters.

More...
enum  PageRegion
 

Page region to use for swapping.

More...
typedef array_span
< uint_least8_t, 4 > 
Segment
 Holds the contents of a device memory segment.
typedef array_span
< uint_least8_t, 32 > 
Page
 Holds the contents of a device memory page.
enum  Speed
 

Speed of the 1-Wire bus.

More...
enum  Level
 

Level of the 1-Wire bus.

More...

Public Member Functions

MaximInterface_EXPORT error_code initialize (Config config=Config())
 Initialize hardware for use.
MaximInterface_EXPORT error_code writeConfig (Config config)
 Write a new configuration to the DS2465.
MaximInterface_EXPORT error_code writePortParameter (PortParameter param, int val)
 Write a new port configuration parameter to the DS2465.
virtual MaximInterface_EXPORT
error_code 
reset ()
 Reset all of the devices on the 1-Wire bus and check for a presence pulse.
virtual MaximInterface_EXPORT
error_code 
touchBitSetLevel (bool &sendRecvBit, Level afterLevel)
 Send and receive one bit of communication and set a new level on the 1-Wire bus.
virtual MaximInterface_EXPORT
error_code 
readByteSetLevel (uint_least8_t &recvByte, Level afterLevel)
 Receive one byte of communication and set a new level on the 1-Wire bus.
virtual MaximInterface_EXPORT
error_code 
writeByteSetLevel (uint_least8_t sendByte, Level afterLevel)
 Send one byte of communication and set a new level on the 1-Wire bus.
virtual MaximInterface_EXPORT
error_code 
readBlock (span< uint_least8_t > recvBuf)
 Receive a block of communication on the 1-Wire bus.
virtual MaximInterface_EXPORT
error_code 
writeBlock (span< const uint_least8_t > sendBuf)
 Send a block of communication on the 1-Wire bus.
virtual MaximInterface_EXPORT
error_code 
setSpeed (Speed newSpeed)
 Set the 1-Wire bus communication speed.
virtual MaximInterface_EXPORT
error_code 
setLevel (Level newLevel)
virtual MaximInterface_EXPORT
error_code 
triplet (TripletData &data)
 1-Wire Triplet operation.
MaximInterface_EXPORT error_code readPage (int pageNum, Page::span data) const
 Read data from an EEPROM memory page.
MaximInterface_EXPORT error_code writePage (int pageNum, Page::const_span data)
 Write data to an EEPROM memory page.
MaximInterface_EXPORT error_code writeSegment (int pageNum, int segmentNum, Segment::const_span data)
 Write data to an EEPROM memory segment.
MaximInterface_EXPORT error_code writeMasterSecret (Sha256::Hash::const_span masterSecret)
 Write data to the secret EEPROM memory page.
MaximInterface_EXPORT error_code computeNextMasterSecret (Sha256::AuthenticationData::const_span data)
 Compute Next Master Secret.
MaximInterface_EXPORT error_code computeNextMasterSecretWithSwap (Sha256::AuthenticationData::const_span data, int pageNum, PageRegion region)
 Compute Next Master Secret with page swapping.
MaximInterface_EXPORT error_code computeWriteMac (Sha256::WriteMacData::const_span data, Sha256::Hash::span mac) const
 Compute Write MAC.
MaximInterface_EXPORT error_code computeAndTransmitWriteMac (Sha256::WriteMacData::const_span data) const
 Compute Write MAC.
MaximInterface_EXPORT error_code computeWriteMacWithSwap (Sha256::WriteMacData::const_span data, int pageNum, int segmentNum, Sha256::Hash::span mac) const
 Compute Write MAC with page swapping.
MaximInterface_EXPORT error_code computeAndTransmitWriteMacWithSwap (Sha256::WriteMacData::const_span data, int pageNum, int segmentNum) const
 Compute Write MAC with page swapping.
MaximInterface_EXPORT error_code computeSlaveSecret (Sha256::AuthenticationData::const_span data)
 Compute Slave Secret (S-Secret).
MaximInterface_EXPORT error_code computeSlaveSecretWithSwap (Sha256::AuthenticationData::const_span data, int pageNum, PageRegion region)
 Compute Slave Secret (S-Secret) with page swapping.
MaximInterface_EXPORT error_code computeAuthMac (Sha256::AuthenticationData::const_span data, Sha256::Hash::span mac) const
 Compute Authentication MAC.
MaximInterface_EXPORT error_code computeAndTransmitAuthMac (Sha256::AuthenticationData::const_span data) const
 Compute Authentication MAC.
MaximInterface_EXPORT error_code computeAuthMacWithSwap (Sha256::AuthenticationData::const_span data, int pageNum, PageRegion region, Sha256::Hash::span mac) const
 Compute Authentication MAC with page swapping.
MaximInterface_EXPORT error_code computeAndTransmitAuthMacWithSwap (Sha256::AuthenticationData::const_span data, int pageNum, PageRegion region) const
 Compute Authentication MAC with page swapping.
error_code writeBitSetLevel (bool sendBit, Level afterLevel)
 Send one bit of communication and set a new level on the 1-Wire bus.
error_code readBitSetLevel (bool &recvBit, Level afterLevel)
 Receive one bit of communication and set a new level on the 1-Wire bus.

Detailed Description

Interface to the DS2465 1-Wire master and SHA-256 coprocessor.

Definition at line 46 of file DS2465.hpp.


Member Typedef Documentation

typedef array_span<uint_least8_t, 32> Page

Holds the contents of a device memory page.

Definition at line 71 of file DS2465.hpp.

typedef array_span<uint_least8_t, 4> Segment

Holds the contents of a device memory segment.

Definition at line 68 of file DS2465.hpp.


Member Enumeration Documentation

enum ErrorValue

Result of all 1-Wire commands.

Reimplemented from OneWireMaster.

Definition at line 48 of file DS2465.hpp.

enum Level [inherited]

Level of the 1-Wire bus.

Definition at line 50 of file OneWireMaster.hpp.

enum PageRegion

Page region to use for swapping.

Definition at line 65 of file DS2465.hpp.

1-Wire port adjustment parameters.

Note:
See datasheet page 13.

Definition at line 52 of file DS2465.hpp.

enum Speed [inherited]

Speed of the 1-Wire bus.

Definition at line 47 of file OneWireMaster.hpp.


Member Function Documentation

error_code computeAndTransmitAuthMac ( Sha256::AuthenticationData::const_span  data ) const

Compute Authentication MAC.

Parameters:
dataCombined data fields for computation.

Definition at line 724 of file DS2465.cpp.

error_code computeAndTransmitAuthMacWithSwap ( Sha256::AuthenticationData::const_span  data,
int  pageNum,
PageRegion  region 
) const

Compute Authentication MAC with page swapping.

Parameters:
dataCombined data fields for computation.
pageNumPage number to swap in.
regionRegion of the page to swap in.

Definition at line 752 of file DS2465.cpp.

error_code computeAndTransmitWriteMac ( Sha256::WriteMacData::const_span  data ) const

Compute Write MAC.

Parameters:
dataCombined data fields for computation.

Definition at line 651 of file DS2465.cpp.

error_code computeAndTransmitWriteMacWithSwap ( Sha256::WriteMacData::const_span  data,
int  pageNum,
int  segmentNum 
) const

Compute Write MAC with page swapping.

Parameters:
dataCombined data fields for computation.
pageNumPage number to swap in.
segmentNumSegment number to swap in.

Definition at line 679 of file DS2465.cpp.

error_code computeAuthMac ( Sha256::AuthenticationData::const_span  data,
Sha256::Hash::span  mac 
) const

Compute Authentication MAC.

Parameters:
dataCombined data fields for computation.
[out]macComputed Auth MAC.

Definition at line 714 of file DS2465.cpp.

error_code computeAuthMacWithSwap ( Sha256::AuthenticationData::const_span  data,
int  pageNum,
PageRegion  region,
Sha256::Hash::span  mac 
) const

Compute Authentication MAC with page swapping.

Parameters:
dataCombined data fields for computation.
pageNumPage number to swap in.
regionRegion of the page to swap in.
[out]macComputed Auth MAC.

Definition at line 742 of file DS2465.cpp.

error_code computeNextMasterSecret ( Sha256::AuthenticationData::const_span  data )

Compute Next Master Secret.

Parameters:
dataCombined data fields for computation.

Definition at line 615 of file DS2465.cpp.

error_code computeNextMasterSecretWithSwap ( Sha256::AuthenticationData::const_span  data,
int  pageNum,
PageRegion  region 
)

Compute Next Master Secret with page swapping.

Parameters:
dataCombined data fields for computation.
pageNumPage number to swap in.
regionRegion of the page to swap in.

Definition at line 624 of file DS2465.cpp.

error_code computeSlaveSecret ( Sha256::AuthenticationData::const_span  data )

Compute Slave Secret (S-Secret).

Parameters:
dataCombined data fields for computation.

Definition at line 688 of file DS2465.cpp.

error_code computeSlaveSecretWithSwap ( Sha256::AuthenticationData::const_span  data,
int  pageNum,
PageRegion  region 
)

Compute Slave Secret (S-Secret) with page swapping.

Parameters:
dataCombined data fields for computation.
pageNumPage number to swap in.
regionRegion of the page to swap in.

Definition at line 697 of file DS2465.cpp.

error_code computeWriteMac ( Sha256::WriteMacData::const_span  data,
Sha256::Hash::span  mac 
) const

Compute Write MAC.

Parameters:
dataCombined data fields for computation.
[out]macComputed Write MAC.

Definition at line 641 of file DS2465.cpp.

error_code computeWriteMacWithSwap ( Sha256::WriteMacData::const_span  data,
int  pageNum,
int  segmentNum,
Sha256::Hash::span  mac 
) const

Compute Write MAC with page swapping.

Parameters:
dataCombined data fields for computation.
pageNumPage number to swap in.
segmentNumSegment number to swap in.
[out]macComputed Write MAC.

Definition at line 668 of file DS2465.cpp.

error_code initialize ( Config  config = Config() )

Initialize hardware for use.

Definition at line 69 of file DS2465.cpp.

error_code readBitSetLevel ( bool &  recvBit,
Level  afterLevel 
) [inherited]

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

Parameters:
[out]recvBitReceived data from the 1-Wire bus.
afterLevelLevel to set the 1-Wire bus to after communication.

Definition at line 134 of file OneWireMaster.hpp.

error_code readBlock ( span< uint_least8_t >  recvBuf ) [virtual]

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

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

Reimplemented from OneWireMaster.

Definition at line 257 of file DS2465.cpp.

error_code readByteSetLevel ( uint_least8_t &  recvByte,
Level  afterLevel 
) [virtual]

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

Parameters:
recvByteBuffer to receive the data from the 1-Wire bus.
afterLevelLevel to set the 1-Wire bus to after communication.

Reimplemented from OneWireMaster.

Definition at line 323 of file DS2465.cpp.

error_code readPage ( int  pageNum,
Page::span  data 
) const

Read data from an EEPROM memory page.

Parameters:
pageNumPage number to read from.
[out]dataData that was read.

Definition at line 136 of file DS2465.cpp.

error_code 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 563 of file DS2465.cpp.

error_code setLevel ( Level  newLevel ) [virtual]

Set the 1-Wire bus level.

Note:
The DS2465 only supports enabling strong pullup following a 1-Wire read or write operation.

Implements OneWireMaster.

Definition at line 212 of file DS2465.cpp.

error_code setSpeed ( Speed  newSpeed ) [virtual]

Set the 1-Wire bus communication speed.

Implements OneWireMaster.

Definition at line 220 of file DS2465.cpp.

error_code touchBitSetLevel ( bool &  sendRecvBit,
Level  afterLevel 
) [virtual]

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

Parameters:
[in,out]sendRecvBitInput containing the bit to send and output containing the received bit.
afterLevelLevel to set the 1-Wire bus to after communication.

Implements OneWireMaster.

Definition at line 378 of file DS2465.cpp.

error_code triplet ( TripletData &  data ) [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:
[in,out]dataInput with desired writeBit in case both read bits are zero. Output with all data fields set.

Reimplemented from OneWireMaster.

Definition at line 233 of file DS2465.cpp.

error_code 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.

error_code writeBlock ( span< const uint_least8_t >  sendBuf ) [virtual]

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

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

Reimplemented from OneWireMaster.

Definition at line 282 of file DS2465.cpp.

error_code 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 354 of file DS2465.cpp.

error_code writeConfig ( Config  config )

Write a new configuration to the DS2465.

Parameters:
[in]configNew configuration to write.

Definition at line 475 of file DS2465.cpp.

error_code writeMasterSecret ( Sha256::Hash::const_span  masterSecret )

Write data to the secret EEPROM memory page.

Definition at line 174 of file DS2465.cpp.

error_code writePage ( int  pageNum,
Page::const_span  data 
)

Write data to an EEPROM memory page.

Parameters:
pageNumPage number to copy to.
dataData to write.

Definition at line 151 of file DS2465.cpp.

error_code writePortParameter ( PortParameter  param,
int  val 
)

Write a new port configuration parameter to the DS2465.

Parameters:
[in]paramParameter to adjust.
[in]valNew parameter value to set. Consult datasheet for value mappings.

Definition at line 493 of file DS2465.cpp.

error_code writeSegment ( int  pageNum,
int  segmentNum,
Segment::const_span  data 
)

Write data to an EEPROM memory segment.

Parameters:
pageNumPage number to copy to.
segmentNumSegment number to copy to.
dataData to write.

Definition at line 162 of file DS2465.cpp.