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

28 lines
870 B
C
Raw Normal View History

#ifndef ROWBASE_H
#define ROWBASE_H
2016-05-09 14:05:08 +00:00
#include <Arduino.h>
#include <inttypes.h>
#include <Key.h>
/* RowBase is an abstract base class.
2016-05-09 14:05:08 +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
virtual void keyWasPressed();
protected:
uint8_t debounced; //bitwise, 1 means pressed, 0 means released
2016-06-02 16:26:53 +00:00
void wait();
void pressRelease(const uint16_t rowEnd, const uint8_t debouncedChanged);
2016-05-09 14:05:08 +00:00
public:
RowBase(Key *const ptrsKeys[]) : ptrsKeys(ptrsKeys), debounced(0) { }
2016-06-10 03:11:18 +00:00
virtual void process();
virtual uint8_t scan(uint16_t& rowEnd)=0;
virtual uint8_t debounce(const uint8_t rowState, uint8_t& debounced)=0;
2016-05-09 14:05:08 +00:00
};
#endif