MCPcopy Create free account
hub / github.com/LennartHennigs/Button2 / createTestButton

Function createTestButton

test/test_multiple/test_multiple.cpp:64–70  ·  view source on GitHub ↗

Helper to initialize button with specific pin and state function

Source from the content-addressed store, hash-verified

62
63// Helper to initialize button with specific pin and state function
64Button2 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
73void click(Button2& button, uint8_t* stateVar, unsigned long duration) {

Callers 6

testFunction · 0.70
testFunction · 0.50
testFunction · 0.50
testFunction · 0.50
testFunction · 0.50
testFunction · 0.50

Calls 2

beginMethod · 0.80

Tested by

no test coverage detected