From b149a831de5c17a84624764678656f5b0959fae6 Mon Sep 17 00:00:00 2001 From: wolfv6 Date: Tue, 15 Nov 2016 18:41:05 -0700 Subject: [PATCH] rename strobeOn to activeState --- doc/keybrd_library_user_guide.md | 4 ++-- src/PortInterface.h | 2 +- src/Port_MCP23018.cpp | 4 ++-- src/Port_MCP23018.h | 2 +- src/Port_MCP23S17.cpp | 6 +++--- src/Port_MCP23S17.h | 2 +- src/Port_PCA9655E.cpp | 4 ++-- src/Port_PCA9655E.h | 2 +- tutorials/keybrd_2_single-layer/keybrd_2_single-layer.ino | 4 ++-- tutorials/keybrd_6_active_high/keybrd_6_active_high.ino | 4 ++-- tutorials/tutorial_6_active_high.md | 4 ++-- 11 files changed, 19 insertions(+), 19 deletions(-) diff --git a/doc/keybrd_library_user_guide.md b/doc/keybrd_library_user_guide.md index 3e17be0..8a760c3 100644 --- a/doc/keybrd_library_user_guide.md +++ b/doc/keybrd_library_user_guide.md @@ -123,7 +123,7 @@ The following instructions are for setting active state for a Scanner_uC class For active low: * Orient diodes with cathode (banded end) towards the write pins (row) -* Instantiate the scanner in the sketch with strobeOn LOW, like this: +* Instantiate the scanner in the sketch with activeState LOW, like this: ``` Scanner_uC scanner(LOW, readPins, readPinCount); ``` @@ -131,7 +131,7 @@ Scanner_uC scanner(LOW, readPins, readPinCount); For active high: * Add an external 10k pull-down resistor to each read pin. * Orient diodes with cathode (banded end) towards the read pins. -* Instantiate the scanner in the sketch with strobeOn HIGH, like this: +* Instantiate the scanner in the sketch with activeState HIGH, like this: ``` Scanner_uC scanner(HIGH, readPins, readPinCount); ``` diff --git a/src/PortInterface.h b/src/PortInterface.h index ca45b0f..8932e08 100644 --- a/src/PortInterface.h +++ b/src/PortInterface.h @@ -16,7 +16,7 @@ class PortInterface : public PortWriteInterface { public: virtual void beginProtocol()=0; //SPI bus or I2C bus - virtual void begin(const uint8_t strobeOn)=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 setHigh(const uint8_t pin)=0; virtual uint8_t read()=0; diff --git a/src/Port_MCP23018.cpp b/src/Port_MCP23018.cpp index 50ebbc8..08a017b 100644 --- a/src/Port_MCP23018.cpp +++ b/src/Port_MCP23018.cpp @@ -15,11 +15,11 @@ void Port_MCP23018::beginProtocol() /* begin() is called from Scanner_IOE::begin(). Configures port's IODIR and GPPU. */ -void Port_MCP23018::begin(const uint8_t strobeOn) +void Port_MCP23018::begin(const uint8_t activeState) { uint8_t pullUp; //bits, GPPU 0=pull-up disabled, 1=pull-up enabled - if (strobeOn == LOW) //if active low + if (activeState == LOW) //if active low { pullUp = readPins; //0=pull-up disabled (for LED), 1=pull-up enabled (for read) } diff --git a/src/Port_MCP23018.h b/src/Port_MCP23018.h index 83ffc97..b756db5 100644 --- a/src/Port_MCP23018.h +++ b/src/Port_MCP23018.h @@ -41,7 +41,7 @@ class Port_MCP23018 : public PortInterface Port_MCP23018(const uint8_t deviceAddr, const uint8_t portNum, const uint8_t readPins) : deviceAddr(deviceAddr), portNum(portNum), outputVal(0), readPins(readPins) {} void beginProtocol(); - void begin(const uint8_t strobeOn); + void begin(const uint8_t activeState); virtual void setLow(const uint8_t pin); virtual void setHigh(const uint8_t pin); virtual uint8_t read(); diff --git a/src/Port_MCP23S17.cpp b/src/Port_MCP23S17.cpp index 2a22fa5..b1aa307 100644 --- a/src/Port_MCP23S17.cpp +++ b/src/Port_MCP23S17.cpp @@ -32,14 +32,14 @@ void Port_MCP23S17::beginProtocol() } /* begin() is called from Scanner_IOE::begin(). -strobeOn is logic level of strobe on, HIGH or LOW +activeState is logic level of strobe on, HIGH or LOW configure IODIR and GPPU. */ -void Port_MCP23S17::begin(const uint8_t strobeOn) +void Port_MCP23S17::begin(const uint8_t activeState) { uint8_t pullUp; //bits, GPPU 0=pull-up disabled, 1=pull-up enabled - if (strobeOn == LOW) //if active low + if (activeState == LOW) //if active low { pullUp = readPins; //0=pull-up disabled (for LED), 1=pull-up enabled (for read) } diff --git a/src/Port_MCP23S17.h b/src/Port_MCP23S17.h index 784bc60..ed1e146 100644 --- a/src/Port_MCP23S17.h +++ b/src/Port_MCP23S17.h @@ -45,7 +45,7 @@ class Port_MCP23S17 : public PortInterface Port_MCP23S17(const uint8_t deviceAddr, const uint8_t portNum, const uint8_t readPins) : deviceAddr(deviceAddr), portNum(portNum), outputVal(0), readPins(readPins) {} void beginProtocol(); - void begin(const uint8_t strobeOn); + void begin(const uint8_t activeState); virtual void setLow(const uint8_t pin); virtual void setHigh(const uint8_t pin); virtual uint8_t read(); diff --git a/src/Port_PCA9655E.cpp b/src/Port_PCA9655E.cpp index 1df0de9..6df649b 100644 --- a/src/Port_PCA9655E.cpp +++ b/src/Port_PCA9655E.cpp @@ -15,9 +15,9 @@ void Port_PCA9655E::beginProtocol() /* begin() is called from Scanner_IOE::begin(). Configures read pins to input. -strobeOn is not used because PCA9655E has no internal pull-up resistors. +activeState is not used because PCA9655E has no internal pull-up resistors. */ -void Port_PCA9655E::begin(const uint8_t strobeOn) +void Port_PCA9655E::begin(const uint8_t activeState) { Wire.beginTransmission(deviceAddr); Wire.write(portNum + 6); //configure direction diff --git a/src/Port_PCA9655E.h b/src/Port_PCA9655E.h index 133d3c2..876a273 100644 --- a/src/Port_PCA9655E.h +++ b/src/Port_PCA9655E.h @@ -45,7 +45,7 @@ class Port_PCA9655E : public PortInterface Port_PCA9655E(const uint8_t deviceAddr, const uint8_t portNum, const uint8_t readPins) : deviceAddr(deviceAddr), portNum(portNum), outputVal(0), readPins(readPins) {} void beginProtocol(); - void begin(const uint8_t strobeOn); + void begin(const uint8_t activeState); virtual void setLow(const uint8_t pin); virtual void setHigh(const uint8_t pin); virtual uint8_t read(); diff --git a/tutorials/keybrd_2_single-layer/keybrd_2_single-layer.ino b/tutorials/keybrd_2_single-layer/keybrd_2_single-layer.ino index b2067a0..4577fda 100644 --- a/tutorials/keybrd_2_single-layer/keybrd_2_single-layer.ino +++ b/tutorials/keybrd_2_single-layer/keybrd_2_single-layer.ino @@ -47,8 +47,8 @@ uint8_t readPins[] = {14, 15}; uint8_t readPinCount = sizeof(readPins)/sizeof(*readPins); /* -Scanner_uC constructor parameters are: strobeOn, readPins[], readPinCount. -strobeOn defines the logic level for strobes, HIGH or LOW. +Scanner_uC constructor parameters are: activeState, readPins[], readPinCount. +activeState defines the logic level for strobes, HIGH or LOW. "Active low" means that if a switch is pressed (active), the read pin is low. The scanner uses readPins and readPinCount to read the colums. */ diff --git a/tutorials/keybrd_6_active_high/keybrd_6_active_high.ino b/tutorials/keybrd_6_active_high/keybrd_6_active_high.ino index 3a8d941..2a33c43 100644 --- a/tutorials/keybrd_6_active_high/keybrd_6_active_high.ino +++ b/tutorials/keybrd_6_active_high/keybrd_6_active_high.ino @@ -25,8 +25,8 @@ uint8_t readPins[] = {14, 15}; uint8_t readPinCount = sizeof(readPins)/sizeof(*readPins); /* -Scanner_uC constructor parameters are: strobeOn, readPins[], readPinCount. -strobeOn defines the logic level for strobes, HIGH or LOW. +Scanner_uC constructor parameters are: activeState, readPins[], readPinCount. +activeState defines the logic level for strobes, HIGH or LOW. "Active high" means that if a switch is pressed (active), the read pin is high. */ Scanner_uC scanner(HIGH, readPins, readPinCount); diff --git a/tutorials/tutorial_6_active_high.md b/tutorials/tutorial_6_active_high.md index c55e528..7263035 100644 --- a/tutorials/tutorial_6_active_high.md +++ b/tutorials/tutorial_6_active_high.md @@ -17,7 +17,7 @@ Arduino boards have internal pull-up resistors, which saves on parts and labor c To make a key matrix active low: * Orient diodes with cathode (banded end) towards the strobe pins (row) -* Instantiate the scanner in the sketch with strobeOn LOW, like this: +* Instantiate the scanner in the sketch with activeState LOW, like this: ``` Scanner_uC scanner(LOW, readPins, readPinCount); ``` @@ -33,7 +33,7 @@ If you want to use active low, you will have to add external pull-down resistors To make a key matrix active high: * Add an external 10k Ohm pull-down resistor to each read pin * Orient diodes with cathode (banded end) towards the read pins -* Instantiate the scanner in the sketch with strobeOn HIGH, like this: +* Instantiate the scanner in the sketch with activeState HIGH, like this: ``` Scanner_uC scanner(HIGH, readPins, readPinCount); ```