Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

LOW_devDS2405.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           LOW_devDS2405.h  -  description
00003                              -------------------
00004     begin                : Tue Aug 20 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_DEVDS2405_H
00019 #define LOW_DEVDS2405_H
00020 
00021 
00022 
00023 #include "LOW_device.h"
00024 #include "LOW_helper_crc.h"
00025 
00026 
00027 
00028 /** Device class for DS2405 Addressable Switch.
00029 
00030     DS2405 features:
00031 
00032     - Open-drain PIO pin is controlled by matching 64-bit, laser-engraved registration number
00033       associated with each device
00034     - Logic level of open drain output can be determined over 1-Wire bus for closed-loop control
00035     - PIO pin sink capability is greater than 4mA at 0.4V
00036     - Multiple DS2405s can be identified on a common 1-Wire bus and be turned on or off independent
00037       of other devices on the bus
00038     - Unique, factory-lasered and tested 64-bit registration number (8-bit family code +48- bit serial
00039       number +8-bit CRC tester) assures absolute identity because no two parts are alike
00040     - Built-in multidrop controller ensures compatibility with other MicroLAN products
00041     - Reduces control, address, data, and power to a single data pin
00042     - Directly connects to a single port pin of a microprocessor and communicates at up to 16.3kbits/s
00043     - 8-bit family code specifies DS2405 communications requirements to reader
00044     - 8-bit cyclic redundancy check ensures errorfree selection
00045     - Zero standby power required
00046     - Low cost TO-92, SOT-223, or 6-pin TSOC surface mount package
00047     - 1-Wire communication operates over a wide voltage range of 2.8V to 6.0V from -40°C to +85°C
00048 
00049     This class is thread-safe.
00050 
00051     @author Harald Roelle
00052     @author  Parts of the documentation by Dallas Semiconductors / Maxim Integrated Products
00053  */
00054 class LOW_devDS2405 : public LOW_device  {
00055 
00056 //=======================================================================================
00057 public: 
00058 
00059   //=====================================================================================
00060   //
00061   // exceptions
00062   //
00063 
00064   /** Exception base class for all exceptions thrown by LOW_devDS2405. */
00065   class_DERIVE_FROM_EXCEPTION( devDS2405_error, LOW_exception);
00066 
00067 
00068   //=====================================================================================
00069   //
00070   // constants
00071   //
00072 
00073   /** Family code of this specific device. */
00074   static const LOW_deviceIDRaw::devFamCode_t  familyCode = 0x05;
00075 
00076   /** Family name of this specific device. */
00077   static const std::string familyName;
00078 
00079 
00080   //=====================================================================================
00081   //
00082   // type definitions
00083   //
00084   
00085   typedef std::vector<LOW_devDS2405*> devDS2405PtrVec_t;    /**< Vector type of class device pointers. */
00086   
00087     
00088   //=====================================================================================
00089   //
00090   // constructors
00091   //
00092   
00093   /** Real constructor corresponding to static pseudo constructor new_Instance().
00094       @param  inSegment  Reference to network segment the device is on.
00095       @param  inDevID    Reference to device's ID.
00096    */
00097   LOW_devDS2405( LOW_netSegment &inSegment, const LOW_deviceID &inDevID);
00098 
00099   /** Destructor.
00100    */
00101   virtual ~LOW_devDS2405();
00102 
00103   
00104   //=====================================================================================
00105   //
00106   // methods
00107   //
00108 
00109   /** Get the device's family code.
00110       <B>Note:</B> Subclasses must implement this method to return their specific family code.
00111       @return Family name of the device.
00112    */
00113   virtual const LOW_deviceIDRaw::devFamCode_t getFamilyCode() const { return familyCode; };
00114 
00115   /** Get the device's family name.
00116       <B>Note:</B> Subclasses must implement this method to return a clear text
00117                    name of their family.
00118       @return Family name of the device.
00119    */
00120   virtual const std::string getFamilyName() const { return familyName; };
00121 
00122   /** Toggle the state of the PIO pin.
00123    */
00124   virtual void cmd_Match() const;
00125  
00126    
00127   /** Toggle the state of the PIO pin and read its new state.
00128       
00129       <B>Note:</B> The return value is <B>inverted</B> compared to @ref cmd_SearchActive().
00130       
00131       @return  false, if the device IS driving the PIO pin low.
00132                true,  if the device is NOT driving the PIO pin low.
00133    */
00134   virtual bool cmd_MatchRead() const;
00135   
00136   
00137   /** Read the logic state of the PIO pin (input).
00138 
00139       The device will not toggle the state of its PIO pin.
00140       The combination of Match ROM and Search ROM allows the user to change the state
00141       of the PIO pin and report the current state (Match ROM) or simply report the 
00142       current state of the PIO pin without changing it (Search ROM).
00143         
00144       @return  false, if the pulldown is on,
00145                       or the pulldown is off and the PIO pin is a logical 0.<BR>
00146                true,  if the pulldown is off and the PIO pin is a logical 1 (i.e. external pullup).
00147   */
00148   virtual bool cmd_SearchRead() const;
00149 
00150     
00151   /** Read if the output pulldown is turned on.
00152       
00153       The device will not toggle the state of its PIO pin.
00154  
00155       <B>Note:</B> The return value is <B>inverted</B> compared to @ref cmd_MatchActive().
00156       
00157       @return  false, if the device is NOT driving the PIO pin low.
00158                true,  if the device IS driving the PIO pin low.
00159  
00160   */
00161   virtual bool cmd_SearchActive() const;
00162 
00163   
00164 
00165 //=======================================================================================
00166 protected:
00167 
00168   //=====================================================================================
00169   //
00170   // static methods
00171   //
00172   
00173   /** Static pseudo constructor for registering with LOW_deviceFactory.
00174       @param  inSegment  Reference to network segment the device is on.
00175       @param  inDevID    Reference to device's ID.
00176       @return  New dynamic instance of specific device class.
00177    */
00178   static LOW_device* new_Instance( LOW_netSegment &inNetSegment, const LOW_deviceID &inDevID);
00179 
00180   
00181   
00182 //=======================================================================================
00183 private:
00184 
00185   //=====================================================================================
00186   //
00187   // static initializer
00188   //
00189   
00190   /** Needed for dirty little C++ hack to force static initialization on application start.
00191       @see initialize()
00192   */
00193   static int initHelper;
00194 
00195   /** Static inizializer to register the class with LOW_deviceFactory.
00196       @see initHelper
00197   */
00198   static int initialize();
00199     
00200 };
00201 
00202 #endif

Generated on Tue Feb 3 11:30:25 2004 for OneWireLibrary++ by doxygen 1.3.2