Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
src
MultiThrowSwitch.h
1
#pragma once
2
3
#include <stdint.h>
4
#include "DebouncedButton.h"
5
13
class
MultiThrowSwitch
{
14
public
:
32
MultiThrowSwitch
(uint8_t
throws
,
const
uint8_t pins[],
bool
sticky=
false
,
bool
pullup=
true
);
33
34
/* Destructor.
35
*
36
* Will delete dynamically allocated DebouncedButton objects
37
*/
38
virtual
~
MultiThrowSwitch
();
39
51
void
begin
(
int
startPosition=0, uint8_t threshold=AbstractDebouncedButton::DefaultThreshold, uint8_t delay=AbstractDebouncedButton::DefaultButtonDelay);
52
57
void
update
();
58
67
uint8_t
position
();
68
69
private
:
70
uint8_t _throws;
71
bool
_useOff;
72
DebouncedButton
** _buttons;
73
uint8_t _pos;
74
75
};
76
MultiThrowSwitch::begin
void begin(int startPosition=0, uint8_t threshold=AbstractDebouncedButton::DefaultThreshold, uint8_t delay=AbstractDebouncedButton::DefaultButtonDelay)
Definition:
MultiThrowSwitch.cpp:40
DebouncedButton
Definition:
DebouncedButton.h:15
MultiThrowSwitch::position
uint8_t position()
Definition:
MultiThrowSwitch.cpp:76
MultiThrowSwitch::update
void update()
Definition:
MultiThrowSwitch.cpp:53
MultiThrowSwitch
Definition:
MultiThrowSwitch.h:13
MultiThrowSwitch::MultiThrowSwitch
MultiThrowSwitch(uint8_t throws, const uint8_t pins[], bool sticky=false, bool pullup=true)
Definition:
MultiThrowSwitch.cpp:5
Generated by
1.8.15