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

29 lines
938 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 <config_keybrd.h>
2016-05-09 14:05:08 +00:00
#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:
read_pins_t debounced; //bitwise, 1 means pressed, 0 means released
2016-06-02 16:26:53 +00:00
void wait();
void pressRelease(const read_pins_mask_t rowEnd, const read_pins_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 read_pins_t scan(read_pins_mask_t& rowEnd)=0;
virtual read_pins_t debounce(const read_pins_t rowState, read_pins_t& debounced)=0;
2016-05-09 14:05:08 +00:00
};
#endif