From 672aca8258a569732e2f5957162ba8ce22d65873 Mon Sep 17 00:00:00 2001 From: Stefan Krupop Date: Fri, 26 Jul 2024 20:18:55 +0200 Subject: [PATCH] Fixed resetting interrupt --- components/services/gpio_exp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/services/gpio_exp.c b/components/services/gpio_exp.c index 126b7b270..a284e7744 100644 --- a/components/services/gpio_exp.c +++ b/components/services/gpio_exp.c @@ -689,7 +689,9 @@ static void aw9523_set_direction(gpio_exp_t* self) { } static uint32_t aw9523_read(gpio_exp_t* self) { - return i2c_read(self->phy.port, self->phy.addr, 0x00, 2); + // Reading both registers in one go does not seem to reset IRQ correctly + uint8_t port1 = i2c_read(self->phy.port, self->phy.addr, 0x00, 1); + return (i2c_read(self->phy.port, self->phy.addr, 0x01, 1) << 8) | port1; } static void aw9523_write(gpio_exp_t* self) { @@ -818,4 +820,4 @@ static uint32_t spi_read(spi_device_handle_t handle, uint8_t addr, uint8_t reg, free(transaction); return data; -} \ No newline at end of file +}