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

LOW_linkFlexibleSpeed.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           LOW_linkFlexibleSpeed.h  -  description
00003                              -------------------
00004     begin                : Sat Oct 11 2003
00005     copyright            : (C) 2003 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_LINKFLEXIBLESPEED_H
00019 #define LOW_LINKFLEXIBLESPEED_H
00020 
00021 
00022 #include <vector>
00023 
00024 
00025 #include "LOW_exception.h"
00026 
00027 
00028 /** Mix-in class for 1-Wire link adapters capable of flexible speed.
00029 
00030     Any link class representing a concrete 1-Wire link adapter can inherit from this class.
00031 
00032     Values are stored by the methods in this class. For covenience they may called by
00033     overriding methods. See also description of individual methods.
00034 
00035     Note that deriving classes should also override the get*() methods to reflect actual
00036     values of the device.
00037     
00038     <b>Note:</b> This class is intentionally NOT thread-safe. This has to be accomplished
00039     by deriving classes
00040             
00041     @author Harald Roelle
00042  */
00043 class LOW_linkFlexibleSpeed {
00044 
00045 //=======================================================================================
00046 public:
00047 
00048 
00049   //=====================================================================================
00050   //
00051   // exceptions
00052   //
00053 
00054   /** Exception base class for all exceptions thrown by LOW_link. */
00055   class_DERIVE_FROM_EXCEPTION( incompatibleSpeed_error, LOW_exception);
00056 
00057 
00058   
00059   //=====================================================================================
00060   //
00061   // type definitions
00062   //
00063 
00064   typedef std::vector<LOW_linkFlexibleSpeed*> flexLinkPtrVec_t;   /**< Vector type of link class pointers. */
00065 
00066   /** 1-Wire communication speeds. */
00067   typedef enum { normal_speed=0,    /**< Normal 1-Wire speed, 16 kbps. */
00068                  flexible_speed=1,  /**< Flexible 1-Wire speed. */
00069                  overdrive_speed=2  /**< Overdrive 1-Wire speed, 142 kbps. */
00070                } wireSpeed_t;
00071 
00072   //! @name Configuration values.
00073   //!@{
00074     
00075   /** Type for flexible speed pulldown slew rate in V/microsec. */
00076   typedef enum { pdSlewRate_15=0x00,  /**< Pulldown slew rate 15    V/microsec. */
00077                  pdSlewRate_2_2,      /**< Pulldown slew rate  2.2  V/microsec. */
00078                  pdSlewRate_1_65,     /**< Pulldown slew rate  1.65 V/microsec. */
00079                  pdSlewRate_1_37,     /**< Pulldown slew rate  1.37 V/microsec. */
00080                  pdSlewRate_1_1,      /**< Pulldown slew rate  1.1  V/microsec. */
00081                  pdSlewRate_0_83,     /**< Pulldown slew rate  0.83 V/microsec. */
00082                  pdSlewRate_0_7,      /**< Pulldown slew rate  0.7  V/microsec. */
00083                  pdSlewRate_0_55      /**< Pulldown slew rate  0.55 V/microsec. */
00084                } pdSlewRate_t;
00085 
00086   /** Type for flexible speed write-1 low time in microsec. */
00087   typedef enum { w1LowTime_8=0x00,  /**< Write-1 low time  8 microsec. */
00088                  w1LowTime_9,       /**< Write-1 low time  9 microsec. */
00089                  w1LowTime_10,      /**< Write-1 low time 10 microsec. */
00090                  w1LowTime_11,      /**< Write-1 low time 11 microsec. */
00091                  w1LowTime_12,      /**< Write-1 low time 12 microsec. */
00092                  w1LowTime_13,      /**< Write-1 low time 13 microsec. */
00093                  w1LowTime_14,      /**< Write-1 low time 14 microsec. */
00094                  w1LowTime_15       /**< Write-1 low time 15 microsec. */
00095                } w1LowTime_t;
00096 
00097   /** Type for flexible speed DSO/ W0R time in microsec. */
00098   typedef enum { soW0RecTime_3=0x00,  /**< DSO/w0R time  3 microsec. */
00099                  soW0RecTime_4,       /**< DSO/w0R time  4 microsec. */
00100                  soW0RecTime_5,       /**< DSO/w0R time  5 microsec. */
00101                  soW0RecTime_6,       /**< DSO/w0R time  6 microsec. */
00102                  soW0RecTime_7,       /**< DSO/w0R time  7 microsec. */
00103                  soW0RecTime_8,       /**< DSO/w0R time  8 microsec. */
00104                  soW0RecTime_9,       /**< DSO/w0R time  9 microsec. */
00105                  soW0RecTime_10       /**< DSO/w0R time 10 microsec. */
00106                } soW0RecTime_t;
00107 
00108   //!@}
00109 
00110 
00111   
00112   //=====================================================================================
00113   //
00114   // methods
00115   //
00116 
00117   /** Set the 1-Wire speed mode.
00118    */
00119   virtual void setWireSpeed( const wireSpeed_t inWireSpeed);
00120 
00121   /** Get the 1-Wire speed mode.
00122    */
00123   virtual wireSpeed_t getWireSpeed() = 0;
00124 
00125   
00126   /** Set the Pulldown Slew Rate Control.
00127       Current speed checking and remembering the value is done by provided implementation.
00128       @throw  incompatibleSpeed_error  Thrown when not in flexible speed mode.
00129    */
00130   virtual void setPullDownSlewRate( const pdSlewRate_t inPDSR);
00131 
00132   /** Get the Pulldown Slew Rate Control.
00133       Current speed checking is done by provided implementation.
00134 
00135       <b>Note:</b>Implementations should NOT simply return the value saved in
00136                   this class, but read the actual values from the device.
00137       
00138       @throw  incompatibleSpeed_error  Thrown when not in flexible speed mode.
00139    */
00140   virtual pdSlewRate_t getPullDownSlewRate();
00141 
00142 
00143   /** Set the Write 1 Low Time.
00144       Current speed checking and remembering the value is done by provided implementation.
00145       @throw  incompatibleSpeed_error  Thrown when not in flexible speed mode.
00146    */
00147   virtual void setWrite1LowTime( const w1LowTime_t inW1LT);
00148 
00149   /** Get the Write 1 Low Time.
00150       Current speed checking is done by provided implementation.
00151 
00152       <b>Note:</b>Implementations should NOT simply return the value saved in
00153                   this class, but read the actual values from the device.
00154 
00155       @throw  incompatibleSpeed_error  Thrown when not in flexible speed mode.
00156    */
00157   virtual w1LowTime_t getWrite1LowTime();
00158 
00159 
00160   /** Set the Sample Offset / Write 0 Recovery time.
00161       Current speed checking and remembering the value is done by provided implementation.
00162       @throw  incompatibleSpeed_error  Thrown when not in flexible speed mode.
00163    */
00164   virtual void setSampleOffsetWrite0Rec( const soW0RecTime_t inSOW0RT);
00165 
00166   /** Get the Sample Offset / Write 0 Recovery time.
00167       Current speed checking is done by provided implementation.
00168 
00169       <b>Note:</b>Implementations should NOT simply return the value saved in
00170                   this class, but read the actual values from the device.
00171 
00172       @throw  incompatibleSpeed_error  Thrown when not in flexible speed mode.
00173    */
00174   virtual soW0RecTime_t getSampleOffsetWrite0Rec();
00175 
00176 
00177   
00178 //=======================================================================================
00179 protected:
00180   
00181   //=====================================================================================
00182   //
00183   // attributes
00184   //
00185   
00186   wireSpeed_t    wireSpeed;    /**< Saved value of wire speed. */
00187   pdSlewRate_t   pdSlewRate;   /**< Saved value of pulldown slew rate. */
00188   w1LowTime_t    w1LowTime;    /**< Saved value of write-1 low time. */
00189   soW0RecTime_t  soW0RecTime;  /**< Saved value of DSO/W0R time. */
00190 
00191 
00192   
00193   //=====================================================================================
00194   //
00195   // constructors
00196   //
00197 
00198   /** Constructor.
00199       Protected because should only be callable from deriving classes.
00200 
00201       @param  inWireSpeed    Initial value for 1-Wire speed.
00202       @param  inPdSlewRate   Initial value for pulldown slew rate.
00203       @param  inW1LowTime    Initial value for write-1 low time.
00204       @param  inSoW0RecTime  Initial value for DSO/W0R time.
00205    */
00206   LOW_linkFlexibleSpeed( const wireSpeed_t inWireSpeed, const pdSlewRate_t inPdSlewRate,
00207                          const w1LowTime_t inW1LowTime, const soW0RecTime_t inSoW0RecTime);
00208 
00209 
00210   /** Destructor.
00211    */
00212   virtual ~LOW_linkFlexibleSpeed();
00213 
00214 };
00215 
00216 #endif

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