rb9005_amplifier.h

00001 /*
00002  * rb9005_amplifier.h - instrumentation amplfier (RB9005).
00003  *
00004  * This file is part of the Rulbus Device Class Library (RDCL).
00005  *
00006  * Copyright (C) 2003-2004, Leiden University.
00007  *
00008  * This library is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * The library is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with mngdriver; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  * $Id: rb9005_amplifier.h 2 2004-10-12 11:54:15Z moene $
00023  */
00024 
00025 #ifndef __RB9005_AMPLIFIER_H
00026 #define __RB9005_AMPLIFIER_H
00027 
00028 #ifndef __RULBUSDEVICE_H
00029 #include "RulbusDevice.h"       // for class RulbusDevice
00030 #endif
00031 
00032 namespace Rulbus
00033 {
00034    DECLARE_CLASS( RB9005_amplifier );  //
00035 
00036    /* *
00037     * \example name.cpp
00038     * This is an example that shows ... .
00039     */
00040 
00266    class RB9005_amplifier : public RulbusDevice
00267    {
00268    public:                              // public methods
00269       typedef Int  Value;               
00270 
00273 
00274       RB9005_amplifier( NameCref name, Addr addr = DEF_ADDR, Rack rack = DEF_RACK );
00275 
00276       ~RB9005_amplifier();
00277 
00281 
00282       int  channel              ( ) const;
00283       int  gain                 ( int aChannel ) const;
00284       Freq lowPassFrequency     ( int aChannel ) const;
00285 
00286       bool isChannelSequenceMode( ) const;
00287       bool isClockSequenceMode  ( ) const;
00288 
00292 
00293       void setChannel           ( int aChannel );
00294       void setGain              ( int aChannel, int aGain );
00295       void setLowPassFrequency  ( int aChannel, Freq aFrequency );
00296 
00297       void enableChannelSequenceMode( bool enable = true );
00298       void enableClockSequenceMode  ( bool enable = true );
00299 
00301 
00302    protected:                                   // protected methods
00305 
00306       RB9005_amplifier();                               
00307       RB9005_amplifier( RB9005_amplifierCref rhs );               
00308       RB9005_amplifierRef operator= ( RB9005_amplifierCref rhs ); 
00309 
00313 
00314       void checkChannel( int aChannel ) const;
00315 
00316       int  gain12      ( int aChannel ) const;
00317       int  gain34      ( int aChannel ) const;
00318 
00319       Freq lpf12       ( int aChannel ) const;
00320       Freq lpf34       ( int aChannel ) const;
00321 
00322       void setGain12   ( int aChannel, int aGain );
00323       void setGain34   ( int aChannel, int aGain );
00324 
00325       void setLpf12    ( int aChannel, Freq aFrequency );
00326       void setLpf34    ( int aChannel, Freq aFrequency );
00327 
00329 
00330    public:                                      // public data
00333 
00334       static const Addr  DEF_ADDR = 0xB3;       
00335 
00339 
00340       static const Value LIM_MINCHN = 1;        
00341       static const Value LIM_MAXCHN = 4;        
00342 
00344 
00345    private:                                     // private data
00348 
00349       Byte theGain12Register;                   
00350       Byte theGain34Register;                   
00351       Byte theFreq1Register;                    
00352       Byte theFreq2Register;                    
00353       Byte theMuxRegister;                      
00354 
00358 
00359       static const int OFF_GAIN12 = 0;          
00360       static const int OFF_MUX    = 1;          
00361       static const int OFF_GAIN34 = 2;          
00362       static const int OFF_FREQ1  = 3;          
00363       static const int OFF_FREQ2  = 4;          
00364       static const int ADR_WIDTH  = OFF_FREQ2 + 1; 
00365 
00369 
00372 
00373       static const int MSK_GAIN1  = 0x0F;       
00374       static const int MSK_GAIN2  = 0xF0;       
00375 
00376       static const int SHL_GAIN1  = 0;          
00377       static const int SHL_GAIN2  = 4;          
00378 
00382 
00383       static const int MSK_GAIN3  = 0x03;       
00384       static const int MSK_GAIN4  = 0x0C;       
00385 
00386       static const int SHL_GAIN3  = 0;          
00387       static const int SHL_GAIN4  = 2;          
00388 
00392 
00393       static const int MSK_LPF12  = 0x0F;       
00394       static const int SHL_LPF12  = 0;          
00395 
00399 
00400       static const int MSK_CHN1   = 0x07;       
00401       static const int MSK_CHN2   = 0x38;       
00402       static const int MSK_CHNSEQ = 0x40;       
00403       static const int MSK_CLKSEQ = 0x80;       
00404 
00405       static const int SHL_CHN1   = 0;          
00406       static const int SHL_CHN2   = 3;          
00407 
00409 
00413 
00414       struct RegInfo                            
00415       {
00416          int mask; int shift;
00417       };
00418 
00419       static const RegInfo GainInfoTable[];     
00420 
00421       static const int     gain12Table[];       
00422       static const int     gain34Table[];       
00423       static const Freq    freq12Table[];       
00424 
00425    };
00426 
00428 
00433    inline RB9005_amplifierRef to_rb9005( RulbusDevicePtr p )
00434    {
00435       return PROXY_CAST<RB9005_amplifierRef>( *p );
00436    }
00437 
00442    inline RB9005_amplifierPtr to_rb9005_ptr( RulbusDevicePtr p )
00443    {
00444       return PROXY_CAST<RB9005_amplifierPtr>( p );
00445    }
00446 
00447 
00448 } // namespace Rulbus
00449 
00450 #endif  // __RB9005_AMPLIFIER_H
00451 
00452 /*
00453  * end of file
00454  */
00455 

Generated on Tue Oct 12 14:11:58 2004 for Rulbus Device Class Library for Microsoft Windows by doxygen 1.3.4