Skip to content

Commit

Permalink
Experimental-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
skywodd committed Aug 31, 2013
1 parent ab2074e commit 86b5705
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions PCF8574/PCF8574.cpp
Expand Up @@ -36,6 +36,7 @@ void PCF8574::begin(uint8_t address) {
/* Store the I2C address and init the Wire library */
_address = address;
Wire.begin();
readGPIO();
}

void PCF8574::pinMode(uint8_t pin, uint8_t mode) {
Expand Down Expand Up @@ -178,7 +179,7 @@ void PCF8574::enableInterrupt(uint8_t pin, void (*selfCheckFunction)(void)) {
#endif

/* Attach interrupt handler */
PCattachInterrupt(pin, selfCheckFunction, CHANGE);
PCattachInterrupt(pin, selfCheckFunction, FALLING);
}

void PCF8574::disableInterrupt() {
Expand All @@ -194,6 +195,7 @@ void PCF8574::checkForInterrupt() {

/* Read current pins values */
readGPIO();
cli();

/* Check all pins */
for (uint8_t i = 0; i < 8; ++i) {
Expand Down Expand Up @@ -259,7 +261,7 @@ void PCF8574::readGPIO() {
void PCF8574::updateGPIO() {

/* Read current GPIO states */
//readGPIO();
readGPIO();

/* Compute new GPIO states */
uint8_t value = (_PIN & ~_DDR) | _PORT;
Expand Down

0 comments on commit 86b5705

Please sign in to comment.