-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSTEJ_Rotary_Encoder.h
More file actions
52 lines (37 loc) · 1016 Bytes
/
STEJ_Rotary_Encoder.h
File metadata and controls
52 lines (37 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
STEJ_Rotary_Encoder by Jonathan Meyer
*/
#ifndef _STEJ_ROTARY_ENCODER_H_
#define _STEJ_ROTARY_ENCODER_H_
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class STEJ_Rotary_Encoder
{
public:
virtual ~STEJ_Rotary_Encoder();
void setValue(int16_t value);
void setStep(int16_t step);
void setMinMax(int16_t min, int16_t max);
void setContinuous(boolean continuous);
virtual void begin() = 0;
int16_t read() const;
boolean hasChanged() const;
protected:
STEJ_Rotary_Encoder(int16_t min, int16_t max, int16_t step, boolean continuous);
void move_cw();
void move_ccw();
private:
int16_t m_min;
int16_t m_max;
int16_t m_step;
boolean m_continuous;
int16_t m_value;
mutable boolean m_changed;
STEJ_Rotary_Encoder(const STEJ_Rotary_Encoder & rhs);
STEJ_Rotary_Encoder & operator=(const STEJ_Rotary_Encoder & rhs);
void update();
};
#endif // _STEJ_ROTARY_ENCODER_H_