Archived
1
0
This repo is archived. You can view files and clone it, but cannot push or open issues or pull requests.
keybrd/src/RowBase.h

26 lines
761 B
C++

#ifndef ROWBASE_H
#define ROWBASE_H
#include <Arduino.h>
#include <inttypes.h>
#include <Key.h>
/* RowBase is an abstract base class.
*/
class RowBase
{
private:
static const unsigned int DELAY_MICROSECONDS; //delay between each Row scan for debouncing
Key *const *const ptrsKeys; //array of Key pointers
virtual void keyWasPressed();
protected:
uint8_t debounced; //bitwise, 1 means pressed, 0 means released
void wait();
void pressRelease(const uint16_t rowEnd, const uint8_t debouncedChanged);
public:
RowBase(Key *const ptrsKeys[]) : ptrsKeys(ptrsKeys), debounced(0) { }
virtual void process(const bool activeHigh)=0;
};
#endif