PushDuration maps n callback functions to the duration of a button press. E.g. foo() is called when a button is released after 1 second where bar() is called after 3 seconds.
Fork of PushDuration by
Diff: PushDuration.cpp
- Revision:
- 2:126fed923ada
- Parent:
- 0:19efa3fea668
- Child:
- 3:d2aec01c8227
--- a/PushDuration.cpp Fri May 20 15:13:45 2016 +0000 +++ b/PushDuration.cpp Wed Aug 17 09:29:41 2016 +0000 @@ -19,18 +19,13 @@ * and enables IRQ for the given pin. **/ void ButtonHandler::enable() { - buttonPin.mode(PullUp); + buttonPin.mode(PullDown); wait(0.01); buttonPin.rise(this, &ButtonHandler::release); buttonPin.fall(this, &ButtonHandler::press); buttonPin.enable_irq(); } -/** - * - * - * -**/ void ButtonHandler::disable() { buttonPin.disable_irq();