OneWire Library for Arduino  version: 1.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
OneWire::OneWireMaster Class Referenceabstract

Base class for all 1-Wire Masters. More...

#include <OneWireMaster.h>

Inheritance diagram for OneWire::OneWireMaster:
OneWire::DS248x OneWire::DS2484

Public Types

enum  OWSpeed { StandardSpeed = 0x00, OverdriveSpeed = 0x01 }
 Speed of the 1-Wire bus. More...
 
enum  OWLevel { NormalLevel = 0x00, StrongLevel = 0x02 }
 Level of the 1-Wire bus. More...
 
enum  SearchDirection { WriteZero = 0, WriteOne = 1 }
 Search direction for the triplet operation. More...
 
enum  CmdResult {
  Success, CommunicationWriteError, CommunicationReadError, TimeoutError,
  OperationFailure
}
 Result of all 1-Wire commands. More...
 

Public Member Functions

virtual ~OneWireMaster ()
 Allow freeing through a base class pointer. More...
 
virtual CmdResult OWInitMaster ()=0
 Initialize a master for use. More...
 
virtual CmdResult OWReset ()=0
 
virtual CmdResult OWTouchBitSetLevel (uint8_t &sendRecvBit, OWLevel afterLevel)=0
 
virtual CmdResult OWWriteByteSetLevel (uint8_t sendByte, OWLevel afterLevel)=0
 
virtual CmdResult OWReadByteSetLevel (uint8_t &recvByte, OWLevel afterLevel)=0
 
virtual CmdResult OWWriteBlock (const uint8_t *sendBuf, uint8_t sendLen)
 
virtual CmdResult OWReadBlock (uint8_t *recvBuf, uint8_t recvLen)
 
virtual CmdResult OWSetSpeed (OWSpeed newSpeed)=0
 Set the 1-Wire bus communication speed. More...
 
virtual CmdResult OWSetLevel (OWLevel newLevel)=0
 Set the 1-Wire bus level. More...
 
virtual CmdResult OWTriplet (SearchDirection &searchDirection, uint8_t &sbr, uint8_t &tsb)
 1-Wire Triplet operation. More...
 
CmdResult OWWriteBitSetLevel (uint8_t sendBit, OWLevel afterLevel)
 
CmdResult OWReadBitSetLevel (uint8_t &recvBit, OWLevel afterLevel)
 
CmdResult OWWriteBit (uint8_t sendBit)
 
CmdResult OWReadBit (uint8_t &recvBit)
 
CmdResult OWWriteBitPower (uint8_t sendBit)
 
CmdResult OWReadBitPower (uint8_t &recvBit)
 
CmdResult OWWriteByte (uint8_t sendByte)
 
CmdResult OWReadByte (uint8_t &recvByte)
 
CmdResult OWWriteBytePower (uint8_t sendByte)
 
CmdResult OWReadBytePower (uint8_t &recvByte)
 

Detailed Description

Base class for all 1-Wire Masters.

Member Enumeration Documentation

Result of all 1-Wire commands.

Enumerator
Success 
CommunicationWriteError 
CommunicationReadError 
TimeoutError 
OperationFailure 

Level of the 1-Wire bus.

Enumerator
NormalLevel 
StrongLevel 

Speed of the 1-Wire bus.

Enumerator
StandardSpeed 
OverdriveSpeed 

Search direction for the triplet operation.

Enumerator
WriteZero 
WriteOne 

Constructor & Destructor Documentation

virtual OneWire::OneWireMaster::~OneWireMaster ( )
inlinevirtual

Allow freeing through a base class pointer.

Member Function Documentation

virtual CmdResult OneWire::OneWireMaster::OWInitMaster ( )
pure virtual

Initialize a master for use.

Implemented in OneWire::DS248x.

CmdResult OneWire::OneWireMaster::OWReadBit ( uint8_t &  recvBit)
inline
CmdResult OneWire::OneWireMaster::OWReadBitPower ( uint8_t &  recvBit)
inline
CmdResult OneWire::OneWireMaster::OWReadBitSetLevel ( uint8_t &  recvBit,
OWLevel  afterLevel 
)
inline

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

Parameters
[out]sendRecvBitRead data from 1-Wire bus will be returned in lsb.
afterLevelLevel to set the 1-Wire bus to after communication.
OneWireMaster::CmdResult OneWire::OneWireMaster::OWReadBlock ( uint8_t *  recvBuf,
uint8_t  recvLen 
)
virtual

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

Parameters
[out]recvBufBuffer to receive the data from the 1-Wire bus.
recvLenLength of the buffer to receive.
CmdResult OneWire::OneWireMaster::OWReadByte ( uint8_t &  recvByte)
inline
CmdResult OneWire::OneWireMaster::OWReadBytePower ( uint8_t &  recvByte)
inline
virtual CmdResult OneWire::OneWireMaster::OWReadByteSetLevel ( uint8_t &  recvByte,
OWLevel  afterLevel 
)
pure 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.

Implemented in OneWire::DS248x.

virtual CmdResult OneWire::OneWireMaster::OWReset ( )
pure virtual

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

Returns
OperationFailure if reset was performed but no presence pulse was detected.

Implemented in OneWire::DS248x.

virtual CmdResult OneWire::OneWireMaster::OWSetLevel ( OWLevel  newLevel)
pure virtual

Set the 1-Wire bus level.

Implemented in OneWire::DS248x.

virtual CmdResult OneWire::OneWireMaster::OWSetSpeed ( OWSpeed  newSpeed)
pure virtual

Set the 1-Wire bus communication speed.

Implemented in OneWire::DS248x.

virtual CmdResult OneWire::OneWireMaster::OWTouchBitSetLevel ( uint8_t &  sendRecvBit,
OWLevel  afterLevel 
)
pure virtual

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

Parameters
[in,out]sendRecvBitBuffer containing the bit to send on 1-Wire bus in lsb. Read data from 1-Wire bus will be returned in lsb.
afterLevelLevel to set the 1-Wire bus to after communication.

Implemented in OneWire::DS248x.

OneWireMaster::CmdResult OneWire::OneWireMaster::OWTriplet ( SearchDirection searchDirection,
uint8_t &  sbr,
uint8_t &  tsb 
)
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 device have same bit) or in case of a discrepancy, the 'searchDirection' parameter is used.

Parameters
[in,out]searchDirectionInput with desired direction in case both read bits are zero. Output with direction taken based on read bits.
[out]sbrBit result of first read operation.
[out]tsbBit result of second read operation.

Reimplemented in OneWire::DS248x.

CmdResult OneWire::OneWireMaster::OWWriteBit ( uint8_t  sendBit)
inline
CmdResult OneWire::OneWireMaster::OWWriteBitPower ( uint8_t  sendBit)
inline
CmdResult OneWire::OneWireMaster::OWWriteBitSetLevel ( uint8_t  sendBit,
OWLevel  afterLevel 
)
inline

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

Parameters
sendBitBuffer containing the bit to send on 1-Wire bus in lsb.
afterLevelLevel to set the 1-Wire bus to after communication.
OneWireMaster::CmdResult OneWire::OneWireMaster::OWWriteBlock ( const uint8_t *  sendBuf,
uint8_t  sendLen 
)
virtual

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

Parameters
[in]sendBufBuffer to send on the 1-Wire bus.
sendLenLength of the buffer to send.
CmdResult OneWire::OneWireMaster::OWWriteByte ( uint8_t  sendByte)
inline
CmdResult OneWire::OneWireMaster::OWWriteBytePower ( uint8_t  sendByte)
inline
virtual CmdResult OneWire::OneWireMaster::OWWriteByteSetLevel ( uint8_t  sendByte,
OWLevel  afterLevel 
)
pure 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.

Implemented in OneWire::DS248x.


The documentation for this class was generated from the following files: