00001 /*************************************************************************** 00002 LOW_linkPassiveSerial.h - description 00003 ------------------- 00004 begin : Sun Jul 7 2002 00005 copyright : (C) 2002 by Harald Roelle 00006 email : roelle@informatik.uni-muenchen.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef LOW_LINKPASSIVESERIAL_H 00019 #define LOW_LINKPASSIVESERIAL_H 00020 00021 00022 #include "LOW_link.h" 00023 #include "LOW_portSerialFactory.h" 00024 00025 00026 00027 /** Link class for simple passive serial 1-Wire adapters. 00028 00029 As the passive adapter is not capable of real strong pullups with high current, 00030 it is emulated by providing high level on the bus for a relatively long time. 00031 00032 This class is thread-safe. 00033 00034 @todo PROVIDE ASSIGNMENT OPERATOR AND COPY CONSTRUCTOR 00035 00036 @author Harald Roelle 00037 */ 00038 class LOW_linkPassiveSerial : public LOW_link { 00039 00040 //======================================================================================= 00041 public: 00042 00043 //===================================================================================== 00044 // 00045 // constructors 00046 // 00047 00048 /** Constructor. 00049 00050 @param inSerPortSpec Specification of serial port the adapter is on. 00051 @param inAllowProgPulse Wether the program pulse should be allowed. 00052 */ 00053 LOW_linkPassiveSerial( const LOW_portSerialFactory::portSpecifier_t &inSerPortSpec, 00054 const bool inAllowProgPulse = false); 00055 00056 /** Destructor. 00057 */ 00058 ~LOW_linkPassiveSerial(); 00059 00060 00061 //===================================================================================== 00062 // 00063 // Standard methods required by LOW_Link 00064 // 00065 00066 virtual std::string getLinkFamily() const { return "Passive serial link"; }; 00067 00068 //! @name Bus touch (write/read) methods required by LOW_Link 00069 //!@{ 00070 virtual bool touchBit( const bool inSendBit, const strongPullup_t inPullup = pullUp_NONE); 00071 virtual uint8_t touchByte( const uint8_t inSendByte, const strongPullup_t inPullup = pullUp_NONE); 00072 //!@} 00073 00074 //! @name Misc methods required by LOW_Link 00075 //!@{ 00076 virtual void resetLinkAdapter(); 00077 virtual bool resetBus(); 00078 virtual void strongPullup( const unsigned long inMicroSecs); 00079 virtual void strongPullup( const strongPullup_t inPullupTime); 00080 virtual void programPulse( const unsigned long inMicroSecs); 00081 virtual void programPulse( const progPulse_t inPulseTime); 00082 //!@} 00083 00084 00085 //======================================================================================= 00086 private: 00087 00088 //===================================================================================== 00089 // 00090 // constants 00091 // 00092 00093 /** Time to wait for emulation of strong pullup in seconds. */ 00094 static const int strongPullupEmuTime = 3; 00095 00096 00097 //===================================================================================== 00098 // 00099 // attributes 00100 // 00101 00102 LOW_portSerial *serialPort; /**< The serial port the adapter is attached to. */ 00103 00104 }; 00105 00106 #endif