@@ -9,13 +9,15 @@ Port classes are the keybrd library's interface to microcontroller ports or I/O | |||
Port classes that can read and write, inherit from PortInterface. | |||
Port classes that can only write, inherit from PortWriteInterface. | |||
write() interface emulates Arduino's digitalWrite(). | |||
*/ | |||
class PortInterface : public PortWriteInterface | |||
{ | |||
public: | |||
virtual void beginProtocol()=0; //SPI bus or I2C bus | |||
virtual void begin(const uint8_t strobeOn)=0; //configure GPIO pins | |||
virtual void write(const uint8_t strobePin, const bool pinLogicLevel)=0; | |||
virtual void write(const uint8_t pin, const bool pinLogicLevel)=0; | |||
virtual uint8_t read()=0; | |||
}; | |||
#endif |
@@ -8,6 +8,8 @@ Port classes are the keybrd library's interface to MOSI shift registers i.e. Por | |||
Port classes that can read & write, inherit from PortInterface. | |||
Port classes that can only write, inherit from PortWriteInterface. | |||
write() interface emulates Arduino's digitalWrite(). | |||
*/ | |||
class PortWriteInterface | |||
{ |
@@ -48,7 +48,8 @@ read_pins_t Scanner_ShiftRegsReadStrobed::scan(const uint8_t strobePin) | |||
//SPI.beginTransaction( SPISettings(5000000, MSBFIRST, SPI_MODE0) ); //control SPI bus, 5 MHz | |||
delayMicroseconds(20); //photo-transistor at 3.3v needs 20 ms to stablize | |||
//photo-transistor at 3.3v needs 20 ms to stabilize | |||
delayMicroseconds(20); //monitor trackball here | |||
digitalWrite(slaveSelect, HIGH); //shift the data toward a serial output | |||