encoder.h
Go to the documentation of this file.
1 #ifndef PHIDGETS_API_ENCODER_H
2 #define PHIDGETS_API_ENCODER_H
3 
4 #include "phidgets_api/phidget.h"
5 
6 namespace phidgets {
7 
8 class Encoder : public Phidget
9 {
10  public:
11  Encoder();
12 
13  virtual ~Encoder();
14 
17  int getInputCount();
18 
21  bool getInputState(int index);
22 
25  int getEncoderCount();
26 
29  int getPosition(int index);
30 
36  void setPosition(int index, int position);
37 
42  int getIndexPosition(int index);
43 
46  bool getEnabled(int index);
47 
53  void setEnabled(int index, bool enabled);
54 
55  protected:
56  virtual void inputChangeHandler(int index, int inputState);
57  virtual void positionChangeHandler(int index, int time, int positionChange);
58 
59  private:
60  CPhidgetEncoderHandle encoder_handle_;
61 
62  static int InputChangeHandler(CPhidgetEncoderHandle phid, void *userPtr,
63  int index, int inputState);
64  static int PositionChangeHandler(CPhidgetEncoderHandle phid, void *userPtr,
65  int index, int time, int positionChange);
66 };
67 
68 } // namespace phidgets
69 
70 #endif // PHIDGETS_API_ENCODER_H
CPhidgetEncoderHandle encoder_handle_
Definition: encoder.h:60
static int InputChangeHandler(CPhidgetEncoderHandle phid, void *userPtr, int index, int inputState)
Definition: encoder.cpp:108
int getInputCount()
Gets the number of digital input channels supported by this board.
Definition: encoder.cpp:29
int getIndexPosition(int index)
Gets the position of an encoder the last time an index pulse occured. An index pulse in this context ...
Definition: encoder.cpp:76
virtual void inputChangeHandler(int index, int inputState)
Definition: encoder.cpp:123
void setEnabled(int index, bool enabled)
Set the powered state of an encoder. If an encoder is not enabled, it will not be given power...
Definition: encoder.cpp:100
int getEncoderCount()
Gets the number of encoder input channels supported by this board.
Definition: encoder.cpp:49
int getPosition(int index)
Reads the current position of an encoder.
Definition: encoder.cpp:59
static int PositionChangeHandler(CPhidgetEncoderHandle phid, void *userPtr, int index, int time, int positionChange)
Definition: encoder.cpp:115
bool getInputState(int index)
Reads the current state of a digital input.
Definition: encoder.cpp:39
virtual ~Encoder()
Definition: encoder.cpp:25
void setPosition(int index, int position)
Sets the offset of an encoder such that current position is the specified value.
Definition: encoder.cpp:69
bool getEnabled(int index)
Checks if an encoder is powered on and receiving events.
Definition: encoder.cpp:90
virtual void positionChangeHandler(int index, int time, int positionChange)
Definition: encoder.cpp:128


phidgets_api
Author(s): Tully Foote, Ivan Dryanovski
autogenerated on Fri Apr 9 2021 02:56:02