Browse Source

rename strobeOn to activeState

tags/v0.6.4
wolfv6 7 years ago
parent
commit
b149a831de

+ 2
- 2
doc/keybrd_library_user_guide.md View File

@@ -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);
```

+ 1
- 1
src/PortInterface.h View File

@@ -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;

+ 2
- 2
src/Port_MCP23018.cpp View File

@@ -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)
}

+ 1
- 1
src/Port_MCP23018.h View File

@@ -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();

+ 3
- 3
src/Port_MCP23S17.cpp View File

@@ -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)
}

+ 1
- 1
src/Port_MCP23S17.h View File

@@ -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();

+ 2
- 2
src/Port_PCA9655E.cpp View File

@@ -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

+ 1
- 1
src/Port_PCA9655E.h View File

@@ -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();

+ 2
- 2
tutorials/keybrd_2_single-layer/keybrd_2_single-layer.ino View File

@@ -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.
*/

+ 2
- 2
tutorials/keybrd_6_active_high/keybrd_6_active_high.ino View File

@@ -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);

+ 2
- 2
tutorials/tutorial_6_active_high.md View File

@@ -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);
```