mirror of
https://github.com/xreef/PCF8574_library.git
synced 2024-08-30 18:12:18 +00:00
UPDATE 2.0 VERSION
This commit is contained in:
commit
f8d02a8b34
185
PCF8574.cpp
185
PCF8574.cpp
@ -169,14 +169,16 @@ void PCF8574::begin(){
|
|||||||
if (writeMode>0 || readMode>0){
|
if (writeMode>0 || readMode>0){
|
||||||
DEBUG_PRINTLN("Set write mode");
|
DEBUG_PRINTLN("Set write mode");
|
||||||
_wire->beginTransmission(_address);
|
_wire->beginTransmission(_address);
|
||||||
DEBUG_PRINT(" ");
|
|
||||||
DEBUG_PRINT("usedPin pin ");
|
|
||||||
|
|
||||||
|
|
||||||
byte usedPin = writeMode | readMode;
|
DEBUG_PRINT("resetInitial pin ");
|
||||||
DEBUG_PRINTLN( ~usedPin, BIN);
|
resetInitial = writeModeUp | readModePullUp;
|
||||||
|
DEBUG_PRINTLN( resetInitial, BIN);
|
||||||
|
|
||||||
_wire->write(~usedPin);
|
_wire->write(resetInitial);
|
||||||
|
|
||||||
|
byteBuffered = resetInitial;
|
||||||
|
writeByteBuffered = writeModeUp;
|
||||||
|
|
||||||
DEBUG_PRINTLN("Start end trasmission if stop here check pullup resistor.");
|
DEBUG_PRINTLN("Start end trasmission if stop here check pullup resistor.");
|
||||||
_wire->endTransmission();
|
_wire->endTransmission();
|
||||||
@ -184,9 +186,12 @@ void PCF8574::begin(){
|
|||||||
|
|
||||||
// If using interrupt set interrupt value to pin
|
// If using interrupt set interrupt value to pin
|
||||||
if (_usingInterrupt){
|
if (_usingInterrupt){
|
||||||
|
// DEBUG_PRINTLN("Using interrupt pin (not all pin is interrupted)");
|
||||||
|
// ::pinMode(_interruptPin, INPUT_PULLUP);
|
||||||
|
// attachInterrupt(digitalPinToInterrupt(_interruptPin), (*_interruptFunction), FALLING );
|
||||||
DEBUG_PRINTLN("Using interrupt pin (not all pin is interrupted)");
|
DEBUG_PRINTLN("Using interrupt pin (not all pin is interrupted)");
|
||||||
::pinMode(_interruptPin, INPUT_PULLUP);
|
::pinMode(_interruptPin, INPUT_PULLUP);
|
||||||
attachInterrupt(digitalPinToInterrupt(_interruptPin), (*_interruptFunction), FALLING );
|
attachInterrupt(digitalPinToInterrupt(_interruptPin), (*_interruptFunction), CHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// inizialize last read
|
// inizialize last read
|
||||||
@ -196,9 +201,10 @@ void PCF8574::begin(){
|
|||||||
/**
|
/**
|
||||||
* Set if fin is OUTPUT or INPUT
|
* Set if fin is OUTPUT or INPUT
|
||||||
* @param pin: pin to set
|
* @param pin: pin to set
|
||||||
* @param mode: mode, supported only INPUT or OUTPUT (to semplify)
|
* @param mode: mode, supported only INPUT or OUTPUT (to simplify)
|
||||||
|
* @param output_start: output_start, for OUTPUT we can set initial value
|
||||||
*/
|
*/
|
||||||
void PCF8574::pinMode(uint8_t pin, uint8_t mode){
|
void PCF8574::pinMode(uint8_t pin, uint8_t mode, uint8_t output_start){
|
||||||
DEBUG_PRINT("Set pin ");
|
DEBUG_PRINT("Set pin ");
|
||||||
DEBUG_PRINT(pin);
|
DEBUG_PRINT(pin);
|
||||||
DEBUG_PRINT(" as ");
|
DEBUG_PRINT(" as ");
|
||||||
@ -206,26 +212,60 @@ void PCF8574::pinMode(uint8_t pin, uint8_t mode){
|
|||||||
|
|
||||||
if (mode == OUTPUT){
|
if (mode == OUTPUT){
|
||||||
writeMode = writeMode | bit(pin);
|
writeMode = writeMode | bit(pin);
|
||||||
|
if (output_start==HIGH) {
|
||||||
|
writeModeUp = writeModeUp | bit(pin);
|
||||||
|
}
|
||||||
|
|
||||||
readMode = readMode & ~bit(pin);
|
readMode = readMode & ~bit(pin);
|
||||||
DEBUG_PRINT("writeMode: ");
|
readModePullDown = readModePullDown & ~bit(pin);
|
||||||
|
readModePullUp = readModePullUp & ~bit(pin);
|
||||||
|
|
||||||
|
DEBUG_PRINT("W: ");
|
||||||
DEBUG_PRINT(writeMode, BIN);
|
DEBUG_PRINT(writeMode, BIN);
|
||||||
DEBUG_PRINT("readMode: ");
|
DEBUG_PRINT(" R ALL: ");
|
||||||
DEBUG_PRINTLN(readMode, BIN);
|
DEBUG_PRINT(readMode, BIN);
|
||||||
|
|
||||||
|
DEBUG_PRINT(" R Down: ");
|
||||||
|
DEBUG_PRINT(readModePullDown, BIN);
|
||||||
|
DEBUG_PRINT("R Up: ");
|
||||||
|
DEBUG_PRINTLN(readModePullUp, BIN);
|
||||||
|
|
||||||
}else if (mode == INPUT){
|
}else if (mode == INPUT){
|
||||||
writeMode = writeMode & ~bit(pin);
|
writeMode = writeMode & ~bit(pin);
|
||||||
|
|
||||||
readMode = readMode | bit(pin);
|
readMode = readMode | bit(pin);
|
||||||
DEBUG_PRINT("writeMode: ");
|
readModePullDown = readModePullDown | bit(pin);
|
||||||
|
readModePullUp = readModePullUp & ~bit(pin);
|
||||||
|
|
||||||
|
DEBUG_PRINT("W: ");
|
||||||
DEBUG_PRINT(writeMode, BIN);
|
DEBUG_PRINT(writeMode, BIN);
|
||||||
DEBUG_PRINT("readMode: ");
|
DEBUG_PRINT(" R ALL: ");
|
||||||
DEBUG_PRINTLN(readMode, BIN);
|
DEBUG_PRINT(readMode, BIN);
|
||||||
|
|
||||||
|
DEBUG_PRINT(" R Down: ");
|
||||||
|
DEBUG_PRINT(readModePullDown, BIN);
|
||||||
|
DEBUG_PRINT("R Up: ");
|
||||||
|
DEBUG_PRINTLN(readModePullUp, BIN);
|
||||||
|
}else if (mode == INPUT_PULLUP){
|
||||||
|
writeMode = writeMode & ~bit(pin);
|
||||||
|
|
||||||
|
readMode = readMode | bit(pin);
|
||||||
|
readModePullDown = readModePullDown & ~bit(pin);
|
||||||
|
readModePullUp = readModePullUp | bit(pin);
|
||||||
|
|
||||||
|
DEBUG_PRINT("W: ");
|
||||||
|
DEBUG_PRINT(writeMode, BIN);
|
||||||
|
DEBUG_PRINT(" R ALL: ");
|
||||||
|
DEBUG_PRINT(readMode, BIN);
|
||||||
|
|
||||||
|
DEBUG_PRINT(" R Down: ");
|
||||||
|
DEBUG_PRINT(readModePullDown, BIN);
|
||||||
|
DEBUG_PRINT("R Up: ");
|
||||||
|
DEBUG_PRINTLN(readModePullUp, BIN);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
DEBUG_PRINTLN("Mode non supported by PCF8574")
|
DEBUG_PRINTLN("Mode non supported by PCF8574")
|
||||||
}
|
}
|
||||||
DEBUG_PRINT("Write mode: ");
|
|
||||||
DEBUG_PRINTLN(writeMode, BIN);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,8 +279,9 @@ void PCF8574::readBuffer(bool force){
|
|||||||
if(_wire->available()) // If bytes are available to be recieved
|
if(_wire->available()) // If bytes are available to be recieved
|
||||||
{
|
{
|
||||||
byte iInput = _wire->read();// Read a byte
|
byte iInput = _wire->read();// Read a byte
|
||||||
if ((iInput & readMode)>0){
|
if ((iInput & readModePullDown)>0 and (~iInput & readModePullUp)>0){
|
||||||
byteBuffered = byteBuffered | (byte)iInput;
|
// if ((iInput & readMode)>0){
|
||||||
|
byteBuffered = (byteBuffered & ~readMode) | (byte)iInput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,13 +302,9 @@ void PCF8574::readBuffer(bool force){
|
|||||||
DEBUG_PRINTLN("Data ready");
|
DEBUG_PRINTLN("Data ready");
|
||||||
byte iInput = _wire->read();// Read a byte
|
byte iInput = _wire->read();// Read a byte
|
||||||
|
|
||||||
if ((iInput & readMode)>0){
|
if ((readModePullDown & iInput)>0 or (readModePullUp & ~iInput)>0){
|
||||||
DEBUG_PRINT("Input ");
|
DEBUG_PRINT(" -------- CHANGE --------- ");
|
||||||
DEBUG_PRINTLN((byte)iInput, BIN);
|
byteBuffered = (byteBuffered & ~readMode) | (byte)iInput;
|
||||||
|
|
||||||
byteBuffered = byteBuffered | (byte)iInput;
|
|
||||||
DEBUG_PRINT("byteBuffered ");
|
|
||||||
DEBUG_PRINTLN(byteBuffered, BIN);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,11 +320,11 @@ void PCF8574::readBuffer(bool force){
|
|||||||
if ((bit(6) & readMode)>0) digitalInput.p6 = ((byteBuffered & bit(6))>0)?HIGH:LOW;
|
if ((bit(6) & readMode)>0) digitalInput.p6 = ((byteBuffered & bit(6))>0)?HIGH:LOW;
|
||||||
if ((bit(7) & readMode)>0) digitalInput.p7 = ((byteBuffered & bit(7))>0)?HIGH:LOW;
|
if ((bit(7) & readMode)>0) digitalInput.p7 = ((byteBuffered & bit(7))>0)?HIGH:LOW;
|
||||||
|
|
||||||
if ((readMode & byteBuffered)>0){
|
//if ((byteBuffered & readModePullDown)>0 and (~byteBuffered & readModePullUp)>0){
|
||||||
byteBuffered = ~readMode & byteBuffered;
|
byteBuffered = (resetInitial & readMode) | (byteBuffered & ~readMode); //~readMode & byteBuffered;
|
||||||
DEBUG_PRINT("Buffer hight value readed set readed ");
|
DEBUG_PRINT("Buffer hight value readed set readed ");
|
||||||
DEBUG_PRINTLN(byteBuffered, BIN);
|
DEBUG_PRINTLN(byteBuffered, BIN);
|
||||||
}
|
//}
|
||||||
DEBUG_PRINT("Return value ");
|
DEBUG_PRINT("Return value ");
|
||||||
return digitalInput;
|
return digitalInput;
|
||||||
};
|
};
|
||||||
@ -306,13 +343,10 @@ void PCF8574::readBuffer(bool force){
|
|||||||
DEBUG_PRINTLN("Data ready");
|
DEBUG_PRINTLN("Data ready");
|
||||||
byte iInput = _wire->read();// Read a byte
|
byte iInput = _wire->read();// Read a byte
|
||||||
|
|
||||||
if ((iInput & readMode)>0){
|
if ((readModePullDown & iInput)>0 or (readModePullUp & ~iInput)>0){
|
||||||
DEBUG_PRINT("Input ");
|
DEBUG_PRINT(" -------- CHANGE --------- ");
|
||||||
DEBUG_PRINTLN((byte)iInput, BIN);
|
byteBuffered = (byteBuffered & ~readMode) | (byte)iInput;
|
||||||
|
|
||||||
byteBuffered = byteBuffered | (byte)iInput;
|
|
||||||
DEBUG_PRINT("byteBuffered ");
|
|
||||||
DEBUG_PRINTLN(byteBuffered, BIN);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,11 +355,11 @@ void PCF8574::readBuffer(bool force){
|
|||||||
|
|
||||||
byte byteRead = byteBuffered;
|
byte byteRead = byteBuffered;
|
||||||
|
|
||||||
if ((readMode & byteBuffered)>0){
|
//if ((byteBuffered & readModePullDown)>0 and (~byteBuffered & readModePullUp)>0){
|
||||||
byteBuffered = ~readMode & byteBuffered;
|
byteBuffered = (resetInitial & readMode) | (byteBuffered & ~readMode); //~readMode & byteBuffered;
|
||||||
DEBUG_PRINT("Buffer hight value readed set readed ");
|
DEBUG_PRINT("Buffer hight value readed set readed ");
|
||||||
DEBUG_PRINTLN(byteBuffered, BIN);
|
DEBUG_PRINTLN(byteBuffered, BIN);
|
||||||
}
|
//}
|
||||||
DEBUG_PRINT("Return value ");
|
DEBUG_PRINT("Return value ");
|
||||||
return byteRead;
|
return byteRead;
|
||||||
};
|
};
|
||||||
@ -338,45 +372,62 @@ void PCF8574::readBuffer(bool force){
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
uint8_t PCF8574::digitalRead(uint8_t pin){
|
uint8_t PCF8574::digitalRead(uint8_t pin){
|
||||||
uint8_t value = LOW;
|
uint8_t value = (bit(pin) & readModePullUp)?HIGH:LOW;
|
||||||
DEBUG_PRINT("Read pin ");
|
DEBUG_PRINT("Read pin ");
|
||||||
DEBUG_PRINTLN(pin);
|
DEBUG_PRINT (pin);
|
||||||
// Check if pin already HIGH than read and prevent reread of i2c
|
// Check if pin already HIGH than read and prevent reread of i2c
|
||||||
|
// DEBUG_PRINTLN("----------------------------------")
|
||||||
|
// DEBUG_PRINT("readModePullUp ");
|
||||||
|
// DEBUG_PRINTLN(readModePullUp, BIN);
|
||||||
|
// DEBUG_PRINT("readModePullDown ");
|
||||||
|
// DEBUG_PRINTLN(readModePullDown, BIN);
|
||||||
|
// DEBUG_PRINT("byteBuffered ");
|
||||||
|
// DEBUG_PRINTLN(byteBuffered, BIN);
|
||||||
|
|
||||||
|
|
||||||
|
if (((bit(pin) & (readModePullDown & byteBuffered))>0) or (bit(pin) & (readModePullUp & ~byteBuffered))>0 ){
|
||||||
|
DEBUG_PRINTLN(" ...Pin already set");
|
||||||
if ((bit(pin) & byteBuffered)>0){
|
if ((bit(pin) & byteBuffered)>0){
|
||||||
DEBUG_PRINTLN("Pin already up");
|
|
||||||
value = HIGH;
|
value = HIGH;
|
||||||
|
}else{
|
||||||
|
value = LOW;
|
||||||
|
}
|
||||||
}else if ((/*(bit(pin) & byteBuffered)<=0 && */millis() > PCF8574::lastReadMillis+READ_ELAPSED_TIME) /*|| _usingInterrupt*/){
|
}else if ((/*(bit(pin) & byteBuffered)<=0 && */millis() > PCF8574::lastReadMillis+READ_ELAPSED_TIME) /*|| _usingInterrupt*/){
|
||||||
DEBUG_PRINTLN("Read from buffer");
|
DEBUG_PRINT(" ...Read from buffer... ");
|
||||||
_wire->requestFrom(_address,(uint8_t)1);// Begin transmission to PCF8574 with the buttons
|
_wire->requestFrom(_address,(uint8_t)1);// Begin transmission to PCF8574 with the buttons
|
||||||
lastReadMillis = millis();
|
lastReadMillis = millis();
|
||||||
if(_wire->available()) // If bytes are available to be recieved
|
if(_wire->available()) // If bytes are available to be recieved
|
||||||
{
|
{
|
||||||
DEBUG_PRINTLN("Data ready");
|
DEBUG_PRINTLN(" Data ready");
|
||||||
byte iInput = _wire->read();// Read a byte
|
byte iInput = _wire->read();// Read a byte
|
||||||
|
|
||||||
if ((iInput & readMode)>0){
|
|
||||||
DEBUG_PRINT("Input ");
|
DEBUG_PRINT("Input ");
|
||||||
DEBUG_PRINTLN((byte)iInput, BIN);
|
DEBUG_PRINT((byte)iInput, BIN);
|
||||||
|
|
||||||
byteBuffered = byteBuffered | (byte)iInput;
|
|
||||||
DEBUG_PRINT("byteBuffered ");
|
|
||||||
DEBUG_PRINTLN(byteBuffered, BIN);
|
|
||||||
|
|
||||||
|
if ((readModePullDown & iInput)>0 or (readModePullUp & ~iInput)>0){
|
||||||
|
DEBUG_PRINT(" -------- CHANGE --------- ");
|
||||||
|
byteBuffered = (byteBuffered & ~readMode) | (byte)iInput;
|
||||||
if ((bit(pin) & byteBuffered)>0){
|
if ((bit(pin) & byteBuffered)>0){
|
||||||
value = HIGH;
|
value = HIGH;
|
||||||
|
}else{
|
||||||
|
value = LOW;
|
||||||
|
}
|
||||||
|
// value = (bit(pin) & byteBuffered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
DEBUG_PRINT(" ..Buffer value ");
|
||||||
DEBUG_PRINT("Buffer value ");
|
DEBUG_PRINT(byteBuffered, BIN);
|
||||||
DEBUG_PRINTLN(byteBuffered, BIN);
|
|
||||||
// If HIGH set to low to read buffer only one time
|
// If HIGH set to low to read buffer only one time
|
||||||
if (value==HIGH){
|
if ((bit(pin) & readModePullDown) and value==HIGH){
|
||||||
byteBuffered = ~bit(pin) & byteBuffered;
|
byteBuffered = bit(pin) ^ byteBuffered;
|
||||||
DEBUG_PRINT("Buffer hight value readed set readed ");
|
DEBUG_PRINT(" ...Buffer hight value readed set readed ");
|
||||||
DEBUG_PRINTLN(byteBuffered, BIN);
|
DEBUG_PRINT (byteBuffered, BIN);
|
||||||
|
}else if ((bit(pin) & readModePullUp) and value==LOW){
|
||||||
|
byteBuffered = bit(pin) ^ byteBuffered;
|
||||||
|
DEBUG_PRINT(" ...Buffer low value readed set readed ");
|
||||||
|
DEBUG_PRINT(byteBuffered, BIN);
|
||||||
}
|
}
|
||||||
DEBUG_PRINT("Return value ");
|
DEBUG_PRINT(" ...Return value ");
|
||||||
DEBUG_PRINTLN(value);
|
DEBUG_PRINTLN(value);
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
@ -389,10 +440,17 @@ uint8_t PCF8574::digitalRead(uint8_t pin){
|
|||||||
void PCF8574::digitalWrite(uint8_t pin, uint8_t value){
|
void PCF8574::digitalWrite(uint8_t pin, uint8_t value){
|
||||||
DEBUG_PRINTLN("Begin trasmission");
|
DEBUG_PRINTLN("Begin trasmission");
|
||||||
_wire->beginTransmission(_address); //Begin the transmission to PCF8574
|
_wire->beginTransmission(_address); //Begin the transmission to PCF8574
|
||||||
|
DEBUG_PRINT("Value ");
|
||||||
|
DEBUG_PRINT(value);
|
||||||
|
DEBUG_PRINT(" Write data pre ");
|
||||||
|
DEBUG_PRINT(writeByteBuffered, BIN);
|
||||||
|
|
||||||
if (value==HIGH){
|
if (value==HIGH){
|
||||||
writeByteBuffered = writeByteBuffered | bit(pin);
|
writeByteBuffered = writeByteBuffered | bit(pin);
|
||||||
|
byteBuffered = writeByteBuffered | bit(pin);
|
||||||
}else{
|
}else{
|
||||||
writeByteBuffered = writeByteBuffered & ~bit(pin);
|
writeByteBuffered = writeByteBuffered & ~bit(pin);
|
||||||
|
byteBuffered = writeByteBuffered & ~bit(pin);
|
||||||
}
|
}
|
||||||
DEBUG_PRINT("Write data ");
|
DEBUG_PRINT("Write data ");
|
||||||
DEBUG_PRINT(writeByteBuffered, BIN);
|
DEBUG_PRINT(writeByteBuffered, BIN);
|
||||||
@ -401,10 +459,15 @@ void PCF8574::digitalWrite(uint8_t pin, uint8_t value){
|
|||||||
DEBUG_PRINT(" bin value ");
|
DEBUG_PRINT(" bin value ");
|
||||||
DEBUG_PRINT(bit(pin), BIN);
|
DEBUG_PRINT(bit(pin), BIN);
|
||||||
DEBUG_PRINT(" value ");
|
DEBUG_PRINT(" value ");
|
||||||
DEBUG_PRINTLN(value);
|
DEBUG_PRINT(value);
|
||||||
|
|
||||||
writeByteBuffered = writeByteBuffered & writeMode;
|
// writeByteBuffered = writeByteBuffered & (~writeMode & byteBuffered);
|
||||||
_wire->write(writeByteBuffered);
|
byteBuffered = (writeByteBuffered & writeMode) | (resetInitial & readMode);
|
||||||
|
DEBUG_PRINT(" byteBuffered ");
|
||||||
|
DEBUG_PRINTLN(byteBuffered, BIN);
|
||||||
|
|
||||||
|
_wire->write(byteBuffered);
|
||||||
|
// byteBuffered = (writeByteBuffered & writeMode) & (byteBuffered & readMode);
|
||||||
DEBUG_PRINTLN("Start end trasmission if stop here check pullup resistor.");
|
DEBUG_PRINTLN("Start end trasmission if stop here check pullup resistor.");
|
||||||
|
|
||||||
_wire->endTransmission();
|
_wire->endTransmission();
|
||||||
|
15
PCF8574.h
15
PCF8574.h
@ -45,6 +45,9 @@
|
|||||||
// Uncomment for low memory usage this prevent use of complex DigitalInput structure and free 7byte of memory
|
// Uncomment for low memory usage this prevent use of complex DigitalInput structure and free 7byte of memory
|
||||||
// #define PCF8574_LOW_MEMORY
|
// #define PCF8574_LOW_MEMORY
|
||||||
|
|
||||||
|
// Uncomment for low memory usage this prevent use of complex DigitalInput structure and free 7byte of memory
|
||||||
|
// #define PCF8574_LOW_LATENCY
|
||||||
|
|
||||||
// Define where debug output will be printed.
|
// Define where debug output will be printed.
|
||||||
#define DEBUG_PRINTER Serial
|
#define DEBUG_PRINTER Serial
|
||||||
|
|
||||||
@ -57,7 +60,11 @@
|
|||||||
#define DEBUG_PRINTLN(...) {}
|
#define DEBUG_PRINTLN(...) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define READ_ELAPSED_TIME 10
|
#ifdef PCF8574_LOW_LATENCY
|
||||||
|
#define READ_ELAPSED_TIME 1
|
||||||
|
#else
|
||||||
|
#define READ_ELAPSED_TIME 10
|
||||||
|
#endif
|
||||||
|
|
||||||
//#define P0 B00000001
|
//#define P0 B00000001
|
||||||
//#define P1 B00000010
|
//#define P1 B00000010
|
||||||
@ -101,7 +108,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void begin();
|
void begin();
|
||||||
void pinMode(uint8_t pin, uint8_t mode);
|
void pinMode(uint8_t pin, uint8_t mode, uint8_t output_start = HIGH);
|
||||||
|
|
||||||
void readBuffer(bool force = true);
|
void readBuffer(bool force = true);
|
||||||
uint8_t digitalRead(uint8_t pin);
|
uint8_t digitalRead(uint8_t pin);
|
||||||
@ -146,8 +153,12 @@ private:
|
|||||||
void (*_interruptFunction)(){};
|
void (*_interruptFunction)(){};
|
||||||
|
|
||||||
byte writeMode = B00000000;
|
byte writeMode = B00000000;
|
||||||
|
byte writeModeUp = B00000000;
|
||||||
byte readMode = B00000000;
|
byte readMode = B00000000;
|
||||||
|
byte readModePullUp = B00000000;
|
||||||
|
byte readModePullDown = B00000000;
|
||||||
byte byteBuffered = B00000000;
|
byte byteBuffered = B00000000;
|
||||||
|
byte resetInitial = B00000000;
|
||||||
unsigned long lastReadMillis = 0;
|
unsigned long lastReadMillis = 0;
|
||||||
|
|
||||||
byte writeByteBuffered = B00000000;
|
byte writeByteBuffered = B00000000;
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
### If you need more pins [here](https://www.mischianti.org/2019/07/22/pcf8575-i2c-16-bit-digital-i-o-expander/) you can find pcf8575 16bit version of the IC.
|
### If you need more pins [here](https://www.mischianti.org/2019/07/22/pcf8575-i2c-16-bit-digital-i-o-expander/) you can find pcf8575 16bit version of the IC.
|
||||||
|
|
||||||
|
### Version 2.0
|
||||||
|
|
||||||
Library to use i2c analog IC with arduino and esp8266. Can read and write digital value with only 2 wire (perfect for ESP-01).
|
Library to use i2c analog IC with arduino and esp8266. Can read and write digital value with only 2 wire (perfect for ESP-01).
|
||||||
|
|
||||||
Tutorial:
|
Tutorial:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=PCF8574 library
|
name=PCF8574 library
|
||||||
version=1.2.0
|
version=2.0.0
|
||||||
author=Reef
|
author=Reef
|
||||||
maintainer=Renzo Mischianti <renzo.mischianti@gmail.com>
|
maintainer=Renzo Mischianti <renzo.mischianti@gmail.com>
|
||||||
sentence=Arduino/ESP8266 library for PCF8574
|
sentence=Arduino/ESP8266 library for PCF8574
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user