55
66#include " RotaryEncoderMCP23017ButtonESP32.h"
77
8- // declared here so handler below can access
9- Method _btnCallback;
10- // _btnCallback.callback2IntArg(button->getId(), eventType);
11-
12- RotaryEncoderPushButtonESP32::RotaryEncoderPushButtonESP32 (
8+ RotaryEncoderMCP23017ButtonESP32::RotaryEncoderMCP23017ButtonESP32 (
139 uint8_t index,
1410 int a_pin,
1511 int b_pin,
1612 int btn_pin,
1713 Method btn_callback,
1814 Method encoder_callback,
19- MultiPlexer_MCP23017* mcp
15+ MultiPlexer_MCP23017* mcp,
16+ MCP_PORT port
2017) {
2118 _pinA = a_pin;
2219 _pinB = b_pin;
2320 _btnPin = btn_pin;
24- _btnCallback = btn_callback;
2521 _encoderCallback = encoder_callback;
2622
2723 _encoder = new ESP32Encoder ();
28- _button = new Button_MCP23017 (_btnPin, MCP_PORT::A , mcp, _btnCallback );
24+ _button = new Button_MCP23017 (_btnPin, port , mcp, btn_callback );
2925}
3026
31- void RotaryEncoderPushButtonESP32 ::begin () {
27+ void RotaryEncoderMCP23017ButtonESP32 ::begin () {
3228 // encoder
3329 _encoder->attachSingleEdge (_pinA, _pinB);
3430
3531 // button
3632 _button->begin ();
3733}
3834
39- void RotaryEncoderPushButtonESP32 ::loop () {
35+ void RotaryEncoderMCP23017ButtonESP32 ::loop () {
4036 // button
4137 _button->loop ();
4238
@@ -55,6 +51,6 @@ void RotaryEncoderPushButtonESP32::loop() {
5551 }
5652}
5753
58- int64_t RotaryEncoderPushButtonESP32 ::getPosition () {
54+ int64_t RotaryEncoderMCP23017ButtonESP32 ::getPosition () {
5955 return _encoder->getCount ();
6056}
0 commit comments