Fix xl9535 pin reads (#6242)

This commit is contained in:
Jesse Hills 2024-02-19 16:44:18 +13:00 committed by GitHub
parent 342fb72b6a
commit 967259a212
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -36,14 +36,14 @@ bool XL9535Component::digital_read(uint8_t pin) {
return state;
}
state = (port & (pin - 10)) != 0;
state = (port & (1 << (pin - 10))) != 0;
} else {
if (this->read_register(XL9535_INPUT_PORT_0_REGISTER, &port, 1) != i2c::ERROR_OK) {
this->status_set_warning();
return state;
}
state = (port & pin) != 0;
state = (port & (1 << pin)) != 0;
}
this->status_clear_warning();