mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 10:14:13 +01:00
Fix xl9535 pin reads (#6242)
This commit is contained in:
parent
342fb72b6a
commit
967259a212
1 changed files with 2 additions and 2 deletions
|
@ -36,14 +36,14 @@ bool XL9535Component::digital_read(uint8_t pin) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
state = (port & (pin - 10)) != 0;
|
state = (port & (1 << (pin - 10))) != 0;
|
||||||
} else {
|
} else {
|
||||||
if (this->read_register(XL9535_INPUT_PORT_0_REGISTER, &port, 1) != i2c::ERROR_OK) {
|
if (this->read_register(XL9535_INPUT_PORT_0_REGISTER, &port, 1) != i2c::ERROR_OK) {
|
||||||
this->status_set_warning();
|
this->status_set_warning();
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
state = (port & pin) != 0;
|
state = (port & (1 << pin)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->status_clear_warning();
|
this->status_clear_warning();
|
||||||
|
|
Loading…
Reference in a new issue