#include <LOW_link.h>
Inheritance diagram for LOW_link:
Public Types | |
typedef std::vector< LOW_link * > | linkPtrVec_t |
Vector type of link class pointers. | |
typedef LOW_objectIDFactory::objectID_t | linkID_t |
Type for individual link ID number. | |
enum | strongPullup_t { pullUp_16_4 = 0x00, pullUp_65_5, pullUp_131, pullUp_262, pullUp_524, pullUp_1048, pullUp_NONE = 0xff } |
Type for strong pullup period specification. More... | |
enum | progPulse_t { progPulse_32 = 0x00, progPulse_64, progPulse_128, progPulse_256, progPulse_512, progPulse_1024, progPulse_2048 } |
Type for 12V program pulse period specification. More... | |
Public Member Functions | |
class_DERIVE_FROM_EXCEPTION (link_error, LOW_exception) | |
Exception base class for all exceptions thrown by LOW_link. | |
class_DERIVE_FROM_EXCEPTION (comm_error, link_error) | |
Exception class to be thrown on communication errors. | |
class_DERIVE_FROM_EXCEPTION (internal_error, link_error) | |
Exception class to be thrown on pure internal errors. | |
class_DERIVE_FROM_EXCEPTION (illegalSpeed_error, link_error) | |
Exception class to be thrown on errors related to currently selected wire speed. | |
class_DERIVE_FROM_EXCEPTION (illegalLevel_error, link_error) | |
Exception class to be thrown on errors related to requested voltage level. | |
class_DERIVE_FROM_EXCEPTION (notAllowed_error, link_error) | |
Exception class to be thrown on access violation errors. | |
class_DERIVE_FROM_EXCEPTION (sizeMismatch_error, link_error) | |
virtual | ~LOW_link () |
Destructor. | |
virtual bool | operator== (LOW_link &inLink) const |
Comparison based on linkID. | |
Bus touch (write/read) methods | |
virtual bool | touchBit (const bool inSendBit, const strongPullup_t inPullup=pullUp_NONE)=0 |
Send 1 bit of communication to the 1-Wire net and return the result 1 bit read from the 1-Wire net. | |
virtual uint8_t | touchByte (const uint8_t inSendByte, const strongPullup_t inPullup=pullUp_NONE)=0 |
Send 8 bits of communication to the 1-Wire net and return the result 8 bits read from the 1-Wire net. | |
virtual byteVec_t | touchBlock (const byteVec_t &inBytes, const strongPullup_t inPullup=pullUp_NONE) |
Send block of communication to the 1-Wire net and return the resulting bytes read from the 1-Wire net. | |
Bus read methods | |
virtual bool | readDataBit (const strongPullup_t inPullup=pullUp_NONE) |
Receive 1 bit from the 1-Wire net by previously sending one bit of read communication to the 1-Wire net. | |
virtual uint8_t | readDataByte (const strongPullup_t inPullup=pullUp_NONE) |
Receive 1 byte from the 1-Wire net by previously sending 8 bits of read communication to the 1-Wire net. | |
virtual void | readData (byteVec_t &outBytes, const strongPullup_t inPullup=pullUp_NONE) |
Receive a block of bytes from the 1-Wire net by previously sending a block of bytes of read communication to the 1-Wire Net. | |
Bus write methods | |
virtual void | writeData (const bool inSendBit, const strongPullup_t inPullup=pullUp_NONE) |
Send 1 bit to the 1-Wire net and verify that the bit read from the 1-Wire net is the same (bus write operation). | |
virtual void | writeData (const uint8_t inSendByte, const strongPullup_t inPullup=pullUp_NONE) |
Send 1 byte to the 1-Wire net and verify that the byte read from the 1-Wire net is the same (bus write operation). | |
virtual void | writeData (const byteVec_t &inSendBytes, const strongPullup_t inPullup=pullUp_NONE) |
Send block of bytes to the 1-Wire net and verify that the bytes block read from the 1-Wire net are the same (bus write operation). | |
Higher level actions | |
virtual LOW_deviceID::deviceIDVec_t | searchDevices (const bool inOnlyAlarm, const LOW_deviceIDRaw inPreload, const LOW_deviceIDRaw::devFamCode_t inFamCode, const bool inDoReset) |
Execute a complete search sequence from preloaded ID vector. | |
Misc methods | |
linkID_t | getID () const |
Get ID of the link. | |
virtual std::string | getLinkFamily () const=0 |
Get the link's family type. | |
bool | getHasProgramPulse () const |
Get wether the adapter is capable of 12V Program pulse. | |
bool | getHasExternalPower () const |
Get whether there is an external power line on the segment. | |
bool | getAllowProgPulse () const |
Get wether the program pulse should be allowed. | |
virtual void | resetLinkAdapter ()=0 |
Reset the adapter. | |
virtual bool | resetBus ()=0 |
Reset all of the devices on the 1-Wire net. | |
virtual void | strongPullup (const unsigned long inMicroSecs)=0 |
Set the 1-Wire net line level to strong pullup for a specified time. | |
virtual void | strongPullup (const strongPullup_t inPullupTime)=0 |
Set the 1-Wire net line level to strong pullup for a specified time. | |
virtual void | programPulse (const unsigned long inMicroSecs)=0 |
Create a 12 volt pulse on the 1-Wire net for programming EPROM devices. | |
virtual void | programPulse (const progPulse_t inPulseTime)=0 |
Create a 12 volt pulse on the 1-Wire net for programming EPROM devices. | |
Protected Member Functions | |
LOW_link (const bool inHasProgramPulse, const bool inHasExternalPower, const bool inAllowProgPulse=false) | |
Constructor. | |
virtual void | doSearchSequence (const LOW_deviceIDRaw &inBranchVector, LOW_deviceIDRaw &outFoundID, LOW_deviceIDRaw &outDiscrVec) |
Execute a single search sequence on the bus. | |
Protected Attributes | |
const linkID_t | linkID |
Individual ID of the link adapter. | |
bool | hasProgramPulse |
Wether the adapter is capable of 12V Program pulse. | |
const bool | hasExternalPower |
Wether the attached bus supplies external power. | |
const bool | allowProgPulse |
Wether the program pulse should be allowed. | |
Private Attributes | |
LOW_thread_mutex * | __linkRecMutex |
Mutex for exclusive access. | |
Friends | |
class | commLock |
Needed to access the mutex. |
Any link class representing a concrete 1-Wire link adapter must inherit from this class.
The class provides some generic implementations relying only on touch*() methods. Although beeing sufficient for basic functionality, deriving classes are invited to overload those methods, especially in case the hardware provides a native implementation. Prominent examples for that:
This class is thread-safe.
Provide strongPullup method with specialized type
Parts of the documentation by Dallas Semiconductors / Maxim Integrated Products
Definition at line 53 of file LOW_link.h.
|
Type for individual link ID number.
Definition at line 126 of file LOW_link.h. |
|
Vector type of link class pointers.
Definition at line 124 of file LOW_link.h. |
|
Type for 12V program pulse period specification. Period may vary a little, depending on actual device.
Definition at line 141 of file LOW_link.h. |
|
Type for strong pullup period specification. Period may vary a little, depending on actual device.
Definition at line 130 of file LOW_link.h. |
|
Destructor.
Definition at line 38 of file LOW_link.cpp. References __linkRecMutex. |
|
Constructor.
Definition at line 28 of file LOW_link.cpp. References __linkRecMutex, LOW_thread_mutex::mutexKind_recursive, and LOW_thread_Factory::new_mutex(). |
|
|
|
Exception class to be thrown on access violation errors.
|
|
Exception class to be thrown on errors related to requested voltage level.
|
|
Exception class to be thrown on errors related to currently selected wire speed.
|
|
Exception class to be thrown on pure internal errors.
|
|
Exception class to be thrown on communication errors.
|
|
Exception base class for all exceptions thrown by LOW_link.
|
|
Execute a single search sequence on the bus. A default implementation relying on bit i/o methods is provided.
Reimplemented in LOW_linkDS2480B, and LOW_linkDS2490. Definition at line 267 of file LOW_link.cpp. References LOW_deviceIDRaw::getBit(), readDataBit(), LOW_deviceIDRaw::setBit(), and writeData(). Referenced by searchDevices(). |
|
Get wether the program pulse should be allowed.
Definition at line 80 of file LOW_link.cpp. References allowProgPulse. |
|
Get whether there is an external power line on the segment.
Definition at line 74 of file LOW_link.cpp. References hasExternalPower. Referenced by LOW_netSegment::LOW_netSegment(). |
|
Get wether the adapter is capable of 12V Program pulse.
Definition at line 68 of file LOW_link.cpp. References hasProgramPulse. |
|
Get ID of the link.
Definition at line 62 of file LOW_link.cpp. References linkID. |
|
Get the link's family type. Note: Subclasses must implement this method to return a clear text name of their kind.
Implemented in LOW_linkDS2480B, LOW_linkDS2490, and LOW_linkPassiveSerial. |
|
Comparison based on linkID.
Definition at line 50 of file LOW_link.cpp. References linkID. |
|
Create a 12 volt pulse on the 1-Wire net for programming EPROM devices. For EPROM programming, only a single slave device should be connected to the 1-Wire bus and the cable must be short, not to exceed a few meters. Note: One should not attempt generating a programming pulse with a non-EPROM device on the bus; this may damage the device as well as the link controller. Note: Dependening on the implementation, time may only as accurate as the operating system permits (scheduling!).
Implemented in LOW_linkDS2480B, LOW_linkDS2490, and LOW_linkPassiveSerial. |
|
Create a 12 volt pulse on the 1-Wire net for programming EPROM devices. For EPROM programming, only a single slave device should be connected to the 1-Wire bus and the cable must be short, not to exceed a few meters. Note: One should not attempt generating a programming pulse with a non-EPROM device on the bus; this may damage the device as well as the link controller. Note: Dependening on the implementation, time may only as accurate as the operating system permits (scheduling!).
Implemented in LOW_linkDS2480B, LOW_linkDS2490, and LOW_linkPassiveSerial. |
|
Receive a block of bytes from the 1-Wire net by previously sending a block of bytes of read communication to the 1-Wire Net. Note: When the strong pullup is selected it will NOT appear after each byte sent, only after the last byte the pullup is done! A default implementation relying on the touch methods is provided.
Definition at line 130 of file LOW_link.cpp. References byteVec_t, and touchBlock(). Referenced by LOW_devDS2890::cmd_ReadControlRegister(), LOW_devDS2890::cmd_ReadPosition(), LOW_netSegment::cmd_ReadROM(), LOW_devDS1820::cmd_ReadScratchpad(), LOW_devDS2406::cmd_ChannelAccess::readData(), and LOW_devDS2406::readMemUniversal(). |
|
Receive 1 bit from the 1-Wire net by previously sending one bit of read communication to the 1-Wire net. A default implementation relying on the touch methods is provided.
Definition at line 114 of file LOW_link.cpp. References touchBit(). Referenced by LOW_devDS1820::cmd_ConvertT(), LOW_devDS2405::cmd_MatchRead(), LOW_devDS1820::cmd_ReadPowerSupply(), LOW_devDS1820::cmd_RecallE2(), LOW_devDS2405::cmd_SearchRead(), LOW_devDS2890::cmd_WriteControlRegister(), LOW_devDS2890::cmd_WritePosition(), doSearchSequence(), and LOW_devDS2406::cmd_ChannelAccess::readDataBit(). |
|
Receive 1 byte from the 1-Wire net by previously sending 8 bits of read communication to the 1-Wire net. A default implementation relying on the touch methods is provided.
Definition at line 122 of file LOW_link.cpp. References touchByte(). Referenced by LOW_devDS2406::cmd_ChannelAccess::cmd_ChannelAccess(), LOW_devDS2890::cmd_Decrement(), LOW_devDS2890::cmd_Increment(), LOW_devDS2890::cmd_WriteControlRegister(), LOW_devDS2890::cmd_WritePosition(), LOW_devDS2406::cmd_WriteStatus(), LOW_devDS2406::cmd_ChannelAccess::readDataByte(), and LOW_devDS2406::readMemUniversal(). |
|
Reset all of the devices on the 1-Wire net.
Implemented in LOW_linkDS2480B, LOW_linkDS2490, and LOW_linkPassiveSerial. Referenced by LOW_devDS2890::cmd_Decrement(), LOW_devDS2890::cmd_Increment(), LOW_netSegment::cmd_MatchROM(), LOW_netSegment::cmd_ReadROM(), LOW_netSegment::cmd_SkipROM(), LOW_devDS2890::cmd_WriteControlRegister(), LOW_devDS2890::cmd_WritePosition(), LOW_devDS2406::cmd_WriteStatus(), LOW_devDS2406::readMemUniversal(), searchDevices(), and LOW_devDS2406::cmd_ChannelAccess::~cmd_ChannelAccess(). |
|
Reset the adapter. Note: This does not necessarily include a reset on the 1-Wire net. Whether this is done or net is left to the concrete implementation. Implemented in LOW_linkDS2480B, LOW_linkDS2490, and LOW_linkPassiveSerial. |
|
Execute a complete search sequence from preloaded ID vector. Search is executed on the currently active bus configuration. No branch selection is done in advance. A default implementation relying on the doSearchSequence() method is provided.
Reimplemented in LOW_linkDS2490. Definition at line 185 of file LOW_link.cpp. References LOW_device::anyDev_famCode, LOW_deviceID::deviceIDVec_t, doSearchSequence(), LOW_deviceIDRaw::getBit(), LOW_deviceIDRaw::getFamilyCode(), resetBus(), LOW_device::SearchAlarmROM_COMMAND, LOW_device::SearchROM_COMMAND, LOW_deviceIDRaw::setBit(), LOW_deviceIDRaw::setFamilyCode(), and writeData(). Referenced by LOW_netSegment::cmd_SearchROM(), and LOW_netSegment::cmd_SearchROMVerify(). |
|
Set the 1-Wire net line level to strong pullup for a specified time. Note: Dependening on the implementation, time may only as accurate as the operating system permits (scheduling!).
Implemented in LOW_linkDS2480B, LOW_linkDS2490, and LOW_linkPassiveSerial. |
|
Set the 1-Wire net line level to strong pullup for a specified time. Note: Dependening on the implementation, time may only as accurate as the operating system permits (scheduling!).
Implemented in LOW_linkDS2480B, LOW_linkDS2490, and LOW_linkPassiveSerial. |
|
Send 1 bit of communication to the 1-Wire net and return the result 1 bit read from the 1-Wire net.
Implemented in LOW_linkDS2480B, LOW_linkDS2490, and LOW_linkPassiveSerial. Referenced by readDataBit(), and writeData(). |
|
Send block of communication to the 1-Wire net and return the resulting bytes read from the 1-Wire net. A default implementation relying on the touchByte() method is provided. Note: When the strong pullup is selected it will NOT appear after each byte sent, only after the last byte the pullup is done!
Reimplemented in LOW_linkDS2480B, and LOW_linkDS2490. Definition at line 92 of file LOW_link.cpp. References byteVec_t, pullUp_NONE, and touchByte(). Referenced by readData(), and writeData(). |
|
Send 8 bits of communication to the 1-Wire net and return the result 8 bits read from the 1-Wire net.
Implemented in LOW_linkDS2480B, LOW_linkDS2490, and LOW_linkPassiveSerial. Referenced by readDataByte(), touchBlock(), and writeData(). |
|
Send block of bytes to the 1-Wire net and verify that the bytes block read from the 1-Wire net are the same (bus write operation). A default implementation relying on the touch methods is provided. Note: When the strong pullup is selected it will NOT appear after each byte sent, only after the last byte the pullup is done!
Definition at line 166 of file LOW_link.cpp. References byteVec_t, and touchBlock(). |
|
Send 1 byte to the 1-Wire net and verify that the byte read from the 1-Wire net is the same (bus write operation). A default implementation relying on the touch methods is provided.
Definition at line 157 of file LOW_link.cpp. References touchByte(). |
|
|
Needed to access the mutex.
Definition at line 502 of file LOW_link.h. |
|
Mutex for exclusive access.
Definition at line 510 of file LOW_link.h. Referenced by LOW_link::commLock::commLock(), LOW_link(), LOW_link::commLock::~commLock(), and ~LOW_link(). |
|
Wether the program pulse should be allowed.
Definition at line 460 of file LOW_link.h. Referenced by getAllowProgPulse(), LOW_linkPassiveSerial::programPulse(), LOW_linkDS2490::programPulse(), LOW_linkDS2480B::programPulse(), and LOW_linkDS2490::resetLinkAdapter(). |
|
Wether the attached bus supplies external power.
Definition at line 459 of file LOW_link.h. Referenced by getHasExternalPower(). |
|
Wether the adapter is capable of 12V Program pulse.
Definition at line 458 of file LOW_link.h. Referenced by getHasProgramPulse(), LOW_linkPassiveSerial::programPulse(), LOW_linkDS2490::programPulse(), LOW_linkDS2480B::programPulse(), LOW_linkDS2480B::resetBus(), and LOW_linkDS2490::resetLinkAdapter(). |
|
Individual ID of the link adapter.
Definition at line 457 of file LOW_link.h. Referenced by getID(), and operator==(). |