Archived
1
0

rename PortRead to PortReadInterface, rename PortWrite to PortWriteInterface

This commit is contained in:
wolfv6 2016-09-03 12:11:17 -06:00
parent 9902798d63
commit a4cc38d99a
10 changed files with 30 additions and 30 deletions

View File

@ -1,16 +1,15 @@
#ifndef PORTREAD_H #ifndef PORTREADINTERFACE_H
#define PORTREAD_H #define PORTREADINTERFACE_H
#include <Arduino.h> #include <Arduino.h>
#include <inttypes.h> #include <inttypes.h>
/* /*
PortRead is an abstract base class.
Port classes are the keybrd library's interface to microcontroller ports or I/O expander ports. Port classes are the keybrd library's interface to microcontroller ports or I/O expander ports.
If your 8-bit AVR (Teensy 2) is running low on memory, using a smaller read_pins_t type saves SRAM. If your 8-bit AVR (Teensy 2) is running low on memory, using a smaller read_pins_t type saves SRAM.
Details are in config_key.h Details are in config_key.h
*/ */
class PortRead class PortReadInterface
{ {
public: public:
virtual uint8_t read()=0; virtual uint8_t read()=0;

View File

@ -3,7 +3,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <inttypes.h> #include <inttypes.h>
#include <SPI.h> #include <SPI.h>
#include <PortRead.h> #include <PortReadInterface.h>
#include "PortIOE.h" #include "PortIOE.h"
#include "Scanner_Port.h" #include "Scanner_Port.h"
@ -25,7 +25,7 @@ Example instantiation for column port 1, with pins 2 and 3 connected to columns:
readPins are read from pin 0 on up. readPins are read from pin 0 on up.
*/ */
class PortRead_MCP23S17 : public PortRead class PortRead_MCP23S17 : public PortReadInterface
{ {
private: private:
PortIOE& port; PortIOE& port;

View File

@ -3,7 +3,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <inttypes.h> #include <inttypes.h>
#include <Wire.h> #include <Wire.h>
#include <PortRead.h> #include <PortReadInterface.h>
#include "PortIOE.h" #include "PortIOE.h"
/* One PCA9655E I/O expander port connected to matrix columns. /* One PCA9655E I/O expander port connected to matrix columns.
@ -25,7 +25,7 @@ Example instantiation for column port 1, with pins 2 and 3 connected to columns:
readPins are read from pin 0 on up. readPins are read from pin 0 on up.
*/ */
class PortRead_PCA9655E : public PortRead class PortRead_PCA9655E : public PortReadInterface
{ {
private: private:
PortIOE& port; PortIOE& port;

View File

@ -1,16 +1,15 @@
#ifndef PORTWRITE_H #ifndef PORTWRITEINTERFACE_H
#define PORTWRITE_H #define PORTWRITEINTERFACE_H
#include <Arduino.h> #include <Arduino.h>
#include <inttypes.h> #include <inttypes.h>
/* /*
PortWrite is an abstract base class.
Port classes are the keybrd library's interface to microcontroller ports or I/O expander ports. Port classes are the keybrd library's interface to microcontroller ports or I/O expander ports.
If your 8-bit AVR (Teensy 2) is running low on memory, using a smaller read_pins_t type saves SRAM. If your 8-bit AVR (Teensy 2) is running low on memory, using a smaller read_pins_t type saves SRAM.
Details are in config_key.h Details are in config_key.h
*/ */
class PortWrite class PortWriteInterface
{ {
public: public:
virtual void write(const uint8_t pin, const bool level)=0; virtual void write(const uint8_t pin, const bool level)=0;

View File

@ -3,7 +3,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <inttypes.h> #include <inttypes.h>
#include <SPI.h> #include <SPI.h>
#include <PortWrite.h> #include <PortWriteInterface.h>
#include "PortIOE.h" #include "PortIOE.h"
/* One MCP23S17 I/O expander port connected to matrix rows. /* One MCP23S17 I/O expander port connected to matrix rows.
@ -33,7 +33,7 @@ MCP23S17 data sheet
http://www.onsemi.com/pub_link/Collateral/MCP23S17-D.PDF http://www.onsemi.com/pub_link/Collateral/MCP23S17-D.PDF
*/ */
class PortWrite_MCP23S17 : public PortWrite class PortWrite_MCP23S17 : public PortWriteInterface
{ {
private: private:
PortIOE& port; PortIOE& port;

View File

@ -3,7 +3,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <inttypes.h> #include <inttypes.h>
#include <Wire.h> #include <Wire.h>
#include <PortWrite.h> #include <PortWriteInterface.h>
#include "PortIOE.h" #include "PortIOE.h"
/* One PCA9655E I/O expander port connected to matrix rows. /* One PCA9655E I/O expander port connected to matrix rows.
@ -33,7 +33,7 @@ PCA9655E data sheet
http://www.onsemi.com/pub_link/Collateral/PCA9655E-D.PDF http://www.onsemi.com/pub_link/Collateral/PCA9655E-D.PDF
*/ */
class PortWrite_PCA9655E : public PortWrite class PortWrite_PCA9655E : public PortWriteInterface
{ {
private: private:
PortIOE& port; PortIOE& port;

View File

@ -4,8 +4,8 @@
#include <Row.h> #include <Row.h>
#include <Scanner_Port.h> #include <Scanner_Port.h>
#include <Debouncer_Samples.h> #include <Debouncer_Samples.h>
class PortWrite; class PortWriteInterface;
class PortRead; class PortReadInterface;
/* Row_IOE is a row connected to an Input/Output Expander. /* Row_IOE is a row connected to an Input/Output Expander.
Configuration and Instantiation instructions are in keybrd/src/Row_IOE.h Configuration and Instantiation instructions are in keybrd/src/Row_IOE.h
@ -17,8 +17,8 @@ class Row_IOE : public Row
Debouncer_Samples debouncer; Debouncer_Samples debouncer;
const uint8_t readPinCount; //number of read pins const uint8_t readPinCount; //number of read pins
public: public:
Row_IOE(PortWrite& refPortWrite, const uint8_t strobePin, Row_IOE(PortWriteInterface& refPortWrite, const uint8_t strobePin,
PortRead& refPortRead, const uint8_t readPinCount, Key *const ptrsKeys[]) PortReadInterface& refPortRead, const uint8_t readPinCount, Key *const ptrsKeys[])
: Row(ptrsKeys), scanner(refPortWrite, strobePin, refPortRead), : Row(ptrsKeys), scanner(refPortWrite, strobePin, refPortRead),
readPinCount(readPinCount) { } readPinCount(readPinCount) { }
void process(); void process();

View File

@ -3,8 +3,8 @@
#include <Arduino.h> #include <Arduino.h>
#include <inttypes.h> #include <inttypes.h>
#include <PortWrite.h> #include <PortWriteInterface.h>
#include <PortRead.h> #include <PortReadInterface.h>
/* Scanner_Port uses bit manipulation to read all pins of one port. /* Scanner_Port uses bit manipulation to read all pins of one port.
The ports are normally from an I/O Expander, but could also be ports from an AVR uC. The ports are normally from an I/O Expander, but could also be ports from an AVR uC.
@ -17,12 +17,14 @@ class Scanner_Port
private: private:
static const bool STROBE_ON; //HIGH or LOW logic level of strobe on, active state static const bool STROBE_ON; //HIGH or LOW logic level of strobe on, active state
static const bool STROBE_OFF; //logic level of strobe off, complement of STROBE_ON static const bool STROBE_OFF; //logic level of strobe off, complement of STROBE_ON
PortWrite& refPortWrite; //the IC port containing the strobePin PortWriteInterface& refPortWrite; //the IC port containing the strobePin
const uint8_t strobePin; //bitwise, 1 indicates IC pin connected to this row const uint8_t strobePin; //bitwise, 1 indicates IC pin connected to this row
PortRead& refPortRead; //the IC's read port PortReadInterface& refPortRead; //the IC's read port
public: public:
Scanner_Port(PortWrite &refPortWrite, const uint8_t strobePin, PortRead& refPortRead) Scanner_Port(PortWriteInterface &refPortWrite, const uint8_t strobePin,
: refPortWrite(refPortWrite), strobePin(strobePin), refPortRead(refPortRead) {} PortReadInterface& refPortRead)
: refPortWrite(refPortWrite), strobePin(strobePin),
refPortRead(refPortRead) {}
uint8_t scan(); uint8_t scan();
}; };
#endif #endif

View File

@ -5,8 +5,8 @@
#include <inttypes.h> #include <inttypes.h>
#include <config_keybrd.h> #include <config_keybrd.h>
#include <SPI.h> #include <SPI.h>
#include <PortWrite.h> #include <PortWriteInterface.h>
#include <PortRead.h> #include <PortReadInterface.h>
/* Scanner_ShiftRegs74HC165 reads shift registers. /* Scanner_ShiftRegs74HC165 reads shift registers.
shift registers 74HC165 are Parallel-In-Serial-Out (PISO) shift registers 74HC165 are Parallel-In-Serial-Out (PISO)

View File

@ -4,8 +4,8 @@
#include <Arduino.h> #include <Arduino.h>
#include <inttypes.h> #include <inttypes.h>
#include <config_keybrd.h> #include <config_keybrd.h>
#include <PortWrite.h> #include <PortWriteInterface.h>
#include <PortRead.h> #include <PortReadInterface.h>
/* Scanner_uC class uses Arduino pin numbers (not port pin numbers). /* Scanner_uC class uses Arduino pin numbers (not port pin numbers).
Constructor is in Scanner_uC.cpp Constructor is in Scanner_uC.cpp