rename setHigh() setLow() to writeHigh() writeLow()
This commit is contained in:
parent
b149a831de
commit
a3f2261625
@ -2,10 +2,10 @@
|
||||
|
||||
void LED_Port::on()
|
||||
{
|
||||
refPort.setHigh(pin);
|
||||
refPort.writeHigh(pin);
|
||||
}
|
||||
|
||||
void LED_Port::off()
|
||||
{
|
||||
refPort.setLow(pin);
|
||||
refPort.writeLow(pin);
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ class PortInterface : public PortWriteInterface
|
||||
public:
|
||||
virtual void beginProtocol()=0; //SPI bus or I2C bus
|
||||
virtual void begin(const uint8_t activeState)=0; //configure GPIO pins
|
||||
virtual void setLow(const uint8_t pin)=0;
|
||||
virtual void setHigh(const uint8_t pin)=0;
|
||||
virtual void writeLow(const uint8_t pin)=0;
|
||||
virtual void writeHigh(const uint8_t pin)=0;
|
||||
virtual uint8_t read()=0;
|
||||
};
|
||||
#endif
|
||||
|
@ -14,7 +14,7 @@ write() interface emulates Arduino's digitalWrite().
|
||||
class PortWriteInterface
|
||||
{
|
||||
public:
|
||||
virtual void setLow(const uint8_t pin)=0;
|
||||
virtual void setHigh(const uint8_t pin)=0;
|
||||
virtual void writeLow(const uint8_t pin)=0;
|
||||
virtual void writeHigh(const uint8_t pin)=0;
|
||||
};
|
||||
#endif
|
||||
|
@ -39,10 +39,10 @@ void Port_MCP23018::begin(const uint8_t activeState)
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
||||
/* setLow() sets pin output LOW.
|
||||
/* writeLow() sets pin output LOW.
|
||||
pin is bit pattern, where pin being set is 1.
|
||||
*/
|
||||
void Port_MCP23018::setLow(const uint8_t pin)
|
||||
void Port_MCP23018::writeLow(const uint8_t pin)
|
||||
{
|
||||
outputVal &= ~pin; //set pin output to low
|
||||
|
||||
@ -52,10 +52,10 @@ void Port_MCP23018::setLow(const uint8_t pin)
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
||||
/* setHigh() sets pin output HIGH.
|
||||
/* writeHigh() sets pin output HIGH.
|
||||
pin is bit pattern, where pin being set is 1.
|
||||
*/
|
||||
void Port_MCP23018::setHigh(const uint8_t pin)
|
||||
void Port_MCP23018::writeHigh(const uint8_t pin)
|
||||
{
|
||||
outputVal |= pin; //set pin output to high
|
||||
|
||||
|
@ -42,8 +42,8 @@ class Port_MCP23018 : public PortInterface
|
||||
: deviceAddr(deviceAddr), portNum(portNum), outputVal(0), readPins(readPins) {}
|
||||
void beginProtocol();
|
||||
void begin(const uint8_t activeState);
|
||||
virtual void setLow(const uint8_t pin);
|
||||
virtual void setHigh(const uint8_t pin);
|
||||
virtual void writeLow(const uint8_t pin);
|
||||
virtual void writeHigh(const uint8_t pin);
|
||||
virtual uint8_t read();
|
||||
};
|
||||
#endif
|
||||
|
@ -52,19 +52,19 @@ void Port_MCP23S17::begin(const uint8_t activeState)
|
||||
transfer(deviceAddr << 1, portNum + 0x0C, pullUp); //configure GPPU
|
||||
}
|
||||
|
||||
/* setLow() sets pin output LOW.
|
||||
/* writeLow() sets pin output LOW.
|
||||
pin is bit pattern, where pin being set is 1.
|
||||
*/
|
||||
void Port_MCP23S17::setLow(const uint8_t pin)
|
||||
void Port_MCP23S17::writeLow(const uint8_t pin)
|
||||
{
|
||||
outputVal &= ~pin; //set pin output to low
|
||||
transfer(deviceAddr << 1, portNum + 0x12, outputVal); //set GPIO port to outputVal
|
||||
}
|
||||
|
||||
/* setHigh() sets pin output HIGH.
|
||||
/* writeHigh() sets pin output HIGH.
|
||||
pin is bit pattern, where pin being set is 1.
|
||||
*/
|
||||
void Port_MCP23S17::setHigh(const uint8_t pin)
|
||||
void Port_MCP23S17::writeHigh(const uint8_t pin)
|
||||
{
|
||||
outputVal |= pin; //set pin output to high
|
||||
transfer(deviceAddr << 1, portNum + 0x12, outputVal); //set GPIO port to outputVal
|
||||
|
@ -46,8 +46,8 @@ class Port_MCP23S17 : public PortInterface
|
||||
: deviceAddr(deviceAddr), portNum(portNum), outputVal(0), readPins(readPins) {}
|
||||
void beginProtocol();
|
||||
void begin(const uint8_t activeState);
|
||||
virtual void setLow(const uint8_t pin);
|
||||
virtual void setHigh(const uint8_t pin);
|
||||
virtual void writeLow(const uint8_t pin);
|
||||
virtual void writeHigh(const uint8_t pin);
|
||||
virtual uint8_t read();
|
||||
};
|
||||
#endif
|
||||
|
@ -25,10 +25,10 @@ void Port_PCA9655E::begin(const uint8_t activeState)
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
||||
/* setLow() sets pin output LOW.
|
||||
/* writeLow() sets pin output LOW.
|
||||
pin is bit pattern, where pin being set is 1.
|
||||
*/
|
||||
void Port_PCA9655E::setLow(const uint8_t pin)
|
||||
void Port_PCA9655E::writeLow(const uint8_t pin)
|
||||
{
|
||||
outputVal &= ~pin; //set pin output to low
|
||||
|
||||
@ -38,10 +38,10 @@ void Port_PCA9655E::setLow(const uint8_t pin)
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
||||
/* setHigh() sets pin output HIGH.
|
||||
/* writeHigh() sets pin output HIGH.
|
||||
pin is bit pattern, where pin being set is 1.
|
||||
*/
|
||||
void Port_PCA9655E::setHigh(const uint8_t pin)
|
||||
void Port_PCA9655E::writeHigh(const uint8_t pin)
|
||||
{
|
||||
outputVal |= pin; //set pin output to high
|
||||
|
||||
|
@ -46,8 +46,8 @@ class Port_PCA9655E : public PortInterface
|
||||
: deviceAddr(deviceAddr), portNum(portNum), outputVal(0), readPins(readPins) {}
|
||||
void beginProtocol();
|
||||
void begin(const uint8_t activeState);
|
||||
virtual void setLow(const uint8_t pin);
|
||||
virtual void setHigh(const uint8_t pin);
|
||||
virtual void writeLow(const uint8_t pin);
|
||||
virtual void writeHigh(const uint8_t pin);
|
||||
virtual uint8_t read();
|
||||
};
|
||||
#endif
|
||||
|
@ -14,10 +14,10 @@ void Port_ShiftRegs::begin()
|
||||
SPI.begin();
|
||||
}
|
||||
|
||||
/* setLow() sets pin output LOW.
|
||||
/* writeLow() sets pin output LOW.
|
||||
pin is bit pattern, where pin being set is 1.
|
||||
*/
|
||||
void Port_ShiftRegs::setLow(const uint8_t pin)
|
||||
void Port_ShiftRegs::writeLow(const uint8_t pin)
|
||||
{
|
||||
outputVal &= ~pin; //set pin output to low
|
||||
|
||||
@ -26,10 +26,10 @@ void Port_ShiftRegs::setLow(const uint8_t pin)
|
||||
digitalWrite (slaveSelect, HIGH);
|
||||
}
|
||||
|
||||
/* setHigh() sets pin output HIGH.
|
||||
/* writeHigh() sets pin output HIGH.
|
||||
pin is bit pattern, where pin being set is 1.
|
||||
*/
|
||||
void Port_ShiftRegs::setHigh(const uint8_t pin)
|
||||
void Port_ShiftRegs::writeHigh(const uint8_t pin)
|
||||
{
|
||||
outputVal |= pin; //set pin output to high
|
||||
|
||||
|
@ -16,7 +16,7 @@ class Port_ShiftRegs : public PortWriteInterface
|
||||
public:
|
||||
Port_ShiftRegs(const uint8_t slaveSelect);
|
||||
void begin();
|
||||
void setLow(const uint8_t pin);
|
||||
void setHigh(const uint8_t pin);
|
||||
void writeLow(const uint8_t pin);
|
||||
void writeHigh(const uint8_t pin);
|
||||
};
|
||||
#endif
|
||||
|
@ -28,11 +28,11 @@ read_pins_t Scanner_IOE::scan(const uint8_t strobePin)
|
||||
//strobe on
|
||||
if (activeState == LOW) //if active low
|
||||
{
|
||||
refPortWrite.setLow(strobePin);
|
||||
refPortWrite.writeLow(strobePin);
|
||||
}
|
||||
else //if active high
|
||||
{
|
||||
refPortWrite.setHigh(strobePin);
|
||||
refPortWrite.writeHigh(strobePin);
|
||||
}
|
||||
delayMicroseconds(3); //time to stabilize voltage
|
||||
|
||||
@ -42,12 +42,12 @@ read_pins_t Scanner_IOE::scan(const uint8_t strobePin)
|
||||
//strobe off
|
||||
if (activeState == LOW) //if active low
|
||||
{
|
||||
refPortWrite.setHigh(strobePin);
|
||||
refPortWrite.writeHigh(strobePin);
|
||||
readState = ~readState;
|
||||
}
|
||||
else //if active high
|
||||
{
|
||||
refPortWrite.setLow(strobePin);
|
||||
refPortWrite.writeLow(strobePin);
|
||||
}
|
||||
|
||||
return readState;
|
||||
|
Reference in New Issue
Block a user