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

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();