Skip to content

Commit

Permalink
Minor bug fixes on PCA9554 driver
Browse files Browse the repository at this point in the history
  • Loading branch information
pmantoine committed Sep 30, 2024
1 parent 11c5638 commit e2e7e5b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions IO_PCA9554.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ class PCA9554 : public GPIOBase<uint8_t> {

}
void _writePortModes() override {
// Write 0 to REG_CONF_P0 & REG_CONF_P1 for in-use pins that are outputs, 1 for others.
// Write 0 to REG_CONF_P0 for in-use pins that are outputs, 1 for inputs.
// PCA9554 & TCA9555, Interrupt is always enabled for raising and falling edge
uint16_t temp = ~(_portMode & _portInUse);
uint8_t temp = ~(_portMode & _portInUse);
I2CManager.write(_I2CAddress, 2, REG_CONF_P0, temp);
}
void _readGpioPort(bool immediate) override {
if (immediate) {
uint8_t buffer[2];
I2CManager.read(_I2CAddress, buffer, 1, 1, REG_INPUT_P0);
_portInputState = buffer[0];
_portInputState = buffer[0] | _portMode;
/* PCA9554 Int bug fix, from PCA9554 datasheet: "must change command byte to something besides 00h
* after a Read operation to the PCA9554 device or before reading from
* another device"
Expand Down

0 comments on commit e2e7e5b

Please sign in to comment.