Added pinMode setting to attach

Added possibility to attach the pin and auto set the pinMode. Attach and
pinMode can now be done in 1 step. just call Bounce.attach(pin,
INPUT_PULLUP) etc Fixed Header file and made all mode possible.
This commit is contained in:
sseptillion
2015-09-08 12:29:48 +02:00
parent 50b796ccfc
commit 2d6327e91c
2 changed files with 5 additions and 7 deletions
+2 -7
View File
@@ -33,13 +33,8 @@ void Bounce::attach(int pin) {
#endif
}
void Bounce::attach(int pin, byte mode){
if(mode == INPUT_PULLUP){
pinMode(pin, INPUT_PULLUP);
}
else{
pinMode(pin, INPUT);
}
void Bounce::attach(int pin, int mode){
pinMode(pin, mode);
this->attach(pin);
}
+3
View File
@@ -47,6 +47,9 @@ class Bounce
// Attach to a pin (and also sets initial state)
void attach(int pin);
// Attach to a pin (and also sets initial state) and sets pin to mode (INPUT/INPUT_PULLUP/OUTPUT)
void attach(int pin, int mode);
// Sets the debounce interval
void interval(uint16_t interval_millis);