diff --git a/doc/keybrd_library_developer_guide.md b/doc/keybrd_library_developer_guide.md index 539b153..fca3ec1 100644 --- a/doc/keybrd_library_developer_guide.md +++ b/doc/keybrd_library_developer_guide.md @@ -246,7 +246,7 @@ Refer to it like a table of contents while reading the keybrd library. set rowState bit strobe row off Debouncer_4Samples::debounce() debounce - Row::pressRelease() for each key in row + Row::send() for each key in row if falling edge Key_*::release() scanCode->release() Code_*::release() Keyboard.release(scancode) diff --git a/src/Debouncer_4Samples.cpp b/src/Debouncer_Samples.cpp similarity index 95% rename from src/Debouncer_4Samples.cpp rename to src/Debouncer_Samples.cpp index bd39017..0055558 100644 --- a/src/Debouncer_4Samples.cpp +++ b/src/Debouncer_Samples.cpp @@ -29,13 +29,13 @@ SAMPLE_COUNT = 4 is very reliable for a keyboard. Split keyboards with a long connecting wire or in environment with strong electromagnetic interference (EMI) may need a larger SAMPLE_COUNT for reliability. */ -#include "Debouncer_4Samples.h" +#include "Debouncer_Samples.h" /* debounce() sets debounced and returns debouncedChanged. All variables are bitwise. For parameters, 1 means pressed, 0 means released. For return, 1 means debounced changed. */ -read_pins_t Debouncer_4Samples::debounce(const read_pins_t rawSignal, read_pins_t& debounced) +read_pins_t Debouncer_Samples::debounce(const read_pins_t rawSignal, read_pins_t& debounced) { read_pins_t previousDebounced; //bitwise, 1 means pressed, 0 means released read_pins_t all_1 = ~0; //bitwise diff --git a/src/Debouncer_4Samples.h b/src/Debouncer_Samples.h similarity index 81% rename from src/Debouncer_4Samples.h rename to src/Debouncer_Samples.h index 4983eb6..3739a30 100644 --- a/src/Debouncer_4Samples.h +++ b/src/Debouncer_Samples.h @@ -5,16 +5,16 @@ #include #include -/* Debouncer_4Samples +/* Debouncer_Samples Configuration: #define SAMPLE_COUNT in config_keybrd.h */ -class Debouncer_4Samples : public DebouncerInterface +class Debouncer_Samples : public DebouncerInterface { private: read_pins_t samples[SAMPLE_COUNT]; //bitwise, one bit per key, most recent readings uint8_t samplesIndex; //samples[] current write index public: - Debouncer_4Samples(): samplesIndex(0) {} + Debouncer_Samples(): samplesIndex(0) {} virtual read_pins_t debounce(const read_pins_t rawSignal, read_pins_t& debounced); }; #endif diff --git a/src/Row.cpp b/src/Row.cpp index 3dc0130..7c9a82e 100644 --- a/src/Row.cpp +++ b/src/Row.cpp @@ -1,9 +1,9 @@ #include "Row.h" /* -pressRelease() calls key's press() or release() function if it was pressed or released. +send() calls key's press() or release() function if it was pressed or released. Both parameters are bitwise. */ -void Row::pressRelease(const uint8_t readPinCount, const read_pins_t debouncedChanged) +void Row::send(const uint8_t readPinCount, const read_pins_t debouncedChanged) { read_pins_t isFallingEdge; //bitwise, 1 means falling edge read_pins_t isRisingEdge; //bitwise, 1 means rising edge diff --git a/src/Row.h b/src/Row.h index bb927f4..f8f5b64 100644 --- a/src/Row.h +++ b/src/Row.h @@ -14,7 +14,7 @@ class Row virtual void keyWasPressed(); protected: read_pins_t debounced; //bitwise, 1 means pressed, 0 means released - void pressRelease(const uint8_t readPinCount, const read_pins_t debouncedChanged); + void send(const uint8_t readPinCount, const read_pins_t debouncedChanged); public: Row(Key *const ptrsKeys[]) : ptrsKeys(ptrsKeys), debounced(0) { } virtual void process()=0; diff --git a/src/Row_ShiftRegisters.cpp b/src/Row_ShiftRegisters.cpp index d4686df..69d101b 100644 --- a/src/Row_ShiftRegisters.cpp +++ b/src/Row_ShiftRegisters.cpp @@ -8,7 +8,7 @@ void Row_ShiftRegisters::process() readState = scanner.scan(); debouncedChanged = debouncer.debounce(readState, debounced); - pressRelease(READ_PIN_COUNT, debouncedChanged); + send(READ_PIN_COUNT, debouncedChanged); } void Row_ShiftRegisters::begin() diff --git a/src/Row_ShiftRegisters.h b/src/Row_ShiftRegisters.h index 630b753..f8aee4b 100644 --- a/src/Row_ShiftRegisters.h +++ b/src/Row_ShiftRegisters.h @@ -3,7 +3,7 @@ #include #include -#include +#include //#include /* Row_DH_IOE is a row connected to an Input/Output Expander. @@ -28,7 +28,7 @@ class Row_ShiftRegisters : public Row { private: Scanner_ShiftRegs74HC165 scanner; - Debouncer_4Samples debouncer; + Debouncer_Samples debouncer; //Debouncer_Not debouncer; //passed test const uint8_t READ_PIN_COUNT; //number of read pins public: diff --git a/src/Row_uC.cpp b/src/Row_uC.cpp index 46fa300..889c564 100644 --- a/src/Row_uC.cpp +++ b/src/Row_uC.cpp @@ -11,5 +11,5 @@ void Row_uC::process() readState = scanner.scan(); debouncedChanged = debouncer.debounce(readState, debounced); - pressRelease(READ_PIN_COUNT, debouncedChanged); + send(READ_PIN_COUNT, debouncedChanged); } diff --git a/src/Row_uC.h b/src/Row_uC.h index b9e16b3..2ed2fe2 100644 --- a/src/Row_uC.h +++ b/src/Row_uC.h @@ -3,7 +3,7 @@ #include #include -#include +#include /* Row_uC is a row connected to a micro controller. @@ -30,7 +30,7 @@ class Row_uC : public Row { private: Scanner_uC scanner; - Debouncer_4Samples debouncer; + Debouncer_Samples debouncer; const uint8_t READ_PIN_COUNT; //number of read pins public: Row_uC(const uint8_t strobePin, const uint8_t READ_PINS[], const uint8_t READ_PIN_COUNT,