Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
DualButton.h
1 #pragma once
2 
3 #include "DebouncedButton.h"
4 
20 class DualButton {
21 public:
27 
37  void begin(uint8_t threshold=AbstractDebouncedButton::DefaultThreshold, uint8_t delay=AbstractDebouncedButton::DefaultButtonDelay);
38 
43  void update();
44 
50  bool on();
51 
58  bool pushed();
59 
65  bool tapped();
66 
75  bool held(uint16_t ms=AbstractDebouncedButton::DefaultHeldMs);
76 
83  bool repeat(uint16_t initialMs=AbstractDebouncedButton::DefaultButtonRepeatInitialMs, uint16_t repeatMs=AbstractDebouncedButton::DefaultButtonRepeatMs);
84 
85 private:
86  DebouncedButton* _b1;
87  DebouncedButton* _b2;
88 };
89 
bool repeat(uint16_t initialMs=AbstractDebouncedButton::DefaultButtonRepeatInitialMs, uint16_t repeatMs=AbstractDebouncedButton::DefaultButtonRepeatMs)
Definition: DualButton.cpp:41
void update()
Definition: DualButton.cpp:15
bool on()
Definition: DualButton.cpp:21
DualButton(DebouncedButton *b1, DebouncedButton *b2)
Definition: DualButton.cpp:3
bool pushed()
Definition: DualButton.cpp:26
void begin(uint8_t threshold=AbstractDebouncedButton::DefaultThreshold, uint8_t delay=AbstractDebouncedButton::DefaultButtonDelay)
Definition: DualButton.cpp:9
bool tapped()
Definition: DualButton.cpp:31
bool held(uint16_t ms=AbstractDebouncedButton::DefaultHeldMs)
Definition: DualButton.cpp:36