From 90c420491e0b1c84a990db6d5bb08012138c61c0 Mon Sep 17 00:00:00 2001 From: wolfv6 Date: Wed, 1 Jun 2016 15:59:59 -0600 Subject: [PATCH] remove debounced from debounce() --- examples/debounce_unit_test.cpp | 12 ++++++------ src/RowBase.cpp | 3 +-- src/RowBase.h | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/debounce_unit_test.cpp b/examples/debounce_unit_test.cpp index 9090fe1..ed08a9b 100644 --- a/examples/debounce_unit_test.cpp +++ b/examples/debounce_unit_test.cpp @@ -14,10 +14,11 @@ uint8_t samples[SAMPLE_COUNT]; //bitwise, one bit per key, most uint8_t samplesIndex = 0; //samples[] current write index uint8_t previousDebounced = 0; //bitwise, one bit per key +uint8_t debounced; //1 means pressed, 0 means released uint8_t isFallingEdge; //1 means falling edge uint8_t isRisingEdge; //1 means rising edge -uint8_t debounce(const uint8_t rowState, uint8_t& debounced) +uint8_t debounce(const uint8_t rowState) { uint8_t debouncedChanged; //bitwise uint8_t all_1 = ~0; //bitwise @@ -63,10 +64,9 @@ int main() //Test input and output only shows first bit of each byte. const uint8_t pressed[] = {1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0}; const uint8_t bouncy[] = {1,0,0,0,0,1,0,0,1,1,1,1,0,1,1,1,1,0,0,0,0}; - const uint8_t expectDebounced[]= {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0}; + const uint8_t expectDebounced[]= {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0}; //SAMPLE_COUNT 4 const uint8_t SCAN_COUNT = sizeof(bouncy)/sizeof(*bouncy); uint8_t i; - uint8_t debounced; //1 means pressed, 0 means released uint8_t debouncedChanged; //1 means debounced changed std::cout << "button pressed: "; @@ -86,7 +86,7 @@ int main() std::cout << "debounced signal: "; for (i=0; i