mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
Minor bug fixes on PCA9554 driver
This commit is contained in:
parent
11c5638782
commit
e2e7e5b71c
|
@ -57,16 +57,16 @@ private:
|
||||||
|
|
||||||
}
|
}
|
||||||
void _writePortModes() override {
|
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
|
// 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);
|
I2CManager.write(_I2CAddress, 2, REG_CONF_P0, temp);
|
||||||
}
|
}
|
||||||
void _readGpioPort(bool immediate) override {
|
void _readGpioPort(bool immediate) override {
|
||||||
if (immediate) {
|
if (immediate) {
|
||||||
uint8_t buffer[2];
|
uint8_t buffer[2];
|
||||||
I2CManager.read(_I2CAddress, buffer, 1, 1, REG_INPUT_P0);
|
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
|
/* 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
|
* after a Read operation to the PCA9554 device or before reading from
|
||||||
* another device"
|
* another device"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user