Register / Login | Desktop view |
void onButtonPressedClb(uint8_t pin, bool heldDown) {
switch (pin) {
case UP_BUTTON_GPIO:
menuMgr.valueChanged(-1);
break;
case DOWN_BUTTON_GPIO:
menuMgr.valueChanged(+1);
break;
case LEFT_BUTTON_GPIO:
if(!heldDown) menuMgr.performDirectionMove(true);
break;
case RIGHT_BUTTON_GPIO:
if(!heldDown) menuMgr.performDirectionMove(false);
break;
case A_BUTTON_GPIO:
menuMgr.onMenuSelect(heldDown);
break;
case B_BUTTON_GPIO:
if(!heldDown) menuMgr.performDirectionMove(true);
break;
}
}
Do I have to setup a dummy encoder and manipulate it in my callback? Is there no other way?