Skip to content

Commit a3b64d2

Browse files
committed
Clean up ResettableButton rename.
1 parent 8e9dc64 commit a3b64d2

10 files changed

Lines changed: 42 additions & 46 deletions

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ Turns a push button (momentary button) into a counter. The counter is increment
3333
#### CycleButton
3434
Turns a push button (momentary button) into a button used to cycle through states (for example, an enumeration). 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).
3535

36+
3637
## Software Design
3738
Visit the Wiki to learn how the software is designed.
3839

40+
3941
## About the Library
4042
### Github Page
41-
4243
https://github.com/lendres/ButtonSuite-Arduino
4344

4445
### Version 2
4546
The purpose of Version 2 was to greatly simplify the interface as well as the internal structure of the software. Some of the more esoteric functionality was removed and some functionality was separated into different classes. This meant backwards capatablity could not be maintained, however, the benefit is a much cleaner and easier to understand library.
4647

4748
### Prerequisites
4849
This library requires the following librarys to run:
49-
5050
* [Bounce2](https://github.com/thomasfredericks/Bounce2) - Debouncer for Arduino
5151

5252
### Installing
@@ -60,5 +60,6 @@ We use [SemVer](http://semver.org/) for versioning.
6060
## Authors
6161
* **Lance A. Endres** - [lendres](https://github.com/lendres)
6262

63+
6364
## License
6465
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

keywords.txt

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
11
################################
22
# Classes
33
################################
4-
ButtonBase KEYWORD1
5-
TwoStateButton KEYWORD1
6-
Resettable KEYWORD1
4+
ButtonBase KEYWORD1
5+
TwoStateButton KEYWORD1
6+
ResettableButton KEYWORD1
77

8-
AlwaysOnButton KEYWORD1
9-
MomentaryButton KEYWORD1
8+
AlwaysOffButton KEYWORD1
9+
AlwaysOnButton KEYWORD1
10+
MomentaryButton KEYWORD1
11+
LatchingButton KEYWORD1
12+
PushEventButton KEYWORD1
1013

11-
LatchingButton KEYWORD1
12-
CountingButton KEYWORD1
13-
CycleButton KEYWORD1
14+
CountingButton KEYWORD1
15+
CycleButton KEYWORD1
1416

1517
################################
1618
# Functions
1719
################################
18-
setDebounceInterval KEYWORD2
19-
update KEYWORD2
20+
setDebounceInterval KEYWORD2
21+
update KEYWORD2
2022

21-
setLongPressReset KEYWORD2
23+
pushed KEYWORD2
24+
25+
setResetOnLongPress KEYWORD2
2226
setLongPressInterval KEYWORD2
23-
reset KEYWORD2
27+
reset KEYWORD2
2428

25-
isPressed KEYWORD2
29+
getCount KEYWORD2
2630

2731
setDefaultState KEYWORD2
2832
getStatus KEYWORD2
2933

30-
getCount KEYWORD2
34+
3135

3236
setMinimum KEYWORD2
3337
setMaximum KEYWORD2

src/ButtonBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
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: TwoStateButton, Resettable
35+
See also: TwoStateButton, ResettableButton
3636
*/
3737

3838
/*

src/CountingButton.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525

2626
// Constructors.
2727
CountingButton::CountingButton(int pin) :
28-
Resettable(pin),
28+
ResettableButton(pin),
2929
_count(0)
3030
{
3131
}
3232

3333
CountingButton::CountingButton(int pin, int debounceInterval) :
34-
Resettable(pin, debounceInterval),
34+
ResettableButton(pin, debounceInterval),
3535
_count(0)
3636
{
3737
}

src/CountingButton.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
#define COUNTINGBUTTON_H
3939

4040
#include <Arduino.h>
41-
#include "Resettable.h"
41+
#include "ResettableButton.h"
4242

43-
class CountingButton : public Resettable
43+
class CountingButton : public ResettableButton
4444
{
4545
public:
4646
CountingButton(int pin);

src/CycleButton.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,39 +25,39 @@
2525

2626
// Constructors.
2727
CycleButton::CycleButton(int pin) :
28-
Resettable(pin),
28+
ResettableButton(pin),
2929
_minValue(ZEROBASED),
3030
_maxValue(2),
3131
_value(0)
3232
{
3333
}
3434

3535
CycleButton::CycleButton(int pin, int maxValue) :
36-
Resettable(pin),
36+
ResettableButton(pin),
3737
_minValue(ZEROBASED),
3838
_maxValue(maxValue),
3939
_value(0)
4040
{
4141
}
4242

4343
CycleButton::CycleButton(int pin, CYCLEBASE minValue, int maxValue) :
44-
Resettable(pin),
44+
ResettableButton(pin),
4545
_minValue(minValue),
4646
_maxValue(maxValue),
4747
_value(0)
4848
{
4949
}
5050

5151
CycleButton::CycleButton(int pin, int maxValue, int debounceInterval) :
52-
Resettable(pin, debounceInterval),
52+
ResettableButton(pin, debounceInterval),
5353
_minValue(ZEROBASED),
5454
_maxValue(maxValue),
5555
_value(0)
5656
{
5757
}
5858

5959
CycleButton::CycleButton(int pin, CYCLEBASE minValue, int maxValue, int debounceInterval) :
60-
Resettable(pin, debounceInterval),
60+
ResettableButton(pin, debounceInterval),
6161
_minValue(minValue),
6262
_maxValue(maxValue),
6363
_value(0)
@@ -81,11 +81,6 @@ void CycleButton::setMaximum(unsigned int maxValue)
8181
_maxValue = maxValue;
8282
}
8383

84-
void CycleButton::setLongPressInterval(int longPressInterval)
85-
{
86-
_longPressInterval = longPressInterval;
87-
}
88-
8984
int CycleButton::getValue()
9085
{
9186
// Catch transitions from HIGH to LOW.

src/CycleButton.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
#define CYCLEBUTTON_H
4545

4646
#include <Arduino.h>
47-
#include "Resettable.h"
47+
#include "ResettableButton.h"
4848

49-
class CycleButton : public Resettable
49+
class CycleButton : public ResettableButton
5050
{
5151
// Enums.
5252
public:
@@ -75,9 +75,6 @@ class CycleButton : public Resettable
7575
// Set the maximum value.
7676
void setMaximum(unsigned int maxValue);
7777

78-
// Sets the length of time required for a press to be considered a long press.
79-
void setLongPressInterval(int longPressInterval);
80-
8178
// Status access functions. Call in the "loop" to get the status of the button.
8279
public:
8380
// Checks the button and returns the current state (toggled on or off).

src/LatchingButton.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
#define LATCHINGBUTTON_H
5454

5555
#include <Arduino.h>
56-
#include "Resettable.h"
5756
#include "TwoStateButton.h"
5857

5958
class LatchingButton : public TwoStateButton

src/ResettableButton.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,29 @@
2424
#include "ResettableButton.h"
2525

2626
// Constructors.
27-
Resettable::Resettable(int pin) :
27+
ResettableButton::ResettableButton(int pin) :
2828
ButtonBase(pin),
2929
_resetOnLongPress(true)
3030
{
3131
}
3232

33-
Resettable::Resettable(int pin, int debounceInterval) :
33+
ResettableButton::ResettableButton(int pin, int debounceInterval) :
3434
ButtonBase(pin, debounceInterval),
3535
_resetOnLongPress(true)
3636
{
3737
}
3838

3939
// Destructor.
40-
Resettable::~Resettable()
40+
ResettableButton::~ResettableButton()
4141
{
4242
}
4343

44-
void Resettable::setResetOnLongPress(bool enabled)
44+
void ResettableButton::setResetOnLongPress(bool enabled)
4545
{
4646
_resetOnLongPress = enabled;
4747
}
4848

49-
void Resettable::setLongPressInterval(int longPressInterval)
49+
void ResettableButton::setLongPressInterval(int longPressInterval)
5050
{
5151
// The "_longPressInterval" member is in the "ButtonBase" class.
5252
_longPressInterval = longPressInterval;

src/ResettableButton.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636
#include <Arduino.h>
3737
#include "ButtonBase.h"
3838

39-
class Resettable : public ButtonBase
39+
class ResettableButton : public ButtonBase
4040
{
4141
protected:
4242
// This is an abstract class and is only instantiated by derived classes.
4343
// Therefore, all the constructors should be protected.
44-
Resettable(int pin);
45-
Resettable(int pin, int debounceInterval);
44+
ResettableButton(int pin);
45+
ResettableButton(int pin, int debounceInterval);
4646

47-
virtual ~Resettable();
47+
virtual ~ResettableButton();
4848

4949
// Set up functions. Normally, these would be called in the "setup" function of your sketch.
5050
public:

0 commit comments

Comments
 (0)