diff --git a/src/Shifty.cpp b/src/Shifty.cpp index 9a4db4e..ab750bf 100644 --- a/src/Shifty.cpp +++ b/src/Shifty.cpp @@ -11,7 +11,7 @@ void Shifty::setBitCount(int bitCount) { this->dataModes[i] = 0; this->readBuffer[i] = 0; } -} +} void Shifty::setPins(int dataPin, int clockPin, int latchPin, int readPin) { pinMode(dataPin, OUTPUT); @@ -80,6 +80,12 @@ bool Shifty::getBitMode(int bitnum){ //true == input return bitRead(this->dataModes[bytenum], offset); } +bool Shifty::getWrittenBit(int bitnum){ + int bytenum = bitnum / 8; + int offset = bitnum % 8; + return bitRead(this->writeBuffer[bytenum], offset); +} + void Shifty::writeBitSoft(int bitnum, bool value) { int bytenum = bitnum / 8; int offset = bitnum % 8; diff --git a/src/Shifty.h b/src/Shifty.h index 4997888..655d703 100644 --- a/src/Shifty.h +++ b/src/Shifty.h @@ -11,13 +11,14 @@ class Shifty { void setBitCount(int bitCount); void setPins(int dataPin, int clockPin, int latchPin, int readPin); void setPins(int dataPin, int clockPin, int latchPin); - void setbitMode(int bitnum, bool mode); + void setBitMode(int bitnum, bool mode); bool getBitMode(int bitnum); void batchWriteBegin(); void batchWriteEnd(); void batchReadBegin(); void batchReadEnd(); void writeBit(int bitnum, bool value); + bool getWrittenBit(int bitnum); bool readBit(int bitnum); private: @@ -26,7 +27,7 @@ class Shifty { int clockPin; int readPin; int latchPin; - + int bitCount; int byteCount; byte writeBuffer[16];