From fd7da5aebb7f93a74035228ed6b7fbdb0cb0cc4c Mon Sep 17 00:00:00 2001 From: wolfv6 Date: Thu, 30 Jun 2016 04:40:39 -0600 Subject: [PATCH] in RowScanner_PinsArray, make all const CAPS --- src/RowScanner_PinsArray.cpp | 26 +++++++++++++------------- src/RowScanner_PinsArray.h | 10 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/RowScanner_PinsArray.cpp b/src/RowScanner_PinsArray.cpp index d8aa82e..d51ce46 100644 --- a/src/RowScanner_PinsArray.cpp +++ b/src/RowScanner_PinsArray.cpp @@ -2,16 +2,16 @@ /* constructor */ -RowScanner_PinsArray::RowScanner_PinsArray(const uint8_t strobePin, - const uint8_t readPins[], const uint8_t READ_PIN_COUNT) - : strobePin(strobePin), readPins(readPins), READ_PIN_COUNT(READ_PIN_COUNT) +RowScanner_PinsArray::RowScanner_PinsArray(const uint8_t STROBE_PIN, + const uint8_t READ_PINS[], const uint8_t READ_PIN_COUNT) + : STROBE_PIN(STROBE_PIN), READ_PINS(READ_PINS), READ_PIN_COUNT(READ_PIN_COUNT) { uint8_t mode; //configure row - pinMode(strobePin, OUTPUT); + pinMode(STROBE_PIN, OUTPUT); - if (activeHigh) + if (ACTIVE_HIGH) { mode = INPUT; //requires external pull-down resistor } @@ -23,7 +23,7 @@ RowScanner_PinsArray::RowScanner_PinsArray(const uint8_t strobePin, //configure cols for (uint8_t i=0; i < READ_PIN_COUNT; i++) { - pinMode(readPins[i], mode); + pinMode(READ_PINS[i], mode); } } @@ -45,20 +45,20 @@ read_pins_t RowScanner_PinsArray::scan(read_pins_mask_t& rowEnd) rowEnd = 1; //strobe row on - if (activeHigh) + if (ACTIVE_HIGH) { - digitalWrite(strobePin, HIGH); + digitalWrite(STROBE_PIN, HIGH); } else //activeLow { - digitalWrite(strobePin, LOW); + digitalWrite(STROBE_PIN, LOW); } delayMicroseconds(3); //time to stablize voltage //read all the column pins for (uint8_t i=0; i < READ_PIN_COUNT; i++) { - if ( digitalRead(readPins[i]) == activeHigh ) + if ( digitalRead(READ_PINS[i]) == ACTIVE_HIGH ) { rowState |= rowEnd; } @@ -66,13 +66,13 @@ read_pins_t RowScanner_PinsArray::scan(read_pins_mask_t& rowEnd) } //strobe row off - if (activeHigh) + if (ACTIVE_HIGH) { - digitalWrite(strobePin, LOW); + digitalWrite(STROBE_PIN, LOW); } else //activeLow { - digitalWrite(strobePin, HIGH); + digitalWrite(STROBE_PIN, HIGH); } return rowState; diff --git a/src/RowScanner_PinsArray.h b/src/RowScanner_PinsArray.h index b02f055..3f66048 100644 --- a/src/RowScanner_PinsArray.h +++ b/src/RowScanner_PinsArray.h @@ -14,13 +14,13 @@ Constructor is in RowScanner_PinsArray.cpp class RowScanner_PinsArray : public RowScannerInterface { private: - static const bool activeHigh; //logic level of strobe pin: 0=activeLow, 1=activeHigh - const uint8_t strobePin; //Arduino pin number connected to this row - const uint8_t* readPins; //array of read pin numbers + static const bool ACTIVE_HIGH; //logic level of strobe pin: 0=activeLow, 1=activeHigh + const uint8_t STROBE_PIN; //Arduino pin number connected to this row + const uint8_t* const READ_PINS; //array of read pin numbers const uint8_t READ_PIN_COUNT; //number of read pins public: - RowScanner_PinsArray(const uint8_t strobePin, - const uint8_t readPins[], const uint8_t READ_PIN_COUNT); + RowScanner_PinsArray(const uint8_t STROBE_PIN, + const uint8_t READ_PINS[], const uint8_t READ_PIN_COUNT); virtual read_pins_t scan(read_pins_mask_t& rowEnd); //read_pins_t getRowState(read_pins_mask_t& rowEnd); };