PCF8574 input pin initialization fix (#17499)

* step1 - quick test patch

* mistake, pullup should be disabled

* 2nd test version

* refactoring

* final
This commit is contained in:
Barbudor 2022-12-23 21:17:24 +01:00 committed by GitHub
parent 9f23151f78
commit 4a47514a25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -123,7 +123,9 @@ void Pcf8574Init(void)
Pcf8574.max_connected_ports = 0; // reset no of devices to avoid duplicate ports on duplicate init.
for (uint32_t idx = 0; idx < Pcf8574.max_devices; idx++) { // suport up to 8 boards PCF8574
uint8_t gpio = Pcf8574Read(idx);
Pcf8574.pin_mask[idx] = gpio;
// Insure the input pins are actually writen a 1 for proper input operation
Pcf8574.pin_mask[idx] = gpio | ~Settings->pcf8574_config[idx];
Pcf8574Write(idx); // Write back to the register
#ifdef USE_PCF8574_MQTTINPUT
Pcf8574.last_input[idx] = gpio & ~Settings->pcf8574_config[idx];
#endif // #ifdef USE_PCF8574_MQTTINPUT