Follow this link to skip to the main content

claraty::AI Class Reference
[Hardware Package]

#include <analog_in.h>

Collaboration diagram for claraty::AI:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 AI (AI_impl &ai_impl, int channel=0, float gain=0.0, float offset=0.0)
AI_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 ()
float input ()

Private Attributes

AI_impl_ai_impl
int _channel
float _gain
float _offset

Detailed Description

Analog input class.

Definition at line 46 of file analog_in.h.


Constructor & Destructor Documentation

claraty::AI::AI ( AI_impl ai_impl,
int  channel = 0,
float  gain = 0.0,
float  offset = 0.0 
)

Definition at line 35 of file analog_in.cc.

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

00035                                                                :
00036   _ai_impl (ai_impl),
00037   _channel (channel),
00038   _gain (gain),
00039   _offset (offset)
00040 {
00041   /*
00042    *    if gain is 0 (default), assume conversion to Volt
00043    */
00044   if (gain == 0.0) {
00045     set_gain_for_V();           // unit in V
00046     set_offset_for_V();         // unit in V
00047   }
00048 
00049 #ifdef VERBOSE
00050   cout << "AI: channel = " << channel << "; gain = " << dec << _gain << "; offset = " << _offset << endl;
00051 #endif
00052 }

Here is the call graph for this function:


Member Function Documentation

AI_impl& claraty::AI::impl (  )  [inline]

Definition at line 51 of file analog_in.h.

References _ai_impl.

00051 { return _ai_impl;}

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

Definition at line 52 of file analog_in.h.

References _channel.

00052 { return _channel;}

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

Definition at line 53 of file analog_in.h.

References _gain.

00053 {_gain = gain;}

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

Definition at line 54 of file analog_in.h.

References _offset.

00054 {_offset = offset;}

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

Definition at line 55 of file analog_in.h.

References _gain.

00055 { return _gain;}

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

Definition at line 56 of file analog_in.h.

References _offset.

00056 { return _offset;}

void claraty::AI::set_gain_for_V (  ) 

Definition at line 74 of file analog_in.cc.

References _ai_impl, _channel, _gain, and claraty::AI_impl::get_gain_for_V().

Referenced by AI().

00075 {
00076   _gain = _ai_impl.get_gain_for_V(_channel);
00077 }

Here is the call graph for this function:

void claraty::AI::set_offset_for_V (  ) 

Definition at line 80 of file analog_in.cc.

References _ai_impl, _channel, _offset, and claraty::AI_impl::get_offset_for_V().

Referenced by AI().

00081 {
00082   _offset = _ai_impl.get_offset_for_V(_channel);
00083 }

Here is the call graph for this function:

float claraty::AI::input (  ) 

Definition at line 54 of file analog_in.cc.

References _ai_impl, _channel, _gain, _offset, and claraty::AI_impl::input().

00055 {
00056   float data = (float) _ai_impl.input(_channel);
00057 
00058   // return ( data * _gain + _offset);
00059 
00060   float data2 = data * _gain + _offset;
00061 
00062 #ifdef VERBOSE
00063   cout << "AI::input()" << endl;
00064   cout << " _ai_impl.input(" << dec << _channel <<"): " << endl;
00065   cout << " raw data = " << hex << data << endl;
00066   cout << " gain = " << dec << _gain << "; offset = " << _offset << endl;
00067   cout << " converted data = " << dec << data2 << endl;
00068 #endif
00069 
00070   return data2;
00071 }

Here is the call graph for this function:


Member Data Documentation

Definition at line 64 of file analog_in.h.

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

int claraty::AI::_channel [private]

Definition at line 65 of file analog_in.h.

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

float claraty::AI::_gain [private]

Definition at line 66 of file analog_in.h.

Referenced by AI(), get_gain(), input(), set_gain(), and set_gain_for_V().

float claraty::AI::_offset [private]

Definition at line 67 of file analog_in.h.

Referenced by AI(), get_offset(), input(), set_offset(), and set_offset_for_V().


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