25 #ifndef ACE_BUTTON_ENCODED_4TO2_BUTTON_CONFIG_H
26 #define ACE_BUTTON_ENCODED_4TO2_BUTTON_CONFIG_H
28 #include "ButtonConfig.h"
30 namespace ace_button {
61 uint8_t defaultReleasedState = HIGH):
64 mPressedState(defaultReleasedState ^ 0x1) {}
72 int s0 = digitalRead(mPin0);
73 int s1 = digitalRead(mPin1);
77 uint8_t virtualPin = (s0 == mPressedState) | ((s1 == mPressedState) << 1);
78 return (virtualPin == pin) ? mPressedState : (mPressedState ^ 0x1);
84 const uint8_t mPressedState;