Archived
1
0

remove ReadPort::getColPins() and StrobePort::setActivePinHigh() setActivePinLow()

This commit is contained in:
wolfv6 2016-07-13 07:31:31 -06:00
parent d5cd8e958b
commit f76ec3002d
6 changed files with 4 additions and 52 deletions

View File

@ -1,7 +0,0 @@
#include "ReadPort.h"
uint8_t ReadPort::getColPins()
{
return readPins;
}

View File

@ -17,6 +17,5 @@ class ReadPort
//read port and store it's pins values in portState //read port and store it's pins values in portState
virtual uint8_t read()=0; virtual uint8_t read()=0;
uint8_t getColPins();
}; };
#endif #endif

View File

@ -6,14 +6,6 @@ uint8_t Scanner_Port::scan()
{ {
uint8_t readState; uint8_t readState;
/*if (STROBE_ON == LOW) //if activeLow
{
refStrobePort.setActivePinLow(strobePin);
}
else //if activeHigh
{
refStrobePort.setActivePinHigh(strobePin);
}*/
//strobe row on //strobe row on
refStrobePort.write(STROBE_PIN, STROBE_ON); refStrobePort.write(STROBE_PIN, STROBE_ON);
delayMicroseconds(3); //time to stablize voltage delayMicroseconds(3); //time to stablize voltage
@ -23,14 +15,6 @@ uint8_t Scanner_Port::scan()
//strobe row off //strobe row off
refStrobePort.write(STROBE_PIN, STROBE_OFF); refStrobePort.write(STROBE_PIN, STROBE_OFF);
/*if (STROBE_ON == LOW) //if activeLow
{
refStrobePort.setActivePinHigh(strobePin);
}
else //if activeHigh
{
refStrobePort.setActivePinLow(strobePin);
}*/
//return refReadPort.getPortState(); //return refReadPort.getPortState();
return readState; return readState;

View File

@ -10,8 +10,6 @@ Port classes are the keybrd library's interface to microcontoller ports or I/O e
class StrobePort class StrobePort
{ {
public: public:
virtual void setActivePinHigh(const uint8_t activePin)=0;
virtual void setActivePinLow(const uint8_t activePin)=0;
virtual void write(const uint8_t pin, const bool level)=0; virtual void write(const uint8_t pin, const bool level)=0;
}; };
#endif #endif

View File

@ -15,38 +15,18 @@ void StrobePort_PCA9655E::begin()
} }
/* /*
sets activePin pin output to low, does not reset the other pins because they might be used by LEDs. pin is bitwise, where pin being strobed is 1.
activePin is port mask, where active pin is 1. level is HIGH or LOW.
*/ */
void StrobePort_PCA9655E::setActivePinLow(const uint8_t activePin)
{
Wire.beginTransmission(port.ADDR);
Wire.write(outputByteCommand);
Wire.write(port.outputVal &= ~activePin);
Wire.endTransmission();
}
/*
sets activePin pin output to high.
activePin is port mask, where active pin is 1.
*/
void StrobePort_PCA9655E::setActivePinHigh(const uint8_t activePin)
{
Wire.beginTransmission(port.ADDR);
Wire.write(outputByteCommand);
Wire.write(port.outputVal |= activePin);
Wire.endTransmission();
//todo delayMicroseconds(1500); still 4*bb w/o debouncer prints IOE rows sporadically
}
void StrobePort_PCA9655E::write(const uint8_t pin, const bool level) void StrobePort_PCA9655E::write(const uint8_t pin, const bool level)
{ {
if (level == LOW) if (level == LOW)
{ {
port.outputVal &= ~pin; port.outputVal &= ~pin; //set pin output to low, do not reset the other pins because LEDs
} }
else else
{ {
port.outputVal |= pin; port.outputVal |= pin; //set pin output to high
} }
Wire.beginTransmission(port.ADDR); Wire.beginTransmission(port.ADDR);

View File

@ -44,8 +44,6 @@ class StrobePort_PCA9655E : public StrobePort
StrobePort_PCA9655E(IOEPort& port); StrobePort_PCA9655E(IOEPort& port);
void begin(); void begin();
virtual void setActivePinLow(const uint8_t activePin); //activePin is a port mask todo delete
virtual void setActivePinHigh(const uint8_t activePin); //todo delete also in StrobePort.h
virtual void write(const uint8_t pin, const bool level); virtual void write(const uint8_t pin, const bool level);
}; };
#endif #endif