Quellcode durchsuchen

rename PortRead to PortReadInterface, rename PortWrite to PortWriteInterface

tags/v0.6.0
wolfv6 vor 7 Jahren
Ursprung
Commit
a4cc38d99a

src/PortRead.h → src/PortReadInterface.h Datei anzeigen

#ifndef PORTREAD_H
#define PORTREAD_H
#ifndef PORTREADINTERFACE_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;

+ 2
- 2
src/PortRead_MCP23S17.h Datei anzeigen

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

+ 2
- 2
src/PortRead_PCA9655E.h Datei anzeigen

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

src/PortWrite.h → src/PortWriteInterface.h Datei anzeigen

#ifndef PORTWRITE_H
#define PORTWRITE_H
#ifndef PORTWRITEINTERFACE_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;

+ 2
- 2
src/PortWrite_MCP23S17.h Datei anzeigen

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

+ 2
- 2
src/PortWrite_PCA9655E.h Datei anzeigen

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

+ 4
- 4
src/Row_IOE.h Datei anzeigen

#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 PortRead;
class PortWriteInterface;
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
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,
PortRead& refPortRead, const uint8_t readPinCount, Key *const ptrsKeys[])
Row_IOE(PortWriteInterface& refPortWrite, const uint8_t strobePin,
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();

+ 8
- 6
src/Scanner_Port.h Datei anzeigen



#include <Arduino.h> #include <Arduino.h>
#include <inttypes.h> #include <inttypes.h>
#include <PortWrite.h>
#include <PortRead.h>
#include <PortWriteInterface.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.
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)
: refPortWrite(refPortWrite), strobePin(strobePin), refPortRead(refPortRead) {}
Scanner_Port(PortWriteInterface &refPortWrite, const uint8_t strobePin,
PortReadInterface& refPortRead)
: refPortWrite(refPortWrite), strobePin(strobePin),
refPortRead(refPortRead) {}
uint8_t scan(); uint8_t scan();
}; };
#endif #endif

+ 2
- 2
src/Scanner_ShiftRegs74HC165.h Datei anzeigen

#include <inttypes.h> #include <inttypes.h>
#include <config_keybrd.h> #include <config_keybrd.h>
#include <SPI.h> #include <SPI.h>
#include <PortWrite.h>
#include <PortRead.h>
#include <PortWriteInterface.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)

+ 2
- 2
src/Scanner_uC.h Datei anzeigen

#include <Arduino.h> #include <Arduino.h>
#include <inttypes.h> #include <inttypes.h>
#include <config_keybrd.h> #include <config_keybrd.h>
#include <PortWrite.h>
#include <PortRead.h>
#include <PortWriteInterface.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