Browse Source

remove RowScannerInterface, add KEY_COUNT, change COL_PIN_L_COUNT to KEY_COUNT

tags/v0.5.0
wolfv6 8 years ago
parent
commit
2887eeaa61

+ 1
- 5
doc/keybrd_library_developer_guide.md View File

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
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
``` ```
/ | \ / | \
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

+ 0
- 16
src/RowScannerInterface.h View File

#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


+ 1
- 2
src/RowScanner_PinsArray.h View File

#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>


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

+ 1
- 2
src/RowScanner_PinsBitwise.h View File

#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
- 2
src/RowScanner_SPIShiftRegisters.h View File

#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>


* 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

+ 1
- 1
src/Row_IOE.h View File

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);

+ 3
- 3
src/Row_uC.h View File

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,
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(); void process();
}; };
#endif #endif