2016-07-12 13:23:24 +00:00
# ifndef ROW_H
# define ROW_H
2016-07-14 23:28:16 +00:00
2016-05-09 14:05:08 +00:00
# include <Arduino.h>
# include <inttypes.h>
2016-06-22 02:40:35 +00:00
# include <config_keybrd.h>
2016-05-09 14:05:08 +00:00
# include <Key.h>
2016-09-05 20:09:59 +00:00
# include <ScannerInterface.h>
# include <Debouncer_Samples.h>
2016-09-17 05:45:12 +00:00
# include <Debouncer_Not.h>
2016-05-09 14:05:08 +00:00
2016-09-05 20:09:59 +00:00
/*
strobePin has one of two formats :
2016-11-12 16:45:48 +00:00
* if strobe pin is on uC ( strobe for Scanner_uC or Scanner_ShiftRegsRead ) ,
2016-10-31 23:43:53 +00:00
then strobePin is an Arduino pin number connected to this row .
2016-11-12 16:45:48 +00:00
* if strobe pin is on I / O expander ( strobe for Scanner_IOE ) , then strobePin is bit pattern ,
2016-10-31 23:43:53 +00:00
1 indicating the I / O expander pin connected to this row
2016-05-09 14:05:08 +00:00
*/
2016-07-12 13:23:24 +00:00
class Row
2016-05-09 14:05:08 +00:00
{
private :
2016-09-08 03:27:51 +00:00
virtual void keyWasPressed ( ) ;
protected :
2016-09-12 06:28:27 +00:00
void send ( const uint8_t keyCount , const read_pins_t debouncedChanged ) ;
2016-09-05 20:09:59 +00:00
ScannerInterface & refScanner ;
const uint8_t strobePin ; //pin connected to this row (details above)
2016-09-08 03:27:51 +00:00
private :
2016-07-04 03:26:38 +00:00
Key * const * const ptrsKeys ; //array of Key pointers
2016-09-08 03:27:51 +00:00
protected :
2016-09-12 06:28:27 +00:00
const uint8_t keyCount ; //number of read pins
2016-09-17 05:45:12 +00:00
//Debouncer_Samples debouncer;
2016-11-12 16:45:48 +00:00
Debouncer_Not debouncer ; //todo restore Debouncer_Samples after testing
2016-09-17 21:47:37 +00:00
read_pins_t debounced ; //bit pattern, state of keys after debouncing, 1=pressed, 0=released
2016-05-09 14:05:08 +00:00
public :
2016-09-05 20:09:59 +00:00
Row ( ScannerInterface & refScanner , const uint8_t strobePin ,
2016-09-28 20:37:40 +00:00
Key * const ptrsKeys [ ] , const uint8_t keyCount ) ;
2016-09-08 03:27:51 +00:00
virtual void process ( ) ;
2016-05-09 14:05:08 +00:00
} ;
# endif