00001 /* 00002 * $RCSfile: Counter.hpp,v $ 00003 * $Revision: 1.4 $ 00004 * $Date: 2010/01/29 23:49:53 $ 00005 * jEdit:tabSize=4:collapseFolds=1: 00006 * 00007 * class Counter, CounterList declarations 00008 */ 00009 00010 #if ! defined( Counter_hpp ) 00011 #define Counter_hpp 00012 00013 // {{{ includes 00014 #include <vector> 00015 // }}} 00016 00017 namespace AIOUSB { 00018 00019 class CounterSubsystem; 00020 00026 class Counter { 00027 friend class CounterSubsystem; 00028 00029 // {{{ public constants 00030 public: 00031 /* 00032 * 8254 counter/timer modes 00033 */ 00035 static const int MODE_TERMINAL_COUNT = 0; // mode 0: interrupt on terminal count 00037 static const int MODE_ONE_SHOT = 1; // mode 1: hardware retriggerable one-shot 00039 static const int MODE_RATE_GENERATOR = 2; // mode 2: rate generator 00041 static const int MODE_SQUARE_WAVE = 3; // mode 3: square wave mode 00043 static const int MODE_SW_TRIGGERED = 4; // mode 4: software triggered mode 00045 static const int MODE_HW_TRIGGERED = 5; // mode 5: hardware triggered strobe (retriggerable) 00046 // }}} 00047 00048 // {{{ protected members 00049 protected: 00050 CounterSubsystem *parent; // subsystem that this counter belongs to 00051 int counterIndex; // counter index (using 0-based counter addressing) 00052 // }}} 00053 00054 // {{{ protected methods 00055 Counter( CounterSubsystem *parent, int counterIndex ); 00056 // }}} 00057 00058 // {{{ public methods 00059 public: 00060 int getDeviceIndex() const; 00061 Counter &setMode( int mode ); 00062 Counter &setCount( unsigned short count ); 00063 Counter &setModeAndCount( int mode, unsigned short count ); 00064 unsigned short readCount(); 00065 UShortArray readCountAndStatus(); 00066 unsigned short readCountAndSetModeAndCount( int mode, unsigned short count ); 00067 // }}} 00068 00069 }; // class Counter 00070 00071 // {{{ class CounterList declarations 00072 00073 class CounterList : public std::vector<Counter*> { 00074 }; // class CounterList 00075 00076 // }}} 00077 00078 } // namespace AIOUSB 00079 00080 #endif 00081 00082 /* end of file */