Treehopper C++ API
RotaryEncoder.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "Event.h"
5 #include "DigitalIn.h"
6 
7 namespace Treehopper {
8  namespace Libraries {
9  namespace Input {
10  using namespace std;
11  using namespace Treehopper;
12 
13  class RotaryEncoder;
14 
16  public:
18  };
19 
21  public:
22  RotaryEncoder(DigitalIn &channelA, DigitalIn &channelB, int stepsPerTick = 4);
23 
24  ~RotaryEncoder();
25 
27 
28  long position();
29 
30  void position(long value);
31 
32  protected:
33  DigitalIn &a;
34  DigitalIn &b;
35  long _position;
36  long oldPosition;
37  int stepsPerTick;
38 
39  void updatePosition();
40  };
41  }
42  }
43 }
Provides a simple C#-style observer pattern event queue.
Definition: Event.h:68
long newPosition
Definition: RotaryEncoder.h:17
Definition: RotaryEncoder.h:20
digital input pin abstract class.
Definition: DigitalIn.h:22
#define LIBRARIES_API
Definition: Treehopper.Libraries.h:17
Definition: AdcPin.h:3
Event< RotaryEncoder, PositionChangedEventArgs > positionChanged
Definition: RotaryEncoder.h:26