2016-09-23 07:13:12 +00:00
|
|
|
#ifndef PORTINTERFACE_H
|
|
|
|
#define PORTINTERFACE_H
|
2016-05-09 14:05:08 +00:00
|
|
|
#include <Arduino.h>
|
|
|
|
#include <inttypes.h>
|
2016-10-31 01:46:23 +00:00
|
|
|
#include <PortWriteInterface.h>
|
2016-05-09 14:05:08 +00:00
|
|
|
|
|
|
|
/*
|
2016-07-15 05:15:38 +00:00
|
|
|
Port classes are the keybrd library's interface to microcontroller ports or I/O expander ports.
|
2016-10-31 01:46:23 +00:00
|
|
|
|
|
|
|
Port classes that can read and write, inherit from PortInterface.
|
|
|
|
Port classes that can only write, inherit from PortWriteInterface.
|
2016-11-05 20:07:56 +00:00
|
|
|
|
|
|
|
write() interface emulates Arduino's digitalWrite().
|
2016-05-09 14:05:08 +00:00
|
|
|
*/
|
2016-10-31 01:46:23 +00:00
|
|
|
class PortInterface : public PortWriteInterface
|
2016-05-09 14:05:08 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-09-24 17:26:08 +00:00
|
|
|
virtual void beginProtocol()=0; //SPI bus or I2C bus
|
2016-09-24 14:56:02 +00:00
|
|
|
virtual void begin(const uint8_t strobeOn)=0; //configure GPIO pins
|
2016-11-14 07:29:29 +00:00
|
|
|
virtual void setLow(const uint8_t pin)=0;
|
|
|
|
virtual void setHigh(const uint8_t pin)=0;
|
2016-07-13 13:17:35 +00:00
|
|
|
virtual uint8_t read()=0;
|
2016-05-09 14:05:08 +00:00
|
|
|
};
|
|
|
|
#endif
|