5
5
6
6
#include " RotaryEncoderMCP23017ButtonESP32.h"
7
7
8
- // declared here so handler below can access
9
- Method _btnCallback;
10
- // _btnCallback.callback2IntArg(button->getId(), eventType);
11
-
12
- RotaryEncoderPushButtonESP32::RotaryEncoderPushButtonESP32 (
8
+ RotaryEncoderMCP23017ButtonESP32::RotaryEncoderMCP23017ButtonESP32 (
13
9
uint8_t index,
14
10
int a_pin,
15
11
int b_pin,
16
12
int btn_pin,
17
13
Method btn_callback,
18
14
Method encoder_callback,
19
- MultiPlexer_MCP23017* mcp
15
+ MultiPlexer_MCP23017* mcp,
16
+ MCP_PORT port
20
17
) {
21
18
_pinA = a_pin;
22
19
_pinB = b_pin;
23
20
_btnPin = btn_pin;
24
- _btnCallback = btn_callback;
25
21
_encoderCallback = encoder_callback;
26
22
27
23
_encoder = new ESP32Encoder ();
28
- _button = new Button_MCP23017 (_btnPin, MCP_PORT::A , mcp, _btnCallback );
24
+ _button = new Button_MCP23017 (_btnPin, port , mcp, btn_callback );
29
25
}
30
26
31
- void RotaryEncoderPushButtonESP32 ::begin () {
27
+ void RotaryEncoderMCP23017ButtonESP32 ::begin () {
32
28
// encoder
33
29
_encoder->attachSingleEdge (_pinA, _pinB);
34
30
35
31
// button
36
32
_button->begin ();
37
33
}
38
34
39
- void RotaryEncoderPushButtonESP32 ::loop () {
35
+ void RotaryEncoderMCP23017ButtonESP32 ::loop () {
40
36
// button
41
37
_button->loop ();
42
38
@@ -55,6 +51,6 @@ void RotaryEncoderPushButtonESP32::loop() {
55
51
}
56
52
}
57
53
58
- int64_t RotaryEncoderPushButtonESP32 ::getPosition () {
54
+ int64_t RotaryEncoderMCP23017ButtonESP32 ::getPosition () {
59
55
return _encoder->getCount ();
60
56
}
0 commit comments