-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQep.h
More file actions
40 lines (32 loc) · 711 Bytes
/
Qep.h
File metadata and controls
40 lines (32 loc) · 711 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
/*
* Qep.h
*
* Created on: 2017. okt. 22.
* Author: peti
*/
#ifndef QEP_QEP_H_
#define QEP_QEP_H_
#include <stdint.h>
class Qep {
public:
Qep(bool inverted = false, int32_t startPosition = 0);
virtual ~Qep() {}
virtual void init() {}
/**
* This method must calculate 'delta' value in implementations.
*
* Base class implementation simply adds delta to absPosition.
*/
virtual void update();
inline int32_t getDeltaValue() const {
return delta;
}
inline int32_t getAbsolutePosition() const {
return absPosition;
}
protected:
const bool inverted;
int32_t absPosition;
int32_t delta;
};
#endif /* QEP_QEP_H_ */