Skip to content

Commit ef582b8

Browse files
committed
Documentation updates.
1 parent 50c5779 commit ef582b8

3 files changed

Lines changed: 24 additions & 11 deletions

File tree

README.md

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

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.
3+
A class for adding functionality to push (momentary) buttons. This library allows a simple momentary push button to be used as a momentary button, latching button, counter, or enumerator. This library uses the Bounce2 library to add debouncing functionality.
44

55
## 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.
6+
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. These two categories of buttons are described here. See "Software Design" below for information about how the source code implements these behaviors.
77

88
### Two State Buttons
99
These buttons are either on or off.
@@ -33,7 +33,7 @@ Turns a push button (momentary button) into a button used to cycle through state
3333
Some abstract base classes provided common functionality and interface design. These cannot be instantiated.
3434

3535
#### ButtonBase
36-
Abstract class that is the base class for every other class and implements common behavior.
36+
Abstract class that is the base class for every other class and implements common behavior. If you want to understand the software, you should start here.
3737

3838
#### SimpleButton
3939
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.

src/ButtonBase.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,20 @@
2727
behavior into currently pressed, short press, long press, or idle (nothing
2828
happening).
2929
30-
This class also acts as a base class for other button related classes.
30+
This class is a base class for all other button classes.
3131
3232
The work of debouncing and catching the state changes (LOW to HIGH or HIGH to LOW)
3333
is done by the Bounce2 library.
3434
35-
See also: PushButton, ToggleButton, PushButtonCounter, CycleButton
35+
See also: SimpleButton, ResetableButton
36+
*/
37+
38+
/*
39+
You must have the following libraries to run this software.
40+
41+
Bounce2 by Thomas Ouellet Fredericks, et al.
42+
- Can be installed from Arduino IDE Library Manager.
43+
- https://github.com/thomasfredericks/Bounce2
3644
*/
3745

3846
/*

src/SimpleButton.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@
2525
Abstract class that provides interface for a two state button (button that only has
2626
an on and off state).
2727
28-
The purpose of this class is to provide automatic implimentation of different behaviors.
29-
By using different classes derived from SimpleButton, a class can automatically implement
30-
momentary, latching, always on, or always off behavior. This makes it easy to implement
31-
different behaviors or even switch behaviors during run time.
28+
The purpose of this class is to allow software to switch behaviors during run time. This
29+
also makes software development easier by not locking the developer into a specific button
30+
type. By using different classes derived from SimpleButton, software can implement
31+
momentary, latching, always on, or always off behavior simply by instantiating the required
32+
derived class.
3233
*/
3334

3435
#ifndef TWOSTATEBUTTON_H
@@ -39,10 +40,14 @@
3940

4041
class SimpleButton : public ButtonBase
4142
{
42-
public:
43+
protected:
44+
// This is an abstract class and is only instantiated by derived classes.
45+
// Therefore, all the constructors should be protected.
4346
SimpleButton(int pin);
4447
SimpleButton(int pin, int debounceInterval);
45-
~SimpleButton();
48+
49+
public:
50+
virtual ~SimpleButton();
4651

4752
public:
4853
// Returns true if the button is currently pressed.

0 commit comments

Comments
 (0)