00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _EncoderSSI_apci1710_HPP
00020 #define _EncoderSSI_apci1710_HPP
00021
00022 #include <rtt/os/MutexLock.hpp>
00023 #include <rtt/PeriodicActivity.hpp>
00024 #include "rtt/dev/EncoderInterface.hpp"
00025 #include <string>
00026
00027 namespace RTT
00028 {
00029
00030
00062 class EncoderSSI_apci1710_board : public PeriodicActivity
00063 {
00064 public:
00065 EncoderSSI_apci1710_board( unsigned int mNr1 );
00066 EncoderSSI_apci1710_board( unsigned int mNr1, unsigned int mNr2 );
00067 EncoderSSI_apci1710_board( unsigned int mNr1, unsigned int mNr2, unsigned int mNr3 );
00068 EncoderSSI_apci1710_board( unsigned int mNr1, unsigned int mNr2, unsigned int mNr3, unsigned int mNr4 );
00069 virtual ~EncoderSSI_apci1710_board();
00070
00071 unsigned int read( unsigned int encNr );
00072
00073 protected:
00074 virtual void step();
00075 void readCard( unsigned int* );
00076 void switchBuffers();
00077
00078 unsigned int nr_of_modules;
00079 unsigned int moduleNr1;
00080 unsigned int moduleNr2;
00081 unsigned int moduleNr3;
00082 unsigned int moduleNr4;
00083
00084 void* dev;
00085
00086 unsigned int* readbuffer;
00087 unsigned int* writebuffer;
00088 unsigned int* buffer1;
00089 unsigned int* buffer2;
00090
00091 OS::Mutex readLock;
00092 };
00093
00094
00095
00096
00111 class EncoderSSI_apci1710 : public EncoderInterface
00112 {
00113 public:
00114 EncoderSSI_apci1710( unsigned int encNr, EncoderSSI_apci1710_board* board )
00115 {
00116 _board = board;
00117 _encNr = encNr;
00118 }
00119
00120 virtual ~EncoderSSI_apci1710() {};
00121
00122
00123
00124 virtual int positionGet() const { return (int) _board->read( _encNr ); }
00125
00126 virtual int turnGet() const { return 0; }
00127
00128 virtual void positionSet( int p ) {};
00129
00130 virtual void turnSet( int t ) {};
00131
00132 virtual int resolution() const {return 0;};
00133
00134 virtual bool upcounting() const {return true;};
00135
00136
00137 private:
00138 EncoderSSI_apci1710_board* _board;
00139 unsigned int _encNr;
00140 };
00141
00142 };
00143
00144 #endif // _EncoderSSI_apci1710_HPP