00001 /* 00002 * $RCSfile: DA12_AnalogOutputSubsystem.hpp,v $ 00003 * $Revision: 1.7 $ 00004 * $Date: 2010/01/29 23:49:53 $ 00005 * jEdit:tabSize=4:collapseFolds=1: 00006 * 00007 * class DA12_AnalogOutputSubsystem declarations 00008 */ 00009 00010 00011 #if ! defined( DA12_AnalogOutputSubsystem_hpp ) 00012 #define DA12_AnalogOutputSubsystem_hpp 00013 00014 // {{{ includes 00015 #include <AnalogOutputSubsystem.hpp> 00016 #include <DA12_OutputRange.hpp> 00017 #include <OutputVoltagePoint.hpp> 00018 // }}} 00019 00020 namespace AIOUSB { 00021 00028 class DA12_AnalogOutputSubsystem : public AnalogOutputSubsystem { 00029 friend class USB_DA12_8A_Family; 00030 friend class USB_DA12_8E_Family; 00031 00032 // {{{ public constants 00033 public: 00034 /* 00035 * range codes passed to setRange() 00036 */ 00038 static const int RANGE_0_2_5V = 0; // 0-2.5V 00039 00041 static const int RANGE_2_5V = 1; // +/-2.5V 00042 00044 static const int RANGE_0_5V = 2; // 0-5V 00045 00047 static const int RANGE_5V = 3; // +/-5V 00048 00050 static const int RANGE_0_10V = 4; // 0-10V 00051 00053 static const int RANGE_10V = 5; // +/-10V 00054 00056 static const int MIN_COUNTS = 0; 00057 00059 static const int MAX_COUNTS = 0xfff; 00060 // }}} 00061 00062 // {{{ protected members 00063 protected: 00064 static const char RANGE_TEXT[][ 10 ]; 00065 DA12_OutputRange *outputRange; // device supports a separate range for each D/A channel 00066 // }}} 00067 00068 // {{{ protected methods 00069 protected: 00070 DA12_AnalogOutputSubsystem( USBDevice &parent ); 00071 virtual ~DA12_AnalogOutputSubsystem(); 00072 // }}} 00073 00074 // {{{ public methods 00075 public: 00076 00077 /* 00078 * properties 00079 */ 00080 00081 static std::string getRangeText( int range ); 00082 00083 /* 00084 * configuration 00085 */ 00086 00087 int getRange( int channel ) const; 00088 IntArray getRange( int startChannel, int numChannels ) const; 00089 DA12_AnalogOutputSubsystem &setRange( int channel, int range ); 00090 DA12_AnalogOutputSubsystem &setRange( int startChannel, const IntArray &range ); 00091 DA12_AnalogOutputSubsystem &setRange( int range ); 00092 00093 /* 00094 * operations 00095 */ 00096 00097 DA12_AnalogOutputSubsystem &writeVolts( int channel, double volts ); 00098 DA12_AnalogOutputSubsystem &writeVolts( const OutputVoltagePointArray &points ); 00099 double countsToVolts( int channel, unsigned short counts ) const; 00100 unsigned short voltsToCounts( int channel, double volts ) const; 00101 // }}} 00102 00103 }; // class DA12_AnalogOutputSubsystem 00104 00105 } // namespace AIOUSB 00106 00107 #endif 00108 00109 /* end of file */