2016-05-31 12:36:51 +00:00
|
|
|
#ifndef ROWBASE_H
|
|
|
|
#define ROWBASE_H
|
2016-05-09 14:05:08 +00:00
|
|
|
#include <Arduino.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <Key.h>
|
|
|
|
|
2016-06-02 15:58:33 +00:00
|
|
|
/* RowBase is an abstract base class.
|
2016-06-09 19:29:31 +00:00
|
|
|
|
|
|
|
Define and initilize DELAY_MICROSECONDS in sketch.
|
|
|
|
const unsigned int RowBase::DELAY_MICROSECONDS = 0;
|
2016-05-09 14:05:08 +00:00
|
|
|
*/
|
2016-05-31 12:36:51 +00:00
|
|
|
class RowBase
|
2016-05-09 14:05:08 +00:00
|
|
|
{
|
|
|
|
private:
|
2016-06-02 16:26:53 +00:00
|
|
|
static const unsigned int DELAY_MICROSECONDS; //delay between each Row scan for debouncing
|
2016-05-09 14:05:08 +00:00
|
|
|
Key *const *const ptrsKeys; //array of Key pointers
|
|
|
|
|
2016-06-05 22:16:47 +00:00
|
|
|
virtual void keyWasPressed();
|
|
|
|
protected:
|
|
|
|
uint8_t debounced; //bitwise, 1 means pressed, 0 means released
|
|
|
|
|
2016-06-02 16:26:53 +00:00
|
|
|
void wait();
|
2016-06-01 19:04:46 +00:00
|
|
|
void pressRelease(const uint16_t rowEnd, const uint8_t debouncedChanged);
|
2016-05-09 14:05:08 +00:00
|
|
|
public:
|
2016-06-06 04:00:33 +00:00
|
|
|
RowBase(Key *const ptrsKeys[]) : ptrsKeys(ptrsKeys), debounced(0) { }
|
2016-06-06 06:52:14 +00:00
|
|
|
virtual void process()=0;
|
2016-05-09 14:05:08 +00:00
|
|
|
};
|
|
|
|
#endif
|