Browse Source

rename Row::pressRelease() to send(), Debouncer_4Samples to Debouncer_Samples

tags/v0.5.0
wolfv6 7 years ago
parent
commit
cdeb855a1d

+ 1
- 1
doc/keybrd_library_developer_guide.md View File

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

src/Debouncer_4Samples.cpp → src/Debouncer_Samples.cpp View File

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

src/Debouncer_4Samples.h → src/Debouncer_Samples.h View File

@@ -5,16 +5,16 @@
#include <config_keybrd.h>
#include <DebouncerInterface.h>

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

+ 2
- 2
src/Row.cpp View File

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

+ 1
- 1
src/Row.h View File

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

+ 1
- 1
src/Row_ShiftRegisters.cpp View File

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

+ 2
- 2
src/Row_ShiftRegisters.h View File

@@ -3,7 +3,7 @@

#include <Row.h>
#include <Scanner_ShiftRegs74HC165.h>
#include <Debouncer_4Samples.h>
#include <Debouncer_Samples.h>
//#include <Debouncer_Not.h>

/* 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:

+ 1
- 1
src/Row_uC.cpp View File

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

+ 2
- 2
src/Row_uC.h View File

@@ -3,7 +3,7 @@

#include <Row.h>
#include <Scanner_uC.h>
#include <Debouncer_4Samples.h>
#include <Debouncer_Samples.h>

/* 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,