From 53113e981d317924be42348feb6f32e5abe63e9d Mon Sep 17 00:00:00 2001 From: Neil McKechnie Date: Sun, 21 Nov 2021 17:56:06 +0000 Subject: [PATCH] Update IO_PCF8574.h Correct handling of input in immediate mode, --- IO_PCF8574.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IO_PCF8574.h b/IO_PCF8574.h index dea5e2c..58c4654 100644 --- a/IO_PCF8574.h +++ b/IO_PCF8574.h @@ -75,7 +75,7 @@ private: if (immediate) { uint8_t buffer[1]; I2CManager.read(_I2CAddress, buffer, 1); - _portInputState = ((uint16_t)buffer) & 0xff; + _portInputState = buffer[0]; } else { requestBlock.wait(); // Wait for preceding operation to complete // Issue new request to read GPIO register @@ -86,7 +86,7 @@ private: // This function is invoked when an I/O operation on the requestBlock completes. void _processCompletion(uint8_t status) override { if (status == I2C_STATUS_OK) - _portInputState = ((uint16_t)inputBuffer[0]) & 0xff; + _portInputState = inputBuffer[0]; else _portInputState = 0xff; }