Skip to content

Commit f0cbf59

Browse files
committed
Update README.md
1 parent bbdd0a0 commit f0cbf59

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,48 @@
11
# ButtonSuite
22

3-
A class for adding functionality to push (momentary) buttons. Includes debouncing. This library contains two categories of class, two state buttons and incrementing buttons.
3+
A class for adding functionality to push (momentary) buttons. Includes debouncing. This library contains two categories of button types. The first category is two state buttons; these are either on or off. The second category provides incrementing buttons that can perform different types of counting.
4+
5+
## Types of Buttons
6+
The two categories of buttons that can be instantiated are described here. See "Software Design" below for information about how the source code implements these behaviors.
47

58
### Two State Buttons
69
These buttons are either on or off.
710

8-
#### SimpleButton
9-
Abstract base class that provides interface for a two state button (button that only has an on and off state). You cannot instantiate (create an instance) of this class.
10-
11-
The purpose of this class is to provide automatic implimentation of different behaviors. By using different classes derived from SimpleButton, a class can automatically implement momentary, latching, always on, or always off behavior. This makes it easy to implement different behaviors or even switch behaviors during run time.
12-
1311
#### MomentaryButton
1412
This is standard push (momentary) button. It returns true when the button is pressed (held down) and false when it is not.
1513

1614
#### LatchingButton
1715
Turns a push button (momentary button) into a toggle button (latching button). Pressing the button alternates between on (true) and off (false). This is a virtual latching switch controled by a real momentary button. The toggle button can be reset to the base (known) state by the user (with a long press) or programmically.
1816

1917
#### AlwaysOnButton
20-
Always returns true (on).
18+
Always returns true (on). Useful if you want to temporarily disable user input.
2119

2220
#### AlwaysOffButton
23-
Always returns false (off).
21+
Always returns false (off). Useful if you want to temporarily disable user input.
2422

2523
### Incrementing Buttons
26-
These buttons have multiple states.
24+
These buttons provide different types of counting behavior.
2725

2826
#### CountingButton
2927
Turns a push button (momentary button) into a counter. The counter is incremented each time the button is pushed. The counter continues to increment until it is either reset by the user (with a long press) or reset programically.
3028

3129
#### CycleButton
3230
Turns a push button (momentary button) into a button used to cycle through states (for example, an enum). Pressing the button causes the value to increment. Once the maximum value is reached, the value automatically resets to the initial value. The value can also be reset to the initial value programmically or by the user (with a long press).
3331

32+
## Software Design
33+
Some abstract base classes provided common functionality and interface design. These cannot be instantiated.
34+
35+
#### ButtonBase
36+
Abstract class that is the base class for every other class and implements common behavior.
37+
38+
#### SimpleButton
39+
Abstract base class that provides interface for a two state button (button that only has an on and off state). You cannot instantiate (create an instance) of this class.
40+
41+
The purpose of this class is to allow software to switch behaviors during run time. This also makes software development easier by not locking the developer into a specific button type. By using different classes derived from SimpleButton, software can implement momentary, latching, always on, or always off behavior simply by instantiating the required derived class.
42+
43+
#### ResetableButton
44+
Abstract class for button classes that use a long press to indicate they should reset themselves to some initial/base value. Exposes the interface for setting the enable/disable of the long press and the duration of the interval.
45+
3446

3547
## About the Library
3648
### Github Page

0 commit comments

Comments
 (0)