analog_in.h
Go to the documentation of this file.00001 // -*-c++-*- 00002 //---------------------------< /-/ CLARAty /-/ >------------------------------ 00003 /** 00004 * @file analog_in.h 00005 * 00006 * Analog input class. 00007 * 00008 * <br>@b Designer(s): Issa Nesnas, 00009 * Won Kim 00010 * <br>@b Author(s): Won Kim, 00011 * Issa Nesnas 00012 * <br>@b Date: August 16, 2002 00013 * 00014 * <b>Software License:</b><br> 00015 * <code> http://claraty.jpl.nasa.gov/license/open_src/ or 00016 * file: license/open_src.txt </code> 00017 * 00018 * © 2006, Jet Propulsion Laboratory, California Institute of Technology<br> 00019 * 00020 * $Revision: 1.5 $ 00021 */ 00022 //----------------------------------------------------------------------------- 00023 00024 #if !defined (__ANALOG_IN_H) 00025 #define __ANALOG_IN_H 00026 00027 // Changed common_defs.h to share.h on Feb 26, 2007 00028 #include "claraty/share.h" 00029 #include "claraty/analog_in_impl.h" 00030 00031 namespace claraty { 00032 00033 /** 00034 * @ingroup hardware_pkg 00035 * 00036 * Analog input class. 00037 */ 00038 //@{ 00039 //@} 00040 00041 00042 //------------------------------------------------------------------------- 00043 //---------------<< analaog_in Class >>---------------------- 00044 //------------------------------------------------------------------------- 00045 00046 class AI { 00047 00048 public: 00049 AI (AI_impl& ai_impl, int channel=0, float gain=0.0, float offset=0.0); 00050 00051 AI_impl& impl() { return _ai_impl;} 00052 int get_channel() { return _channel;} 00053 void set_gain(float gain) {_gain = gain;} 00054 void set_offset(float offset) {_offset = offset;} 00055 float get_gain() { return _gain;} 00056 float get_offset() { return _offset;} 00057 00058 void set_gain_for_V(); // unit in V 00059 void set_offset_for_V(); // unit in V 00060 00061 float input(); // convert the digital number read 00062 00063 private: 00064 AI_impl& _ai_impl; 00065 int _channel; 00066 float _gain; 00067 float _offset; 00068 }; 00069 //------------------------------------------------------------------------- 00070 00071 } // namespace claraty 00072 00073 #endif // __ANALOG_IN_H