Archived
1
0

remove RowScannerInterface, add KEY_COUNT, change COL_PIN_L_COUNT to KEY_COUNT

This commit is contained in:
wolfv6 2016-07-07 15:31:34 -06:00
parent 4945f577a4
commit 2887eeaa61
7 changed files with 9 additions and 31 deletions

View File

@ -19,7 +19,6 @@ The keybrd library is flexible for designing custom Rows
this example illustrates the custom Row classes for a fictional keybrd_Ext extension library
the keybrd_Ext library is for a split keyboard with a matrix on each hand
other custom Row classes would have a similar structure
Row_Ext::keyWasPressed() overrides RowBase::keyWasPressed()
Row_Ext::keyWasPressed() is used to unstick sticky keys
@ -38,8 +37,6 @@ Class inheritance diagram
Row_Ext_uC Row_Ext_ShiftRegisters (inherit Row_Ext::keyWasPressed() )
RowScannerInterface
/ \
RowScanner_PinsArray RowScanner_SPIShiftRegisters
```
@ -70,8 +67,7 @@ Keybrd library class inheritance diagram
/ | \
Row_uC Row_ShiftRegisters Row_IOE
_____ RowScannerInterface ______
/ | \
RowScanner_PinsArray RowScanner_PinsBitwise RowScanner_SPIShiftRegisters

View File

@ -1,16 +0,0 @@
#ifndef ROWSCANNERINTERFACE_H
#define ROWSCANNERINTERFACE_H
#include <Arduino.h>
#include <inttypes.h>
#include <config_keybrd.h>
class RowScannerInterface
{
public:
// virtual read_pins_t scan(read_pins_mask_t& rowEnd)=0;
// todo, remove RowScannerInterface because
// some RowScanners will return ColPort e.g. RowScanner_PinsBitwise
};
#endif

View File

@ -3,7 +3,6 @@
#include <Arduino.h>
#include <inttypes.h>
#include <config_keybrd.h>
#include <RowScannerInterface.h>
#include <RowPort.h>
#include <ColPort.h>
@ -11,7 +10,7 @@
The maximum keys per row is 31, because Arduino's largest type is 32 bits and rowEnd consumes the last bit.
Constructor is in RowScanner_PinsArray.cpp
*/
class RowScanner_PinsArray : public RowScannerInterface
class RowScanner_PinsArray
{
private:
static const bool ACTIVE_HIGH; //logic level of strobe pin: 0=activeLow, 1=activeHigh

View File

@ -2,14 +2,13 @@
#define ROWSCANNER_PINSBITWISE_H
#include <Arduino.h>
#include <inttypes.h>
#include <RowScannerInterface.h>
#include <RowPort.h>
#include <ColPort.h>
/* RowScanner_PinsBitwise uses bit manipulation to read all pins of one port.
The maximum keys per row is 8, because ports have a maximum of 8 pins each.
*/
class RowScanner_PinsBitwise : public RowScannerInterface
class RowScanner_PinsBitwise
{
private:
RowPort& refRowPort; //this row's IC port

View File

@ -2,8 +2,8 @@
#define ROWSCANNER_SPI_SHIFTREGISTERS_H
#include <Arduino.h>
#include <inttypes.h>
#include <config_keybrd.h>
#include <SPI.h>
#include <RowScannerInterface.h>
#include <RowPort.h>
#include <ColPort.h>
@ -28,7 +28,7 @@ The two parts of a split keyboard can be connected by one of:
* Ethernet cable (has 8 wires, good for 3 rows)
*/
class RowScanner_SPIShiftRegisters : public RowScannerInterface
class RowScanner_SPIShiftRegisters
{
private:
static const uint8_t SHIFT_LOAD; //controller's pin number that is connected to shift register's SHIFT_LOAD pin

View File

@ -39,7 +39,7 @@ class Row_IOE : public RowBase
Debouncer_4Samples debouncer;
public:
Row_IOE( RowPort& refRowPort, const uint8_t strobePin,
ColPort& refColPort, Key *const ptrsKeys[], const uint8_t KEY_COUNT)
ColPort& refColPort, Key *const ptrsKeys[], const uint8_t KEY_COUNT) //todo if KEY_COUNT is passed in, store it in private
: RowBase(ptrsKeys), scanner(refRowPort, strobePin, refColPort) { }
void process();
uint8_t getRowState(ColPort* ptrColPort, uint8_t& KEY_COUNT);

View File

@ -32,9 +32,9 @@ class Row_uC : public RowBase
RowScanner_PinsArray scanner;
Debouncer_4Samples debouncer;
public:
Row_uC(const uint8_t strobePin, const uint8_t readPins[], const uint8_t READ_PIN_COUNT,
Key *const ptrsKeys[])
: RowBase(ptrsKeys), scanner(strobePin, readPins, READ_PIN_COUNT) { }
Row_uC(const uint8_t strobePin, const uint8_t readPins[],
Key *const ptrsKeys[], const uint8_t KEY_COUNT)
: RowBase(ptrsKeys), scanner(strobePin, readPins, KEY_COUNT) { }
void process();
};
#endif