25 #ifndef ACE_BUTTON_ENCODED_8TO3_BUTTON_CONFIG_H
26 #define ACE_BUTTON_ENCODED_8TO3_BUTTON_CONFIG_H
28 #include "ButtonConfig.h"
30 namespace ace_button {
68 uint8_t defaultReleasedState = HIGH):
72 mPressedState(defaultReleasedState ^ 0x1) {}
80 int s0 = digitalRead(mPin0);
81 int s1 = digitalRead(mPin1);
82 int s2 = digitalRead(mPin2);
86 uint8_t virtualPin = (s0 == mPressedState)
87 | ((s1 == mPressedState) << 1)
88 | ((s2 == mPressedState) << 2);
89 return (virtualPin == pin) ? mPressedState : (mPressedState ^ 0x1);
96 const uint8_t mPressedState;