2016-09-06 07:08:26 +00:00
|
|
|
#ifndef SCANNER_PORT_H
|
|
|
|
#define SCANNER_PORT_H
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <ScannerInterface.h>
|
|
|
|
#include <PortWriteInterface.h>
|
|
|
|
#include <PortReadInterface.h>
|
|
|
|
|
|
|
|
/* Scanner_IOE uses bit manipulation to read all pins of one port.
|
|
|
|
The maximum keys per row is 8, because ports have a maximum of 8 pins each.
|
|
|
|
|
2016-09-11 21:23:47 +00:00
|
|
|
begin() should be called once from sketch setup().
|
|
|
|
|
2016-09-06 07:08:26 +00:00
|
|
|
keybrd_library_developer_guide.md has instructions for ## Active state and diode orientation
|
|
|
|
*/
|
|
|
|
class Scanner_IOE : public ScannerInterface
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
const bool strobeOn; //logic level of strobe on, HIGH or LOW
|
|
|
|
const bool strobeOff; //logic level of strobe off, complement of strobeOn
|
|
|
|
PortWriteInterface& refPortWrite; //the IC port containing the strobePin
|
|
|
|
PortReadInterface& refPortRead; //the IC's read port
|
|
|
|
public:
|
|
|
|
Scanner_IOE(const bool strobeOn,
|
|
|
|
PortWriteInterface &refPortWrite, PortReadInterface& refPortRead)
|
|
|
|
: strobeOn(strobeOn), strobeOff(!strobeOn),
|
|
|
|
refPortWrite(refPortWrite), refPortRead(refPortRead) {}
|
|
|
|
void init(const uint8_t strobePin);
|
|
|
|
void begin();
|
2016-09-07 04:51:36 +00:00
|
|
|
read_pins_t scan(const uint8_t strobePin);
|
2016-09-06 07:08:26 +00:00
|
|
|
};
|
|
|
|
#endif
|