Device interface library for multiple platforms including Mbed.

Dependents:   DeepCover Embedded Security in IoT MaximInterface MAXREFDES155#

Embed: (wiki syntax)

« Back to documentation index

OneWireMaster Class Reference

OneWireMaster Class Reference

1-Wire master interface. More...

#include <OneWireMaster.hpp>

Inherited by OneWireMasterDecorator, DS2465, DS2480B, and DS2482_DS2484.

Data Structures

struct  TripletData
 Result of the 1-Wire triplet command. More...

Public Types

enum  Speed
 

Speed of the 1-Wire bus.

More...
enum  Level
 

Level of the 1-Wire bus.

More...
enum  ErrorValue { NoSlaveError = 1 }
 

Result of all 1-Wire commands.

More...

Public Member Functions

virtual Result< void > reset ()=0
 Reset all of the devices on the 1-Wire bus and check for a presence pulse.
virtual Result< bool > touchBitSetLevel (bool sendBit, Level afterLevel)=0
 Send and receive one bit of communication and set a new level on the 1-Wire bus.
virtual
MaximInterfaceCore_EXPORT
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
MaximInterfaceCore_EXPORT
Result< uint_least8_t > 
readByteSetLevel (Level afterLevel)
 Receive one byte of communication and set a new level on the 1-Wire bus.
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.
virtual Result< void > setSpeed (Speed newSpeed)=0
 Set the 1-Wire bus communication speed.
virtual Result< void > setLevel (Level newLevel)=0
 Set the 1-Wire bus level.
virtual
MaximInterfaceCore_EXPORT
Result< TripletData
triplet (bool sendBit)
 1-Wire Triplet operation.
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.

Detailed Description

1-Wire master interface.

Definition at line 45 of file OneWireMaster.hpp.


Member Enumeration Documentation

enum ErrorValue

Result of all 1-Wire commands.

Enumerator:
NoSlaveError 

Slave not detected, typically due to no presence pulse.

Reimplemented in DS2465, DS2480B, and DS2482_DS2484.

Definition at line 54 of file OneWireMaster.hpp.

enum Level

Level of the 1-Wire bus.

Definition at line 51 of file OneWireMaster.hpp.

enum Speed

Speed of the 1-Wire bus.

Definition at line 48 of file OneWireMaster.hpp.


Member Function Documentation

Result<bool> readBitSetLevel ( Level  afterLevel )

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]

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 in DS2465, DS2480B, and DS2482_DS2484.

Definition at line 52 of file OneWireMaster.cpp.

virtual Result<void> reset (  ) [pure 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.

Implemented in DS2465, DS2480B, and DS2482_DS2484.

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

Set the 1-Wire bus level.

Implemented in DS2465, DS2480B, and DS2482_DS2484.

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

Set the 1-Wire bus communication speed.

Implemented in DS2465, DS2480B, and DS2482_DS2484.

virtual Result<bool> touchBitSetLevel ( bool  sendBit,
Level  afterLevel 
) [pure 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.

Implemented in DS2465, DS2480B, and DS2482_DS2484.

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 in DS2465, and DS2482_DS2484.

Definition at line 79 of file OneWireMaster.cpp.

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

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]

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 in DS2465, DS2480B, and DS2482_DS2484.

Definition at line 43 of file OneWireMaster.cpp.