Follow this link to skip to the main content

claraty::AO Class Reference

#include <analog_out.h>

Collaboration diagram for claraty::AO:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 AO (AO_impl &ao_impl, int channel, float gain=0.0, float offset=0.0)
AO_implimpl ()
int get_channel ()
void set_gain (float gain)
void set_offset (float offset)
float get_gain ()
float get_offset ()
void set_gain_for_V ()
void set_offset_for_V ()
int output (float data)

Private Attributes

AO_impl_ao_impl
int _channel
float _gain
float _offset

Detailed Description

Definition at line 37 of file analog_out.h.


Constructor & Destructor Documentation

claraty::AO::AO ( AO_impl ao_impl,
int  channel,
float  gain = 0.0,
float  offset = 0.0 
)

Definition at line 40 of file analog_out.cc.

References _gain, _offset, output(), set_gain_for_V(), and set_offset_for_V().

00040                                                                :
00041   _ao_impl (ao_impl),
00042   _channel (channel),
00043   _gain (gain),
00044   _offset (offset)
00045 {
00046   /*
00047    *    if gain is 0 (default), assume conversion to Volt
00048    */
00049   if (gain == 0.0) {
00050     set_gain_for_V();           // unit in V
00051     set_offset_for_V();         // unit in V
00052   }
00053 
00054 #ifdef VERBOSE
00055 //  logMsg("AO: channel= %d, gain= %f, offset= %f\n", _channel, _gain, _offset);
00056   cout << "AO: channel = " << channel << "; gain = " << _gain << "; offset = " << _offset << endl;
00057 #endif
00058 
00059 
00060   output(0.);           // initialize to 0 V output
00061 
00062 }

Here is the call graph for this function:


Member Function Documentation

AO_impl& claraty::AO::impl (  )  [inline]

Definition at line 42 of file analog_out.h.

References _ao_impl.

00042 { return _ao_impl;}

int claraty::AO::get_channel (  )  [inline]

Definition at line 43 of file analog_out.h.

References _channel.

00043 { return _channel;}

void claraty::AO::set_gain ( float  gain  )  [inline]

Definition at line 44 of file analog_out.h.

References _gain.

00044 {_gain = gain;}

void claraty::AO::set_offset ( float  offset  )  [inline]

Definition at line 45 of file analog_out.h.

References _offset.

00045 {_offset = offset;}

float claraty::AO::get_gain (  )  [inline]

Definition at line 46 of file analog_out.h.

References _gain.

00046 { return _gain;}

float claraty::AO::get_offset (  )  [inline]

Definition at line 47 of file analog_out.h.

References _offset.

00047 { return _offset;}

void claraty::AO::set_gain_for_V (  ) 

Definition at line 81 of file analog_out.cc.

References _ao_impl, _channel, _gain, and claraty::AO_impl::get_gain_for_V().

Referenced by AO().

00082 {
00083   _gain = _ao_impl.get_gain_for_V(_channel);
00084 }

Here is the call graph for this function:

void claraty::AO::set_offset_for_V (  ) 

Definition at line 87 of file analog_out.cc.

References _ao_impl, _channel, _offset, and claraty::AO_impl::get_offset_for_V().

Referenced by AO().

00088 {
00089   _offset = _ao_impl.get_offset_for_V(_channel);
00090 }

Here is the call graph for this function:

int claraty::AO::output ( float  data  ) 

Definition at line 64 of file analog_out.cc.

References _ao_impl, _channel, _gain, _offset, and claraty::AO_impl::output().

Referenced by AO().

00065 {
00066 
00067   int data2 = (int) (data * _gain + _offset);
00068 
00069   _ao_impl.output(_channel, data2);
00070 
00071 #ifdef VERBOSE
00072 //  logMsg("AO::output(%f): _ao_impl.output(%d, %d)\n", data, _channel, data2);
00073   cout << "AO::output(" << dec << data << "): _ao_impl.output(" 
00074 << _channel << ", " << hex << data2 << "): " << dec << endl;
00075 #endif
00076 
00077   return 0;
00078 }

Here is the call graph for this function:


Member Data Documentation

Definition at line 56 of file analog_out.h.

Referenced by impl(), output(), set_gain_for_V(), and set_offset_for_V().

int claraty::AO::_channel [private]

Definition at line 57 of file analog_out.h.

Referenced by get_channel(), output(), set_gain_for_V(), and set_offset_for_V().

float claraty::AO::_gain [private]

Definition at line 58 of file analog_out.h.

Referenced by AO(), get_gain(), output(), set_gain(), and set_gain_for_V().

float claraty::AO::_offset [private]

Definition at line 59 of file analog_out.h.

Referenced by AO(), get_offset(), output(), set_offset(), and set_offset_for_V().


The documentation for this class was generated from the following files: