Archived
1
0
This commit is contained in:
wolfv6 2016-11-05 14:07:56 -06:00
parent e84db1c61c
commit 31fed09b6b
3 changed files with 7 additions and 2 deletions

View File

@ -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 read and write, inherit from PortInterface.
Port classes that can only write, inherit from PortWriteInterface. Port classes that can only write, inherit from PortWriteInterface.
write() interface emulates Arduino's digitalWrite().
*/ */
class PortInterface : public PortWriteInterface class PortInterface : public PortWriteInterface
{ {
public: public:
virtual void beginProtocol()=0; //SPI bus or I2C bus virtual void beginProtocol()=0; //SPI bus or I2C bus
virtual void begin(const uint8_t strobeOn)=0; //configure GPIO pins 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; virtual uint8_t read()=0;
}; };
#endif #endif

View File

@ -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 read & write, inherit from PortInterface.
Port classes that can only write, inherit from PortWriteInterface. Port classes that can only write, inherit from PortWriteInterface.
write() interface emulates Arduino's digitalWrite().
*/ */
class PortWriteInterface class PortWriteInterface
{ {

View File

@ -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 //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 digitalWrite(slaveSelect, HIGH); //shift the data toward a serial output