This repo is archived. You can view files and clone it, but cannot push or open issues or pull requests.
2016-06-03 06:12:29 +00:00
|
|
|
#ifndef DEBOUNCER_4SAMPLES_H
|
|
|
|
#define DEBOUNCER_4SAMPLES_H
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include <inttypes.h>
|
2016-06-22 02:40:35 +00:00
|
|
|
#include <config_keybrd.h>
|
2016-06-03 06:12:29 +00:00
|
|
|
#include <DebouncerInterface.h>
|
|
|
|
|
|
|
|
/* Debouncer_4Samples
|
2016-06-22 02:40:35 +00:00
|
|
|
Configuration: #define SAMPLE_COUNT in config_keybrd.h
|
2016-06-03 06:12:29 +00:00
|
|
|
*/
|
|
|
|
class Debouncer_4Samples : public DebouncerInterface
|
|
|
|
{
|
|
|
|
private:
|
2016-06-22 02:40:35 +00:00
|
|
|
read_pins_t samples[SAMPLE_COUNT]; //bitwise, one bit per key, most recent readings
|
2016-06-03 06:12:29 +00:00
|
|
|
uint8_t samplesIndex; //samples[] current write index
|
|
|
|
public:
|
|
|
|
Debouncer_4Samples(): samplesIndex(0) {}
|
2016-06-22 02:40:35 +00:00
|
|
|
virtual read_pins_t debounce(const read_pins_t rawSignal, read_pins_t& debounced);
|
2016-06-03 06:12:29 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|