Replies: 2 comments 1 reply
-
Try declaring your |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes I tried, but the problem is that I use member variable in my eventHandler function like that: class Test {
private:
AceButton button1 = AceButton(1);
int counter = 0;
void configure();
void handleEvent(AceButton *, uint8_t, uint8_t);
}; #include <Test.h>
void Test::configure(){
pinMode(1, INPUT_PULLUP);
ButtonConfig *buttonConfig = ButtonConfig::getSystemButtonConfig();
buttonConfig->setEventHandler(handleEvent);
buttonConfig->setFeature(ButtonConfig::kFeatureClick);
buttonConfig->setFeature(ButtonConfig::kFeatureLongPress);
buttonConfig->setFeature(ButtonConfig::kFeatureDoubleClick);
buttonConfig->setFeature(ButtonConfig::kFeatureRepeatPress);
}
void Test::handleEvent(AceButton *button, uint8_t eventType, uint8_t buttonState){
switch (button->getPin())
{
case 1:
counter+=1;
break;
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I try to instantiate a ButtonConfig in a member class function but I get the following error.
It is possible to do this pattern ?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions