acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
ProfilingButtonConfig.h (1018B)
1 #ifndef PROFILING_BUTTON_CONFIG_H 2 #define PROFILING_BUTTON_CONFIG_H 3 4 #include <Arduino.h> // LOW, HIGH 5 #include <ButtonConfig.h> 6 7 namespace ace_button { 8 9 /** 10 * A subclass of ButtonConfig which overrides readButton() so that the 11 * AutoBenchmark sketch can inject button clicks into the AceButton::check() 12 * loop, which we can use to collect timing stats. 13 */ 14 class ProfilingButtonConfig: public ButtonConfig { 15 public: 16 ProfilingButtonConfig(): 17 mButtonState(HIGH) {} 18 19 void init() override { 20 ButtonConfig::init(); 21 mButtonState = HIGH; 22 } 23 24 int readButton(uint8_t /* pin */) override { return mButtonState; } 25 26 /** Set the state of the fake physical button. */ 27 void setButtonState(int buttonState) { mButtonState = buttonState; } 28 29 private: 30 // Disable copy-constructor and assignment operator 31 ProfilingButtonConfig(const ProfilingButtonConfig&) = delete; 32 ProfilingButtonConfig& operator=(const ProfilingButtonConfig&) = delete; 33 34 int mButtonState; 35 }; 36 37 } 38 #endif