Browse Source

RowScanner_Arduino, add stobePin, 2 rows

tags/v0.5.0
wolfv6 8 years ago
parent
commit
f368c1fdad
4 changed files with 14 additions and 11 deletions
  1. 1
    1
      src/Row.h
  2. 4
    2
      src/RowBase.cpp
  3. 3
    3
      src/RowScanner_Arduino.cpp
  4. 6
    5
      src/RowScanner_Arduino.h

+ 1
- 1
src/Row.h View File

@@ -24,7 +24,7 @@ class Row : public RowBase
Debouncer_4Samples debouncer;
public:
//Row constructor was like Row_DH constructor
Row(Key *const ptrsKeys[]) : RowBase(ptrsKeys) { }
Row(const uint8_t rowPin, Key *const ptrsKeys[]) : RowBase(ptrsKeys), scanner(rowPin) { }
virtual void process();
};
#endif

+ 4
- 2
src/RowBase.cpp View File

@@ -23,11 +23,13 @@ Tactile switch MJTP series bounce 10 ms http://www.apem.com/files/apem/brochures
Avoid sampling the switch input at a rate synchronous to events in the environment
that might create periodic EMI. For instance, 50 and 60 Hz.
The largest allowabl DELAY_MICROSECONDS is 65535 (.065535 second).
Polling I2C may slow the scan rate enough so that no additional delay is needed:
const unsigned int Row::DELAY_MICROSECONDS = 0;
Slow-scan trick for debug messages that print too fast:
change DELAY_MICROSECONDS to a large number like 10000
Slow-scan trick for debug messages that print too fast, add delay:
delay(1000);
That way debug messages are printed at a managable rate.
*/
void RowBase::wait()

+ 3
- 3
src/RowScanner_Arduino.cpp View File

@@ -1,7 +1,7 @@
#include "RowScanner_Arduino.h"
/*
Strobes the row and reads the columns.
Strobe is on for shortest possible time to preserve IR LED on DodoHand's optic switch.
Strobe is on for shortest possible time.
*/
uint8_t RowScanner_Arduino::scan(uint16_t& rowEnd)
{
@@ -10,11 +10,11 @@ uint8_t RowScanner_Arduino::scan(uint16_t& rowEnd)
//strobe row on
if (activeHigh)
{
digitalWrite(0, HIGH);
digitalWrite(stobePin, HIGH);
}
else //activeLow
{
digitalWrite(0, LOW);
digitalWrite(stobePin, LOW);
}
delayMicroseconds(3); //time to stablize voltage

+ 6
- 5
src/RowScanner_Arduino.h View File

@@ -7,7 +7,7 @@
#include <ColPort.h>
/* rowPin > stobePins[]
replace port calls with
x pass 1: hard coded pins for row0 and col6, init in setup()
x pass 1: hard code pins for row0 and col6, init in setup()
pass 2: pins[] array - first strobe, then read
pass 3: move calls to IC classes - Strobe_uC, Read_uC
pass 4: add IC classes Strobe_MCP23018, Read_MCP23018 */
@@ -15,13 +15,14 @@ class RowScanner_Arduino : public RowScannerInterface
{
private:
static const bool activeHigh; //logic level of strobe pin: 0=activeLow, 1=activeHigh
//const uint8_t* stobePins; //array of strobe pins
const uint8_t stobePin; //Arduino pin number connected to this row
//const uint8_t* readPins; //array of read pins
//const uint8_t readPinCount;
public:
/*RowScanner_Arduino()
:
readPinCount(readPinCount) {}*/
RowScanner_Arduino(const uint8_t stobePin)
: stobePin(stobePin)
// readPinCount(readPinCount)
{}
virtual uint8_t scan(uint16_t& rowEnd);
uint8_t getRowState(uint16_t& rowEnd);
};