00001 /* 00002 * $RCSfile: AnalogIORange.hpp,v $ 00003 * $Date: 2009/12/10 00:10:51 $ 00004 * $Revision: 1.1 $ 00005 * jEdit:tabSize=4:indentSize=4:collapseFolds=1: 00006 * 00007 * class AnalogIORange declarations 00008 */ 00009 00010 #if ! defined( AnalogIORange_hpp ) 00011 #define AnalogIORange_hpp 00012 00013 // {{{ includes 00014 #include <USBDeviceManager.hpp> 00015 // }}} 00016 00017 namespace AIOUSB { 00018 00030 class AnalogIORange { 00031 00032 // {{{ protected members 00033 protected: 00034 int range; // current range (meaning defined by class that owns this instance) 00035 int minCounts; // minimum A/D or D/A counts for current range (typically 0) 00036 int maxCounts; // maximum A/D or D/A counts for current range (typically 0xfff or 0xffff) 00037 int rangeCounts; // count range (maxCounts - minCounts), to avoid repeatedly calculating this 00038 double minVolts; // minimum volts for current range 00039 double maxVolts; // maximum volts for current range 00040 double rangeVolts; // voltage range (maxVolts - minVolts), to avoid repeatedly calculating this 00041 // }}} 00042 00043 public: 00044 AnalogIORange(); 00045 AnalogIORange( int minCounts, int maxCounts ); 00046 virtual ~AnalogIORange(); 00047 00053 int getRange() const { 00054 return range; 00055 } // getRange() 00056 00057 virtual AnalogIORange &setRange( int range ); 00058 AnalogIORange &setCountRange( int minCounts, int maxCounts ); 00059 AnalogIORange &setVoltRange( double minVolts, double maxVolts ); 00060 double countsToVolts( int counts ) const; 00061 int voltsToCounts( double volts ) const; 00062 }; // class AnalogIORange 00063 00064 } // namespace AIOUSB 00065 00066 #endif 00067 00068 /* end of file */