Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
src
DualButton.cpp
1
#include "DualButton.h"
2
3
DualButton::DualButton
(
DebouncedButton
* b1,
DebouncedButton
* b2)
4
{
5
_b1 = b1;
6
_b2 = b2;
7
}
8
9
void
DualButton::begin
(uint8_t threshold, uint8_t delay)
10
{
11
_b1->
begin
(threshold, delay);
12
_b2->
begin
(threshold, delay);
13
}
14
15
void
DualButton::update
()
16
{
17
_b1->
update
();
18
_b2->
update
();
19
}
20
21
bool
DualButton::on
()
22
{
23
return
_b1->
on
() || _b2->
on
();
24
}
25
26
bool
DualButton::pushed
()
27
{
28
return
_b1->
pushed
() || _b2->
pushed
();
29
}
30
31
bool
DualButton::tapped
()
32
{
33
return
_b1->
tapped
() || _b2->
tapped
();
34
}
35
36
bool
DualButton::held
(uint16_t ms)
37
{
38
return
_b1->
held
(ms) || _b2->
held
(ms);
39
}
40
41
bool
DualButton::repeat
(uint16_t initialMs, uint16_t repeatMs)
42
{
43
return
_b1->
repeat
(initialMs, repeatMs) || _b2->
repeat
(initialMs, repeatMs);
44
}
45
46
47
DualButton::repeat
bool repeat(uint16_t initialMs=AbstractDebouncedButton::DefaultButtonRepeatInitialMs, uint16_t repeatMs=AbstractDebouncedButton::DefaultButtonRepeatMs)
Definition:
DualButton.cpp:41
AbstractDebouncedButton::held
bool held(uint16_t ms=DefaultHeldMs)
Definition:
AbstractDebouncedButton.cpp:34
DebouncedButton
Definition:
DebouncedButton.h:15
AbstractDebouncedButton::pushed
bool pushed(bool peek=false)
Definition:
AbstractDebouncedButton.cpp:20
DualButton::update
void update()
Definition:
DualButton.cpp:15
AbstractDebouncedButton::repeat
bool repeat(uint16_t initialMs=DefaultButtonRepeatInitialMs, uint16_t repeatMs=DefaultButtonRepeatMs)
Definition:
AbstractDebouncedButton.cpp:39
DualButton::on
bool on()
Definition:
DualButton.cpp:21
DebouncedButton::begin
void begin(uint8_t threshold=AbstractDebouncedButton::DefaultThreshold, uint8_t delay=AbstractDebouncedButton::DefaultButtonDelay)
Definition:
DebouncedButton.cpp:11
AbstractDebouncedButton::tapped
uint32_t tapped(bool peek=false)
Definition:
AbstractDebouncedButton.cpp:27
DualButton::DualButton
DualButton(DebouncedButton *b1, DebouncedButton *b2)
Definition:
DualButton.cpp:3
DualButton::pushed
bool pushed()
Definition:
DualButton.cpp:26
DebouncedButton::update
void update()
Definition:
DebouncedButton.cpp:17
DebouncedButton::on
bool on()
Definition:
DebouncedButton.cpp:31
DualButton::begin
void begin(uint8_t threshold=AbstractDebouncedButton::DefaultThreshold, uint8_t delay=AbstractDebouncedButton::DefaultButtonDelay)
Definition:
DualButton.cpp:9
DualButton::tapped
bool tapped()
Definition:
DualButton.cpp:31
DualButton::held
bool held(uint16_t ms=AbstractDebouncedButton::DefaultHeldMs)
Definition:
DualButton.cpp:36
Generated by
1.8.15