This repo is archived. You can view files and clone it, but cannot push or open issues or pull requests.
2016-07-02 21:10:02 +00:00
|
|
|
#include "Debouncer_Not.h"
|
|
|
|
|
2016-09-17 05:45:12 +00:00
|
|
|
/* debounce() sets debounced and returns debouncedChanged.
|
|
|
|
All parameters and variables are bitwise.
|
2016-07-02 21:10:02 +00:00
|
|
|
For parameters, 1 means pressed, 0 means released.
|
|
|
|
For return, 1 means debounced changed.
|
|
|
|
*/
|
|
|
|
read_pins_t Debouncer_Not::debounce(const read_pins_t rawSignal, read_pins_t& debounced)
|
|
|
|
{
|
|
|
|
read_pins_t previousDebounced; //bitwise, 1 means pressed, 0 means released
|
|
|
|
|
|
|
|
previousDebounced = debounced;
|
|
|
|
debounced = rawSignal;
|
|
|
|
return debounced xor previousDebounced;
|
|
|
|
}
|
|
|
|
|