From 87573950e80f8ad12a0aaa148584d8df9fccc278 Mon Sep 17 00:00:00 2001 From: KlausMu Date: Tue, 23 Jan 2024 10:52:27 +0100 Subject: [PATCH] updated to latest version of keypad library from Github, changes for inverted logic are explicitely marked --- .../Keypad/examples/loopCounter/loopCounter.ino | 6 +++--- Platformio/lib/Keypad/src/Keypad.cpp | 15 ++++++++++++++- Platformio/lib/Keypad/src/Keypad.h | 16 ++++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Platformio/lib/Keypad/examples/loopCounter/loopCounter.ino b/Platformio/lib/Keypad/examples/loopCounter/loopCounter.ino index 695e489..b0470e7 100644 --- a/Platformio/lib/Keypad/examples/loopCounter/loopCounter.ino +++ b/Platformio/lib/Keypad/examples/loopCounter/loopCounter.ino @@ -15,7 +15,7 @@ byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); unsigned long loopCount = 0; -unsigned long timer_t = 0; +unsigned long timer_ms = 0; void setup(){ Serial.begin(9600); @@ -33,12 +33,12 @@ void loop(){ // you a relative idea of just how much the debounceTime has changed the // speed of your code. If you set a high debounceTime your loopCount will // look good but your keypresses will start to feel sluggish. - if ((millis() - timer_t) > 1000) { + if ((millis() - timer_ms) > 1000) { Serial.print("Your loop code ran "); Serial.print(loopCount); Serial.println(" times over the last second"); loopCount = 0; - timer_t = millis(); + timer_ms = millis(); } loopCount++; if(key) diff --git a/Platformio/lib/Keypad/src/Keypad.cpp b/Platformio/lib/Keypad/src/Keypad.cpp index 96f9cbc..c4d8cfc 100644 --- a/Platformio/lib/Keypad/src/Keypad.cpp +++ b/Platformio/lib/Keypad/src/Keypad.cpp @@ -83,18 +83,31 @@ bool Keypad::getKeys() { void Keypad::scanKeys() { // Re-intialize the row pins. Allows sharing these pins with other hardware. for (byte r=0; r