25 #include "EncodedButtonConfig.h"
26 #include "AceButton.h"
28 namespace ace_button {
31 uint8_t numPins,
const uint8_t pins[], uint8_t numButtons,
32 AceButton*
const buttons[], uint8_t defaultReleasedState):
34 mNumButtons(numButtons),
35 mPressedState(defaultReleasedState ^ 0x1),
38 for (uint8_t i = 0; i < mNumButtons; i++) {
46 return (virtualPin == pin) ? mPressedState : (mPressedState ^ 0x1);
51 for (uint8_t i = 0; i < mNumButtons; i++) {
53 if (button ==
nullptr)
continue;
57 uint8_t buttonPin = button->
getPin();
58 uint8_t buttonState = (buttonPin == virtualPin)
59 ? mPressedState : (mPressedState ^ 0x1);
65 uint8_t virtualPin = 0;
66 for (uint8_t i = 0; i < mNumPins; i++) {
67 uint8_t pin = mPins[i];
68 int s = digitalRead(pin);
69 virtualPin |= (s == mPressedState) << i;