2016-07-14 23:28:16 +00:00
|
|
|
#ifndef DEBOUNCER_SAMPLES_H
|
|
|
|
#define DEBOUNCER_SAMPLES_H
|
|
|
|
|
2016-06-03 06:12:29 +00:00
|
|
|
#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>
|
|
|
|
|
2016-07-14 10:47:23 +00:00
|
|
|
/* Debouncer_Samples
|
2016-07-15 05:15:38 +00:00
|
|
|
Configuration: #define SAMPLE_COUNT_MACRO in config_keybrd.h
|
2016-06-03 06:12:29 +00:00
|
|
|
*/
|
2016-07-14 10:47:23 +00:00
|
|
|
class Debouncer_Samples : public DebouncerInterface
|
2016-06-03 06:12:29 +00:00
|
|
|
{
|
|
|
|
private:
|
2016-07-15 05:15:38 +00:00
|
|
|
read_pins_t samples[SAMPLE_COUNT_MACRO]; //bitwise, one bit per key, most recent readings
|
2016-06-03 06:12:29 +00:00
|
|
|
uint8_t samplesIndex; //samples[] current write index
|
|
|
|
public:
|
2016-07-14 10:47:23 +00:00
|
|
|
Debouncer_Samples(): 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
|
|
|
|
|