Helper to initialize button with specific pin and state function
| 62 | |
| 63 | // Helper to initialize button with specific pin and state function |
| 64 | Button2 createTestButton(uint8_t pin, uint8_t (*stateFunction)(), uint8_t* stateVar) { |
| 65 | Button2 button; |
| 66 | *stateVar = !BUTTON_ACTIVE; |
| 67 | button.setButtonStateFunction(stateFunction); |
| 68 | button.begin(pin, BUTTON_MODE, BUTTON_ACTIVE == LOW); |
| 69 | return button; |
| 70 | } |
| 71 | |
| 72 | // Emulate a button click with proper timing |
| 73 | void click(Button2& button, uint8_t* stateVar, unsigned long duration) { |