Archived
1
0
This repo is archived. You can view files and clone it, but cannot push or open issues or pull requests.
keybrd/src/ReadPort.h

24 lines
719 B
C
Raw Normal View History

2016-07-12 13:23:24 +00:00
#ifndef READPORT_H
#define READPORT_H
2016-05-09 14:05:08 +00:00
#include <Arduino.h>
#include <inttypes.h>
/*
2016-07-12 13:23:24 +00:00
ReadPort is an abstract base class.
2016-05-09 14:05:08 +00:00
Port classes are the keybrd library's interface to microcontoller ports or I/O expander ports.
*/
2016-07-12 13:23:24 +00:00
class ReadPort
2016-05-09 14:05:08 +00:00
{
protected:
2016-07-12 13:23:24 +00:00
const uint8_t readPins; //bitwise pin configuration, 1 means read column
2016-05-09 14:05:08 +00:00
uint8_t portState; //bitwise pin values, which is set in read()
public:
2016-07-12 13:23:24 +00:00
ReadPort(const uint8_t readPins): readPins(readPins), portState(0) {}
2016-05-09 14:05:08 +00:00
//read port and store it's pins values in portState
virtual void read()=0;
uint8_t getColPins();
uint8_t getPortState();
};
#endif