remove RowScannerInterface, add KEY_COUNT, change COL_PIN_L_COUNT to KEY_COUNT
This commit is contained in:
parent
4945f577a4
commit
2887eeaa61
@ -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
|
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
|
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() overrides RowBase::keyWasPressed()
|
||||||
Row_Ext::keyWasPressed() is used to unstick sticky keys
|
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() )
|
Row_Ext_uC Row_Ext_ShiftRegisters (inherit Row_Ext::keyWasPressed() )
|
||||||
|
|
||||||
|
|
||||||
RowScannerInterface
|
|
||||||
/ \
|
|
||||||
RowScanner_PinsArray RowScanner_SPIShiftRegisters
|
RowScanner_PinsArray RowScanner_SPIShiftRegisters
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -70,8 +67,7 @@ Keybrd library class inheritance diagram
|
|||||||
/ | \
|
/ | \
|
||||||
Row_uC Row_ShiftRegisters Row_IOE
|
Row_uC Row_ShiftRegisters Row_IOE
|
||||||
|
|
||||||
_____ RowScannerInterface ______
|
|
||||||
/ | \
|
|
||||||
RowScanner_PinsArray RowScanner_PinsBitwise RowScanner_SPIShiftRegisters
|
RowScanner_PinsArray RowScanner_PinsBitwise RowScanner_SPIShiftRegisters
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <config_keybrd.h>
|
#include <config_keybrd.h>
|
||||||
#include <RowScannerInterface.h>
|
|
||||||
#include <RowPort.h>
|
#include <RowPort.h>
|
||||||
#include <ColPort.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.
|
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
|
Constructor is in RowScanner_PinsArray.cpp
|
||||||
*/
|
*/
|
||||||
class RowScanner_PinsArray : public RowScannerInterface
|
class RowScanner_PinsArray
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static const bool ACTIVE_HIGH; //logic level of strobe pin: 0=activeLow, 1=activeHigh
|
static const bool ACTIVE_HIGH; //logic level of strobe pin: 0=activeLow, 1=activeHigh
|
||||||
|
@ -2,14 +2,13 @@
|
|||||||
#define ROWSCANNER_PINSBITWISE_H
|
#define ROWSCANNER_PINSBITWISE_H
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <RowScannerInterface.h>
|
|
||||||
#include <RowPort.h>
|
#include <RowPort.h>
|
||||||
#include <ColPort.h>
|
#include <ColPort.h>
|
||||||
|
|
||||||
/* RowScanner_PinsBitwise uses bit manipulation to read all pins of one port.
|
/* 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.
|
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:
|
private:
|
||||||
RowPort& refRowPort; //this row's IC port
|
RowPort& refRowPort; //this row's IC port
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define ROWSCANNER_SPI_SHIFTREGISTERS_H
|
#define ROWSCANNER_SPI_SHIFTREGISTERS_H
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <config_keybrd.h>
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <RowScannerInterface.h>
|
|
||||||
#include <RowPort.h>
|
#include <RowPort.h>
|
||||||
#include <ColPort.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)
|
* Ethernet cable (has 8 wires, good for 3 rows)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class RowScanner_SPIShiftRegisters : public RowScannerInterface
|
class RowScanner_SPIShiftRegisters
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static const uint8_t SHIFT_LOAD; //controller's pin number that is connected to shift register's SHIFT_LOAD pin
|
static const uint8_t SHIFT_LOAD; //controller's pin number that is connected to shift register's SHIFT_LOAD pin
|
||||||
|
@ -39,7 +39,7 @@ class Row_IOE : public RowBase
|
|||||||
Debouncer_4Samples debouncer;
|
Debouncer_4Samples debouncer;
|
||||||
public:
|
public:
|
||||||
Row_IOE( RowPort& refRowPort, const uint8_t strobePin,
|
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) { }
|
: RowBase(ptrsKeys), scanner(refRowPort, strobePin, refColPort) { }
|
||||||
void process();
|
void process();
|
||||||
uint8_t getRowState(ColPort* ptrColPort, uint8_t& KEY_COUNT);
|
uint8_t getRowState(ColPort* ptrColPort, uint8_t& KEY_COUNT);
|
||||||
|
@ -32,9 +32,9 @@ class Row_uC : public RowBase
|
|||||||
RowScanner_PinsArray scanner;
|
RowScanner_PinsArray scanner;
|
||||||
Debouncer_4Samples debouncer;
|
Debouncer_4Samples debouncer;
|
||||||
public:
|
public:
|
||||||
Row_uC(const uint8_t strobePin, const uint8_t readPins[], const uint8_t READ_PIN_COUNT,
|
Row_uC(const uint8_t strobePin, const uint8_t readPins[],
|
||||||
Key *const ptrsKeys[])
|
Key *const ptrsKeys[], const uint8_t KEY_COUNT)
|
||||||
: RowBase(ptrsKeys), scanner(strobePin, readPins, READ_PIN_COUNT) { }
|
: RowBase(ptrsKeys), scanner(strobePin, readPins, KEY_COUNT) { }
|
||||||
void process();
|
void process();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user