00001 /* 00002 * $RCSfile: AnalogOutputSubsystem.hpp,v $ 00003 * $Revision: 1.5 $ 00004 * $Date: 2009/11/29 17:21:05 $ 00005 * jEdit:tabSize=4:collapseFolds=1: 00006 * 00007 * class AnalogOutputSubsystem declarations 00008 */ 00009 00010 00011 #if ! defined( AnalogOutputSubsystem_hpp ) 00012 #define AnalogOutputSubsystem_hpp 00013 00014 // {{{ includes 00015 #include <DeviceSubsystem.hpp> 00016 #include <OutputVoltagePoint.hpp> 00017 // }}} 00018 00019 namespace AIOUSB { 00020 00021 // {{{ class AnalogOutputSubsystem declarations 00022 00023 /* 00024 * class AnalogOutputSubsystem represents the analog output subsystem of a board 00025 */ 00026 00027 class AnalogOutputSubsystem : public DeviceSubsystem { 00028 protected: 00029 static const int MAX_COUNTS; 00030 static const int NUM_RANGES; 00031 int range; // current D/A range 00032 int numChannels; // number of D/A channels 00033 static const double daRange[][ 2 ]; 00034 00035 public: 00036 AnalogOutputSubsystem( USBDevice &parent ); 00037 virtual ~AnalogOutputSubsystem(); 00038 00039 /* 00040 * properties 00041 */ 00042 00043 virtual std::ostream &print( std::ostream &out ); 00044 00045 int getNumChannels() const { 00046 return numChannels; 00047 } // getNumChannels() 00048 00049 /* 00050 * configuration 00051 */ 00052 00053 int getRange() const { 00054 return range; 00055 } // getRange() 00056 00057 AnalogOutputSubsystem &setRange( int range ); 00058 00059 /* 00060 * operations 00061 */ 00062 00063 AnalogOutputSubsystem &write( int channel, unsigned short counts ); 00064 AnalogOutputSubsystem &write( const UShortArray &points ); 00065 AnalogOutputSubsystem &writeVolts( int channel, double volts ); 00066 AnalogOutputSubsystem &writeVolts( const OutputVoltagePointArray &points ); 00067 double countsToVolts( unsigned short counts ) const; 00068 DoubleArray countsToVolts( const UShortArray &counts ) const; 00069 unsigned short voltsToCounts( double volts ) const; 00070 UShortArray voltsToCounts( const DoubleArray &volts ) const; 00071 }; // class AnalogOutputSubsystem 00072 00073 // }}} 00074 00075 } // namespace AIOUSB 00076 00077 #endif 00078 00079 00080 /* end of file */