Archived
1
0

rename setHigh() setLow() to writeHigh() writeLow()

This commit is contained in:
wolfv6 2016-11-15 18:47:23 -07:00
parent b149a831de
commit a3f2261625
12 changed files with 34 additions and 34 deletions

View File

@ -2,10 +2,10 @@
void LED_Port::on() void LED_Port::on()
{ {
refPort.setHigh(pin); refPort.writeHigh(pin);
} }
void LED_Port::off() void LED_Port::off()
{ {
refPort.setLow(pin); refPort.writeLow(pin);
} }

View File

@ -17,8 +17,8 @@ class PortInterface : public PortWriteInterface
public: public:
virtual void beginProtocol()=0; //SPI bus or I2C bus virtual void beginProtocol()=0; //SPI bus or I2C bus
virtual void begin(const uint8_t activeState)=0; //configure GPIO pins virtual void begin(const uint8_t activeState)=0; //configure GPIO pins
virtual void setLow(const uint8_t pin)=0; virtual void writeLow(const uint8_t pin)=0;
virtual void setHigh(const uint8_t pin)=0; virtual void writeHigh(const uint8_t pin)=0;
virtual uint8_t read()=0; virtual uint8_t read()=0;
}; };
#endif #endif

View File

@ -14,7 +14,7 @@ write() interface emulates Arduino's digitalWrite().
class PortWriteInterface class PortWriteInterface
{ {
public: public:
virtual void setLow(const uint8_t pin)=0; virtual void writeLow(const uint8_t pin)=0;
virtual void setHigh(const uint8_t pin)=0; virtual void writeHigh(const uint8_t pin)=0;
}; };
#endif #endif

View File

@ -39,10 +39,10 @@ void Port_MCP23018::begin(const uint8_t activeState)
Wire.endTransmission(); Wire.endTransmission();
} }
/* setLow() sets pin output LOW. /* writeLow() sets pin output LOW.
pin is bit pattern, where pin being set is 1. 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 outputVal &= ~pin; //set pin output to low
@ -52,10 +52,10 @@ void Port_MCP23018::setLow(const uint8_t pin)
Wire.endTransmission(); Wire.endTransmission();
} }
/* setHigh() sets pin output HIGH. /* writeHigh() sets pin output HIGH.
pin is bit pattern, where pin being set is 1. 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 outputVal |= pin; //set pin output to high

View File

@ -42,8 +42,8 @@ class Port_MCP23018 : public PortInterface
: deviceAddr(deviceAddr), portNum(portNum), outputVal(0), readPins(readPins) {} : deviceAddr(deviceAddr), portNum(portNum), outputVal(0), readPins(readPins) {}
void beginProtocol(); void beginProtocol();
void begin(const uint8_t activeState); void begin(const uint8_t activeState);
virtual void setLow(const uint8_t pin); virtual void writeLow(const uint8_t pin);
virtual void setHigh(const uint8_t pin); virtual void writeHigh(const uint8_t pin);
virtual uint8_t read(); virtual uint8_t read();
}; };
#endif #endif

View File

@ -52,19 +52,19 @@ void Port_MCP23S17::begin(const uint8_t activeState)
transfer(deviceAddr << 1, portNum + 0x0C, pullUp); //configure GPPU 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. 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 outputVal &= ~pin; //set pin output to low
transfer(deviceAddr << 1, portNum + 0x12, outputVal); //set GPIO port to outputVal 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. 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 outputVal |= pin; //set pin output to high
transfer(deviceAddr << 1, portNum + 0x12, outputVal); //set GPIO port to outputVal transfer(deviceAddr << 1, portNum + 0x12, outputVal); //set GPIO port to outputVal

View File

@ -46,8 +46,8 @@ class Port_MCP23S17 : public PortInterface
: deviceAddr(deviceAddr), portNum(portNum), outputVal(0), readPins(readPins) {} : deviceAddr(deviceAddr), portNum(portNum), outputVal(0), readPins(readPins) {}
void beginProtocol(); void beginProtocol();
void begin(const uint8_t activeState); void begin(const uint8_t activeState);
virtual void setLow(const uint8_t pin); virtual void writeLow(const uint8_t pin);
virtual void setHigh(const uint8_t pin); virtual void writeHigh(const uint8_t pin);
virtual uint8_t read(); virtual uint8_t read();
}; };
#endif #endif

View File

@ -25,10 +25,10 @@ void Port_PCA9655E::begin(const uint8_t activeState)
Wire.endTransmission(); Wire.endTransmission();
} }
/* setLow() sets pin output LOW. /* writeLow() sets pin output LOW.
pin is bit pattern, where pin being set is 1. 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 outputVal &= ~pin; //set pin output to low
@ -38,10 +38,10 @@ void Port_PCA9655E::setLow(const uint8_t pin)
Wire.endTransmission(); Wire.endTransmission();
} }
/* setHigh() sets pin output HIGH. /* writeHigh() sets pin output HIGH.
pin is bit pattern, where pin being set is 1. 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 outputVal |= pin; //set pin output to high

View File

@ -46,8 +46,8 @@ class Port_PCA9655E : public PortInterface
: deviceAddr(deviceAddr), portNum(portNum), outputVal(0), readPins(readPins) {} : deviceAddr(deviceAddr), portNum(portNum), outputVal(0), readPins(readPins) {}
void beginProtocol(); void beginProtocol();
void begin(const uint8_t activeState); void begin(const uint8_t activeState);
virtual void setLow(const uint8_t pin); virtual void writeLow(const uint8_t pin);
virtual void setHigh(const uint8_t pin); virtual void writeHigh(const uint8_t pin);
virtual uint8_t read(); virtual uint8_t read();
}; };
#endif #endif

View File

@ -14,10 +14,10 @@ void Port_ShiftRegs::begin()
SPI.begin(); SPI.begin();
} }
/* setLow() sets pin output LOW. /* writeLow() sets pin output LOW.
pin is bit pattern, where pin being set is 1. 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 outputVal &= ~pin; //set pin output to low
@ -26,10 +26,10 @@ void Port_ShiftRegs::setLow(const uint8_t pin)
digitalWrite (slaveSelect, HIGH); digitalWrite (slaveSelect, HIGH);
} }
/* setHigh() sets pin output HIGH. /* writeHigh() sets pin output HIGH.
pin is bit pattern, where pin being set is 1. 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 outputVal |= pin; //set pin output to high

View File

@ -16,7 +16,7 @@ class Port_ShiftRegs : public PortWriteInterface
public: public:
Port_ShiftRegs(const uint8_t slaveSelect); Port_ShiftRegs(const uint8_t slaveSelect);
void begin(); void begin();
void setLow(const uint8_t pin); void writeLow(const uint8_t pin);
void setHigh(const uint8_t pin); void writeHigh(const uint8_t pin);
}; };
#endif #endif

View File

@ -28,11 +28,11 @@ read_pins_t Scanner_IOE::scan(const uint8_t strobePin)
//strobe on //strobe on
if (activeState == LOW) //if active low if (activeState == LOW) //if active low
{ {
refPortWrite.setLow(strobePin); refPortWrite.writeLow(strobePin);
} }
else //if active high else //if active high
{ {
refPortWrite.setHigh(strobePin); refPortWrite.writeHigh(strobePin);
} }
delayMicroseconds(3); //time to stabilize voltage delayMicroseconds(3); //time to stabilize voltage
@ -42,12 +42,12 @@ read_pins_t Scanner_IOE::scan(const uint8_t strobePin)
//strobe off //strobe off
if (activeState == LOW) //if active low if (activeState == LOW) //if active low
{ {
refPortWrite.setHigh(strobePin); refPortWrite.writeHigh(strobePin);
readState = ~readState; readState = ~readState;
} }
else //if active high else //if active high
{ {
refPortWrite.setLow(strobePin); refPortWrite.writeLow(strobePin);
} }
return readState; return readState;