diff --git a/addon/SD/drm/808Clap1.wav b/addon/SD/drm/808Clap1.wav deleted file mode 100644 index fc3413d..0000000 Binary files a/addon/SD/drm/808Clap1.wav and /dev/null differ diff --git a/addon/SD/drm/808HHCL1.wav b/addon/SD/drm/808HHCL1.wav deleted file mode 100644 index 53eea44..0000000 Binary files a/addon/SD/drm/808HHCL1.wav and /dev/null differ diff --git a/addon/SD/drm/808RimS1.wav b/addon/SD/drm/808RimS1.wav deleted file mode 100644 index 6ee7f9c..0000000 Binary files a/addon/SD/drm/808RimS1.wav and /dev/null differ diff --git a/addon/SD/drm/PHKick1.wav b/addon/SD/drm/PHKick1.wav deleted file mode 100644 index 45ab6ea..0000000 Binary files a/addon/SD/drm/PHKick1.wav and /dev/null differ diff --git a/addon/SD/drm/bd01.wav b/addon/SD/drm/bd01.wav deleted file mode 100644 index 18d258e..0000000 Binary files a/addon/SD/drm/bd01.wav and /dev/null differ diff --git a/addon/SD/drm/bd02.wav b/addon/SD/drm/bd02.wav deleted file mode 100644 index a7cb59b..0000000 Binary files a/addon/SD/drm/bd02.wav and /dev/null differ diff --git a/addon/SD/drm/bd03.wav b/addon/SD/drm/bd03.wav deleted file mode 100644 index ea36827..0000000 Binary files a/addon/SD/drm/bd03.wav and /dev/null differ diff --git a/addon/SD/drm/bd04.wav b/addon/SD/drm/bd04.wav deleted file mode 100644 index 1526776..0000000 Binary files a/addon/SD/drm/bd04.wav and /dev/null differ diff --git a/addon/SD/drm/bd05.wav b/addon/SD/drm/bd05.wav deleted file mode 100644 index 8aa8047..0000000 Binary files a/addon/SD/drm/bd05.wav and /dev/null differ diff --git a/addon/SD/drm/bd06.wav b/addon/SD/drm/bd06.wav deleted file mode 100644 index adbc3fa..0000000 Binary files a/addon/SD/drm/bd06.wav and /dev/null differ diff --git a/addon/SD/drm/bd07.wav b/addon/SD/drm/bd07.wav deleted file mode 100644 index 7ac44f1..0000000 Binary files a/addon/SD/drm/bd07.wav and /dev/null differ diff --git a/addon/SD/drm/bd08.wav b/addon/SD/drm/bd08.wav deleted file mode 100644 index 34d09eb..0000000 Binary files a/addon/SD/drm/bd08.wav and /dev/null differ diff --git a/addon/SD/drm/bd09.wav b/addon/SD/drm/bd09.wav deleted file mode 100644 index 42bb992..0000000 Binary files a/addon/SD/drm/bd09.wav and /dev/null differ diff --git a/addon/SD/drm/bd10.wav b/addon/SD/drm/bd10.wav deleted file mode 100644 index 8bac3e1..0000000 Binary files a/addon/SD/drm/bd10.wav and /dev/null differ diff --git a/addon/SD/drm/cp01.wav b/addon/SD/drm/cp01.wav deleted file mode 100644 index 9a8e03c..0000000 Binary files a/addon/SD/drm/cp01.wav and /dev/null differ diff --git a/addon/SD/drm/cp02.wav b/addon/SD/drm/cp02.wav deleted file mode 100644 index dd92b82..0000000 Binary files a/addon/SD/drm/cp02.wav and /dev/null differ diff --git a/addon/SD/drm/cr01.wav b/addon/SD/drm/cr01.wav deleted file mode 100644 index fdd12d8..0000000 Binary files a/addon/SD/drm/cr01.wav and /dev/null differ diff --git a/addon/SD/drm/cr02.wav b/addon/SD/drm/cr02.wav deleted file mode 100644 index 1a08eb0..0000000 Binary files a/addon/SD/drm/cr02.wav and /dev/null differ diff --git a/addon/SD/drm/hh01.wav b/addon/SD/drm/hh01.wav deleted file mode 100644 index 0f2ab71..0000000 Binary files a/addon/SD/drm/hh01.wav and /dev/null differ diff --git a/addon/SD/drm/hh02.wav b/addon/SD/drm/hh02.wav deleted file mode 100644 index 33302b9..0000000 Binary files a/addon/SD/drm/hh02.wav and /dev/null differ diff --git a/addon/SD/drm/ht01.wav b/addon/SD/drm/ht01.wav deleted file mode 100644 index 65cbcff..0000000 Binary files a/addon/SD/drm/ht01.wav and /dev/null differ diff --git a/addon/SD/drm/ht02.wav b/addon/SD/drm/ht02.wav deleted file mode 100644 index 52a112e..0000000 Binary files a/addon/SD/drm/ht02.wav and /dev/null differ diff --git a/addon/SD/drm/lt01.wav b/addon/SD/drm/lt01.wav deleted file mode 100644 index 970f0f0..0000000 Binary files a/addon/SD/drm/lt01.wav and /dev/null differ diff --git a/addon/SD/drm/lt02.wav b/addon/SD/drm/lt02.wav deleted file mode 100644 index 5dd8ce8..0000000 Binary files a/addon/SD/drm/lt02.wav and /dev/null differ diff --git a/addon/SD/drm/mt01.wav b/addon/SD/drm/mt01.wav deleted file mode 100644 index 864e607..0000000 Binary files a/addon/SD/drm/mt01.wav and /dev/null differ diff --git a/addon/SD/drm/mt02.wav b/addon/SD/drm/mt02.wav deleted file mode 100644 index 4cf3192..0000000 Binary files a/addon/SD/drm/mt02.wav and /dev/null differ diff --git a/addon/SD/drm/oh01.wav b/addon/SD/drm/oh01.wav deleted file mode 100644 index 2c25099..0000000 Binary files a/addon/SD/drm/oh01.wav and /dev/null differ diff --git a/addon/SD/drm/oh02.wav b/addon/SD/drm/oh02.wav deleted file mode 100644 index 7e04a6c..0000000 Binary files a/addon/SD/drm/oh02.wav and /dev/null differ diff --git a/addon/SD/drm/rd01.wav b/addon/SD/drm/rd01.wav deleted file mode 100644 index ef8cd62..0000000 Binary files a/addon/SD/drm/rd01.wav and /dev/null differ diff --git a/addon/SD/drm/rd02.wav b/addon/SD/drm/rd02.wav deleted file mode 100644 index 28c311b..0000000 Binary files a/addon/SD/drm/rd02.wav and /dev/null differ diff --git a/addon/SD/drm/rs01.wav b/addon/SD/drm/rs01.wav deleted file mode 100644 index a63ad27..0000000 Binary files a/addon/SD/drm/rs01.wav and /dev/null differ diff --git a/addon/SD/drm/sd01.wav b/addon/SD/drm/sd01.wav deleted file mode 100644 index 37738f0..0000000 Binary files a/addon/SD/drm/sd01.wav and /dev/null differ diff --git a/addon/SD/drm/sd02.wav b/addon/SD/drm/sd02.wav deleted file mode 100644 index 9b2ffed..0000000 Binary files a/addon/SD/drm/sd02.wav and /dev/null differ diff --git a/addon/SD/drm/sd03.wav b/addon/SD/drm/sd03.wav deleted file mode 100644 index 0e4a5aa..0000000 Binary files a/addon/SD/drm/sd03.wav and /dev/null differ diff --git a/addon/SD/drm/sd04.wav b/addon/SD/drm/sd04.wav deleted file mode 100644 index 6d82f11..0000000 Binary files a/addon/SD/drm/sd04.wav and /dev/null differ diff --git a/addon/SD/drm/sd05.wav b/addon/SD/drm/sd05.wav deleted file mode 100644 index b1e32c7..0000000 Binary files a/addon/SD/drm/sd05.wav and /dev/null differ diff --git a/addon/SD/drm/sd06.wav b/addon/SD/drm/sd06.wav deleted file mode 100644 index 6773cd2..0000000 Binary files a/addon/SD/drm/sd06.wav and /dev/null differ diff --git a/addon/SD/drm/sd07.wav b/addon/SD/drm/sd07.wav deleted file mode 100644 index 890b8e7..0000000 Binary files a/addon/SD/drm/sd07.wav and /dev/null differ diff --git a/addon/SD/drm/sd08.wav b/addon/SD/drm/sd08.wav deleted file mode 100644 index 74463a3..0000000 Binary files a/addon/SD/drm/sd08.wav and /dev/null differ diff --git a/addon/SD/drm/sd09.wav b/addon/SD/drm/sd09.wav deleted file mode 100644 index 8a0738c..0000000 Binary files a/addon/SD/drm/sd09.wav and /dev/null differ diff --git a/addon/SD/drm/sd10.wav b/addon/SD/drm/sd10.wav deleted file mode 100644 index 038becb..0000000 Binary files a/addon/SD/drm/sd10.wav and /dev/null differ diff --git a/addon/SD/drm/sd11.wav b/addon/SD/drm/sd11.wav deleted file mode 100644 index 7e689ec..0000000 Binary files a/addon/SD/drm/sd11.wav and /dev/null differ diff --git a/addon/SD/drm/sd12.wav b/addon/SD/drm/sd12.wav deleted file mode 100644 index 90c7863..0000000 Binary files a/addon/SD/drm/sd12.wav and /dev/null differ diff --git a/addon/SD/drm/sd13.wav b/addon/SD/drm/sd13.wav deleted file mode 100644 index 826d539..0000000 Binary files a/addon/SD/drm/sd13.wav and /dev/null differ diff --git a/addon/SD/drm/sd14.wav b/addon/SD/drm/sd14.wav deleted file mode 100644 index d598284..0000000 Binary files a/addon/SD/drm/sd14.wav and /dev/null differ diff --git a/addon/SD/drm/sd15.wav b/addon/SD/drm/sd15.wav deleted file mode 100644 index 98eca67..0000000 Binary files a/addon/SD/drm/sd15.wav and /dev/null differ diff --git a/third-party/Bounce2/Doxyfile b/third-party/Bounce2/Doxyfile index 14ed479..934333f 100644 --- a/third-party/Bounce2/Doxyfile +++ b/third-party/Bounce2/Doxyfile @@ -906,7 +906,7 @@ EXCLUDE_SYMBOLS = # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = examples/bounce/bounce.ino examples/change/change.ino examples/bounce_multiple/bounce_multiple.ino examples/bounce2buttons/bounce2buttons.ino +EXAMPLE_PATH = examples/bounce_basic/bounce_basic.ino examples/change/button_basic.ino # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and diff --git a/third-party/Bounce2/README.md b/third-party/Bounce2/README.md index c9546f4..7dae8c2 100644 --- a/third-party/Bounce2/README.md +++ b/third-party/Bounce2/README.md @@ -1,66 +1,55 @@ # BOUNCE 2 -Debouncing library for Arduino and Wiring by Thomas Ouellet Fredericks with contributions from: Eric Lowry, Jim Schimpf, Tom Harkaway, Joachim Krüger and MrGradgrind. +Debouncing library for Arduino and Wiring by Thomas Ouellet Fredericks with many contributions from the community : https://github.com/thomasfredericks/Bounce2/graphs/contributors -More about debouncing: http://en.wikipedia.org/wiki/Debounce#Contact_bounce +Basically, the mechanical part of buttons and switches vibrate slightly when closed or opened causing multiple undesired false states (similar to noise). This library filters out these undesired state changes. More about debouncing: +* John Errington's Experiments with an Arduino : [Using digital inputs: Switch bounce and solutions to it](http://www.skillbank.co.uk/arduino/switchbounce.htm) +* Wikipedia article : http://en.wikipedia.org/wiki/Debounce#Contact_bounce See the bottom of this page for a basic usage example and the "examples" folder for more. -## GITHUB PAGE - -https://github.com/thomasfredericks/Bounce2 - -## DOCUMENTATION - -The complete class documentation can be found in the "docs" folder or [online here](http://thomasfredericks.github.io/Bounce2/). - -# HAVE A QUESTION? - -Please post your questions [here](http://forum.arduino.cc/index.php?topic=266132.0). +The library is composed of three classes: +* Debouncer : The code that does the actual debouncing. Only advanced users should play with this class. +* Bounce : This is the general use library. It links the Debouncer to a hardware pin on your board. +* Button : A special version of Bounce for buttons that are pressed. # INSTALLATION & DOWNLOAD Install through your software's Library Manager or download the latest version [here](https://github.com/thomasfredericks/Bounce2/archive/master.zip) and put the "Bounce2" folder in your "libraries" folder. -The original version of Bounce (Bounce 1) is included in the download but not supported anymore. - +Please note that the original version of this library (Bounce 1) is included in the "extras" folder of the download but not supported anymore. -# DEBOUNCE ALGORITHMS (FOR ADVANCED USERS) +## BASIC USE +### INSTANTIATE -## STABLE INTERVAL - -By default, the Bounce library uses a stable interval to process the debouncing. This is simpler to understand and can cancel unwanted noise. - -![](https://raw.github.com/thomasfredericks/Bounce-Arduino-Wiring/master/extras/BouncySwitch_stable.png) - -## LOCK-OUT INTERVAL - -By defining "#define BOUNCE_LOCK_OUT" in "Bounce.h" (or in your code before including "Bounce.h") you can activate an alternative debouncing method. This method is a lot more responsive, but does not cancel noise. - -``` -#define BOUNCE_LOCK_OUT +```cpp +#include +Bounce b = Bounce(); // Instantiate a Bounce object ``` -![](https://raw.github.com/thomasfredericks/Bounce-Arduino-Wiring/master/extras/BouncySwitch_lockout.png) - - -## WITH PROMPT DETECTION - -By defining "#define BOUNCE_WITH_PROMPT_DETECTION" in "Bounce.h" (or in your code before including "Bounce.h") you can activate an alternative debouncing method. Button state changes are available immediately so long as the previous state has been stable for the timeout period. Otherwise the state will be updated as soon as the timeout period allows. - -* Able to report acurate switch time normally with no delay. -* Use when accurate switch transition timing is important. +### SETUP +```cpp +b.attach ( , ); +b.interval( ); ``` -#define BOUNCE_WITH_PROMPT_DETECTION +### LOOP + +```cpp +b.update(); +if ( b.changed() ) { + // THE STATE OF THE INPUT CHANGED + int deboucedValue = b.read(); + // DO SOMETHING WITH THE VALUE +} ``` -# BASIC EXAMPLE + +## BOUNCE EXAMPLE ```cpp -// This example toggles the debug LED (pin 13) on or off -// when a button on pin 2 is pressed. +// This example toggles the debug LED (pin 13) on or off when a button on pin 2 is pressed. // Include the Bounce2 library found here : // https://github.com/thomasfredericks/Bounce2 @@ -72,26 +61,147 @@ By defining "#define BOUNCE_WITH_PROMPT_DETECTION" in "Bounce.h" (or in your cod int ledState = LOW; -Bounce debouncer = Bounce(); // Instantiate a Bounce object +Bounce b = Bounce(); // Instantiate a Bounce object void setup() { - debouncer.attach(BUTTON_PIN,INPUT_PULLUP); // Attach the debouncer to a pin with INPUT_PULLUP mode - debouncer.interval(25); // Use a debounce interval of 25 milliseconds + b.attach(BUTTON_PIN,INPUT_PULLUP); // Attach the debouncer to a pin with INPUT_PULLUP mode + b.interval(25); // Use a debounce interval of 25 milliseconds pinMode(LED_PIN,OUTPUT); // Setup the LED - digitalWrite(LED_PIN,ledState); + digitalWrite(LED_PIN,ledState); // Turn off the LED } void loop() { - debouncer.update(); // Update the Bounce instance + b.update(); // Update the Bounce instance - if ( debouncer.fell() ) { // Call code if button transitions from HIGH to LOW + if ( b.fell() ) { // Call code if button transitions from HIGH to LOW ledState = !ledState; // Toggle LED state digitalWrite(LED_PIN,ledState); // Apply new LED state } } ``` + +## BUTTON EXAMPLE + +```cpp +/* + DESCRIPTION + ==================== + This is an example of the Bounce2::Button class. + When the user presses a physical button, it toggles a LED on or off. + The Button class matches an electrical state to a physical action. + Use .setPressedState(LOW or HIGH) to set the detection state for when the button is pressed. + + INSTRUCTIONS + ==================== + Set BUTTON_PIN to the pin attached to the button. + Set LED_PIN to the pin attached to a LED. + + */ + +// Include the Bounce2 library found here : +// https://github.com/thomasfredericks/Bounce2 +#include + +// INSTANTIATE A Button OBJECT +Bounce2::Button button = Bounce2::Button(); + +// WE WILL attach() THE BUTTON TO THE FOLLOWING PIN IN setup() +#define BUTTON_PIN 39 + +// DEFINE THE PIN FOR THE LED : +// 1) SOME BOARDS HAVE A DEFAULT LED (LED_BUILTIN) +//#define LED_PIN LED_BUILTIN +// 2) OTHERWISE SET YOUR OWN PIN +#define LED_PIN 13 + +// SET A VARIABLE TO STORE THE LED STATE +bool ledState = LOW; + +void setup() { + + // BUTTON SETUP + + // SELECT ONE OF THE FOLLOWING : + // 1) IF YOUR BUTTON HAS AN INTERNAL PULL-UP + // button.attach( BUTTON_PIN , INPUT_PULLUP ); // USE INTERNAL PULL-UP + // 2) IF YOUR BUTTON USES AN EXTERNAL PULL-UP + button.attach( BUTTON_PIN, INPUT ); // USE EXTERNAL PULL-UP + + // DEBOUNCE INTERVAL IN MILLISECONDS + button.interval(5); + + // INDICATE THAT THE LOW STATE CORRESPONDS TO PHYSICALLY PRESSING THE BUTTON + button.setPressedState(LOW); + + // LED SETUP + pinMode(LED_PIN,OUTPUT); + digitalWrite(LED_PIN,ledState); + +} + +void loop() { + // UPDATE THE BUTTON + // YOU MUST CALL THIS EVERY LOOP + button.update(); + + if ( button.pressed() ) { + + // TOGGLE THE LED STATE : + ledState = !ledState; // SET ledState TO THE OPPOSITE OF ledState + digitalWrite(LED_PIN,ledState); + + } +} +``` + + +# DOCUMENTATION + +The complete class documentation can be found in the "docs" folder or [online here](http://thomasfredericks.github.io/Bounce2/). + +## GITHUB PAGE (SOURCE CODE) + +https://github.com/thomasfredericks/Bounce2 + +# HAVE A QUESTION? + +Please post your questions [here](http://forum.arduino.cc/index.php?topic=266132.0). + + + +# ALTERNATE DEBOUNCE ALGORITHMS FOR ADVANCED USERS AND SPECIFIC CASES + + +## STABLE INTERVAL + +By default, the Bounce library uses a stable interval to process the debouncing. This is simpler to understand and can cancel unwanted noise. + +![](https://raw.github.com/thomasfredericks/Bounce-Arduino-Wiring/master/extras/BouncySwitch_stable.png) + +## LOCK-OUT INTERVAL + +By defining "#define BOUNCE_LOCK_OUT" in "Bounce.h" (or in your code before including "Bounce.h") you can activate an alternative debouncing method. This method is a lot more responsive, but does not cancel noise. + +``` +#define BOUNCE_LOCK_OUT +``` + +![](https://raw.github.com/thomasfredericks/Bounce-Arduino-Wiring/master/extras/BouncySwitch_lockout.png) + +## WITH PROMPT DETECTION + +By defining "#define BOUNCE_WITH_PROMPT_DETECTION" in "Bounce.h" (or in your code before including "Bounce.h") you can activate an alternative debouncing method. Button state changes are available immediately so long as the previous state has been stable for the timeout period. Otherwise the state will be updated as soon as the timeout period allows. + +* Able to report acurate switch time normally with no delay. +* Use when accurate switch transition timing is important. + +``` +#define BOUNCE_WITH_PROMPT_DETECTION +``` + + diff --git a/third-party/Bounce2/component.mk b/third-party/Bounce2/component.mk new file mode 100644 index 0000000..a4261c2 --- /dev/null +++ b/third-party/Bounce2/component.mk @@ -0,0 +1,2 @@ +COMPONENT_SRCDIRS := src +COMPONENT_ADD_INCLUDEDIRS := src \ No newline at end of file diff --git a/third-party/Bounce2/docs/files/_bounce2_8h_source.html b/third-party/Bounce2/docs/files/_bounce2_8h_source.html index c8928ec..b897765 100644 --- a/third-party/Bounce2/docs/files/_bounce2_8h_source.html +++ b/third-party/Bounce2/docs/files/_bounce2_8h_source.html @@ -1,9 +1,9 @@ - + - + Bounce2: src/Bounce2.h Source File @@ -29,18 +29,21 @@ - + +/* @license-end */
Bounce2.h
-
1 /*
2  The MIT License (MIT)
3 
4  Copyright (c) 2013 thomasfredericks
5 
6  Permission is hereby granted, free of charge, to any person obtaining a copy of
7  this software and associated documentation files (the "Software"), to deal in
8  the Software without restriction, including without limitation the rights to
9  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10  the Software, and to permit persons to whom the Software is furnished to do so,
11  subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in all
14  copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23 
24 /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
25  Main code by Thomas O Fredericks (tof@t-o-f.info)
26  Previous contributions by Eric Lowry, Jim Schimpf and Tom Harkaway
27  * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
28 
29 #ifndef Bounce2_h
30 #define Bounce2_h
31 
32 #if defined(ARDUINO) && ARDUINO >= 100
33 #include "Arduino.h"
34 #else
35 #include "WProgram.h"
36 #endif
37 
38 // Uncomment the following line for "LOCK-OUT" debounce method
39 //#define BOUNCE_LOCK_OUT
40 
41 // Uncomment the following line for "BOUNCE_WITH_PROMPT_DETECTION" debounce method
42 //#define BOUNCE_WITH_PROMPT_DETECTION
43 
44 #include <inttypes.h>
45 
69 class Bounce
70 {
71  public:
72 
83  Bounce();
84 
85 
95  void attach(int pin, int mode);
96 
100  void attach(int pin);
101 
102 
110  void interval(uint16_t interval_millis);
111 
112 
121  bool update();
122 
128  bool read();
129 
133  bool fell();
134 
138  bool rose();
139 
140 
144  bool risingEdge() { return rose(); }
148  bool fallingEdge() { return fell(); }
152  Bounce(uint8_t pin, unsigned long interval_millis ) : Bounce() {
153  attach(pin);
154  interval(interval_millis);
155  }
156 
165  unsigned long duration();
166 
167 
168  // WIP HELD : unsigned long held(); // Returns the duration the previous state was held
169 
170  protected:
171  unsigned long previous_millis;
172  uint16_t interval_millis;
173  uint8_t state;
174  uint8_t pin;
175  unsigned long stateChangeLastTime;
176  // WIP HELD : unsigned long durationOfPreviousState;
177  virtual bool readCurrentState() { return digitalRead(pin); }
178  virtual void setPinMode(int pin, int mode) {
179 #if defined(ARDUINO_STM_NUCLEO_F103RB) || defined(ARDUINO_GENERIC_STM32F103C)
180  pinMode(pin, (WiringPinMode)mode);
181 #else
182  pinMode(pin, mode);
183 #endif
184  }
185 
186  private:
187  inline void changeState();
188  inline void setStateFlag(const uint8_t flag) {state |= flag;}
189  inline void unsetStateFlag(const uint8_t flag) {state &= ~flag;}
190  inline void toggleStateFlag(const uint8_t flag) {state ^= flag;}
191  inline bool getStateFlag(const uint8_t flag) {return((state & flag) != 0);}
192 };
193 
194 #endif
Definition: Bounce2.h:69
-
bool read()
Returns the pin&#39;s state (HIGH or LOW).
Definition: Bounce2.cpp:127
-
void interval(uint16_t interval_millis)
Sets the debounce interval in milliseconds.
Definition: Bounce2.cpp:36
-
bool fallingEdge()
Deprecated (i.e. do not use). Included for partial compatibility for programs written with Bounce ver...
Definition: Bounce2.h:148
-
void attach(int pin, int mode)
Attach to a pin and sets that pin&#39;s mode (INPUT, INPUT_PULLUP or OUTPUT).
Definition: Bounce2.cpp:31
-
bool fell()
Returns true if pin signal transitions from high to low.
Definition: Bounce2.cpp:137
-
bool update()
Updates the pin&#39;s state.
Definition: Bounce2.cpp:41
-
bool risingEdge()
Deprecated (i.e. do not use). Included for partial compatibility for programs written with Bounce ver...
Definition: Bounce2.h:144
-
unsigned long duration()
Returns the duration in milliseconds of the current state.
Definition: Bounce2.cpp:116
-
Bounce(uint8_t pin, unsigned long interval_millis)
Deprecated (i.e. do not use). Included for partial compatibility for programs written with Bounce ver...
Definition: Bounce2.h:152
-
Bounce()
Create an instance of the Bounce class.
Definition: Bounce2.cpp:11
-
bool rose()
Returns true if pin signal transitions from low to high.
Definition: Bounce2.cpp:132
+
1 /*
+
2  The MIT License (MIT)
+
3 
+
4  Copyright (c) 2013 thomasfredericks
+
5 
+
6  Permission is hereby granted, free of charge, to any person obtaining a copy of
+
7  this software and associated documentation files (the "Software"), to deal in
+
8  the Software without restriction, including without limitation the rights to
+
9  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+
10  the Software, and to permit persons to whom the Software is furnished to do so,
+
11  subject to the following conditions:
+
12 
+
13  The above copyright notice and this permission notice shall be included in all
+
14  copies or substantial portions of the Software.
+
15 
+
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+
18  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+
19  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+
20  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+
21  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
22 */
+
23 
+
24 /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
25  Main code by Thomas O Fredericks (tof@t-o-f.info)
+
26  Previous contributions by Eric Lowry, Jim Schimpf and Tom Harkaway
+
27  * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
28 
+
29 
+
30 #ifndef Bounce2_h
+
31 #define Bounce2_h
+
32 
+
33 #if defined(ARDUINO) && ARDUINO >= 100
+
34 #include "Arduino.h"
+
35 #else
+
36 #include "WProgram.h"
+
37 #endif
+
38 
+
39 // Uncomment the following line for "LOCK-OUT" debounce method
+
40 //#define BOUNCE_LOCK_OUT
+
41 
+
42 // Uncomment the following line for "BOUNCE_WITH_PROMPT_DETECTION" debounce method
+
43 //#define BOUNCE_WITH_PROMPT_DETECTION
+
44 
+
45 #include <inttypes.h>
+
46 
+
62 class Debouncer
+
63 {
+
64  // Note : this is private as it migh change in the futur
+
65 private:
+
66  static const uint8_t DEBOUNCED_STATE = 0b00000001;
+
67  static const uint8_t UNSTABLE_STATE = 0b00000010;
+
68  static const uint8_t CHANGED_STATE = 0b00000100;
+
69 
+
70 private:
+
71  inline void changeState();
+
72  inline void setStateFlag(const uint8_t flag) {state |= flag;}
+
73  inline void unsetStateFlag(const uint8_t flag) {state &= ~flag;}
+
74  inline void toggleStateFlag(const uint8_t flag) {state ^= flag;}
+
75  inline bool getStateFlag(const uint8_t flag) {return((state & flag) != 0);}
+
76 
+
77 public:
+
83  Debouncer();
+
84 
+
92  void interval(uint16_t interval_millis);
+
93 
+
102  bool update();
+
103 
+
109  bool read();
+
110 
+
114  bool fell();
+
115 
+
119  bool rose();
+
120 
+
121 
+
122 
+
123 public:
+
129  bool changed( ) { return getStateFlag(CHANGED_STATE); }
+
130 
+
139  unsigned long duration();
+
140 
+
148  unsigned long previousDuration();
+
149 
+
150 protected:
+
151  void begin();
+
152  virtual bool readCurrentState() =0;
+
153  unsigned long previous_millis;
+
154  uint16_t interval_millis;
+
155  uint8_t state;
+
156  unsigned long stateChangeLastTime;
+
157  unsigned long durationOfPreviousState;
+
158 
+
159 };
+
160 
+
161 
+
166 class Bounce : public Debouncer
+
167 {
+
168 
+
169 
+
170 public:
+
171 
+
182  Bounce();
+
183 
+
184 
+
193  void attach(int pin, int mode);
+
194 
+
198  void attach(int pin);
+
199 
+
200  Bounce(uint8_t pin, unsigned long interval_millis ) : Bounce() {
+
201  attach(pin);
+
202  interval(interval_millis);
+
203  }
+
204 
+
206  // Deprecated //
+
208 
+
212  bool risingEdge() { return rose(); }
+
216  bool fallingEdge() { return fell(); }
+
222 protected:
+
223 
+
224 
+
225  uint8_t pin;
+
226 
+
227  virtual bool readCurrentState() { return digitalRead(pin); }
+
228  virtual void setPinMode(int pin, int mode) {
+
229 #if defined(ARDUINO_ARCH_STM32F1)
+
230  pinMode(pin, (WiringPinMode)mode);
+
231 #else
+
232  pinMode(pin, mode);
+
233 #endif
+
234  }
+
235 
+
236 
+
237 
+
238 };
+
239 
+
243 namespace Bounce2 {
+
244  // code declarations
+
245 
+
246 class Button : public Bounce{
+
247 protected:
+
248  bool stateForPressed = 1; //
+
249  public:
+
260  Button(){ }
+
261 
+
269  void setPressedState(bool state){
+
270  stateForPressed = state;
+
271  }
+
272 
+
276  inline bool getPressedState() {
+
277  return stateForPressed;
+
278  };
+
279 
+
283  inline bool isPressed() {
+
284  return read() == getPressedState();
+
285  };
+
286 
+
290  inline bool pressed() {
+
291  return changed() && isPressed();
+
292  };
+
293 
+
297  inline bool released() {
+
298  return changed() && !isPressed();
+
299  };
+
300 
+
301 };
+
302 };
+
303 
+
304 #endif
+
Definition: Bounce2.h:246
+
bool getPressedState()
Get the electrical state (HIGH/LOW) that corresponds to a physical press.
Definition: Bounce2.h:276
+
bool fell()
Returns true if pin signal transitions from high to low.
Definition: Bounce2.cpp:128
+
void interval(uint16_t interval_millis)
Sets the debounce interval in milliseconds.
Definition: Bounce2.cpp:14
+
bool read()
Returns the pin's state (HIGH or LOW).
Definition: Bounce2.cpp:118
+
Bounce()
Create an instance of the Bounce class.
Definition: Bounce2.cpp:138
+
bool changed()
Returns true if the state changed on last update.
Definition: Bounce2.h:129
+
unsigned long duration()
Returns the duration in milliseconds of the current state.
Definition: Bounce2.cpp:107
+
bool rose()
Returns true if pin signal transitions from low to high.
Definition: Bounce2.cpp:123
+
uint8_t pin
Deprecated (i.e. do not use). Included for partial compatibility for programs written with Bounce ver...
Definition: Bounce2.h:225
+
bool released()
Returns true if the button was physically released
Definition: Bounce2.h:297
+
bool isPressed()
Returns true if the button is currently physically pressed.
Definition: Bounce2.h:283
+
bool risingEdge()
Deprecated (i.e. do not use). Included for partial compatibility for programs written with Bounce ver...
Definition: Bounce2.h:212
+
bool update()
Updates the pin's state.
Definition: Bounce2.cpp:32
+
Button()
Create an instance of the Button class. By default, the pressed state is matched to a HIGH electrical...
Definition: Bounce2.h:260
+
bool pressed()
Returns true if the button was physically pressed
Definition: Bounce2.h:290
+
unsigned long previousDuration()
Returns the duration in milliseconds of the previous state.
Definition: Bounce2.cpp:103
+
The Debouncer:Bounce class. Links the Deboucing class to a hardware pin.
Definition: Bounce2.h:166
+
The Debouce class. Just the deboucing code separated from all harware.
Definition: Bounce2.h:62
+
void setPressedState(bool state)
Set the electrical state (HIGH/LOW) that corresponds to a physical press. By default,...
Definition: Bounce2.h:269
+
bool fallingEdge()
Deprecated (i.e. do not use). Included for partial compatibility for programs written with Bounce ver...
Definition: Bounce2.h:216
+
void attach(int pin, int mode)
Attach to a pin and sets that pin's mode (INPUT, INPUT_PULLUP or OUTPUT).
Definition: Bounce2.cpp:149
+
The Debouncer:Bounce:Button class. The Button class matches an electrical state to a physical action.
Definition: Bounce2.h:243
+
Debouncer()
Create an instance of the Debounce class.
Definition: Bounce2.cpp:10
diff --git a/third-party/Bounce2/docs/files/_bounce2_name_space_8h_source.html b/third-party/Bounce2/docs/files/_bounce2_name_space_8h_source.html new file mode 100644 index 0000000..f15de51 --- /dev/null +++ b/third-party/Bounce2/docs/files/_bounce2_name_space_8h_source.html @@ -0,0 +1,110 @@ + + + + + + + +Bounce2: src/Bounce2NameSpace.h Source File + + + + + + + + + +
+
+ + + + + + +
+
Bounce2 +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
Bounce2NameSpace.h
+
+
+
1 /*
+
2  The MIT License (MIT)
+
3 
+
4  Copyright (c) 2013 thomasfredericks
+
5 
+
6  Permission is hereby granted, free of charge, to any person obtaining a copy of
+
7  this software and associated documentation files (the "Software"), to deal in
+
8  the Software without restriction, including without limitation the rights to
+
9  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+
10  the Software, and to permit persons to whom the Software is furnished to do so,
+
11  subject to the following conditions:
+
12 
+
13  The above copyright notice and this permission notice shall be included in all
+
14  copies or substantial portions of the Software.
+
15 
+
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+
18  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+
19  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+
20  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+
21  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
22 */
+
23 
+
24 /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
25  Main code by Thomas O Fredericks (tof@t-o-f.info)
+
26  Previous contributions by Eric Lowry, Jim Schimpf and Tom Harkaway
+
27  * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
28 
+
29 using namespace Bounce2;
+
+
The Debouncer:Bounce:Button class. The Button class matches an electrical state to a physical action.
Definition: Bounce2.h:243
+ + + + diff --git a/third-party/Bounce2/docs/files/annotated.html b/third-party/Bounce2/docs/files/annotated.html index 0d4b415..fc3fdba 100644 --- a/third-party/Bounce2/docs/files/annotated.html +++ b/third-party/Bounce2/docs/files/annotated.html @@ -1,9 +1,9 @@ - + - + Bounce2: Class List @@ -29,18 +29,21 @@
- + +/* @license-end */ @@ -63,8 +66,11 @@ $(function() {
Here are the classes, structs, unions and interfaces with brief descriptions:
- - +
[detail level 12]
 CBounce
+ + + +
 NBounce2The Debouncer:Bounce:Button class. The Button class matches an electrical state to a physical action
 CButton
 CBounceThe Debouncer:Bounce class. Links the Deboucing class to a hardware pin
 CDebouncerThe Debouce class. Just the deboucing code separated from all harware
@@ -72,7 +78,7 @@ $(function() { diff --git a/third-party/Bounce2/docs/files/bounce2buttons_8ino-example.html b/third-party/Bounce2/docs/files/bounce2buttons_8ino-example.html index 1f7591d..dd8f9fc 100644 --- a/third-party/Bounce2/docs/files/bounce2buttons_8ino-example.html +++ b/third-party/Bounce2/docs/files/bounce2buttons_8ino-example.html @@ -62,8 +62,8 @@ $(function() {
bounce2buttons.ino
-

Example of two instances of the Bounce class that switches the debug LED when either one of the two buttons is pressed.

-
/*
DESCRIPTION
====================
Simple example of the Bounce library that switches the debug LED when
either of 2 buttons are pressed.
*/
// Include the Bounce2 library found here :
// https://github.com/thomasfredericks/Bounce2
#include <Bounce2.h>
#define BUTTON_PIN_1 2
#define BUTTON_PIN_2 3
#define LED_PIN 13
// Instantiate a Bounce object
Bounce debouncer1 = Bounce();
// Instantiate another Bounce object
Bounce debouncer2 = Bounce();
void setup() {
// Setup the first button with an internal pull-up :
pinMode(BUTTON_PIN_1,INPUT_PULLUP);
// After setting up the button, setup the Bounce instance :
debouncer1.attach(BUTTON_PIN_1);
debouncer1.interval(5); // interval in ms
// Setup the second button with an internal pull-up :
pinMode(BUTTON_PIN_2,INPUT_PULLUP);
// After setting up the button, setup the Bounce instance :
debouncer2.attach(BUTTON_PIN_2);
debouncer2.interval(5); // interval in ms
//Setup the LED :
pinMode(LED_PIN,OUTPUT);
}
void loop() {
// Update the Bounce instances :
debouncer1.update();
debouncer2.update();
// Get the updated value :
int value1 = debouncer1.read();
int value2 = debouncer2.read();
// Turn on the LED if either button is pressed :
if ( value1 == LOW || value2 == LOW ) {
digitalWrite(LED_PIN, HIGH );
}
else {
digitalWrite(LED_PIN, LOW );
}
}
+

Example of two instances of the Bounce class that switches the debug LED when either one of the two buttons is pressed.

+