From f2834c1cccb799f9622a3483cfd14708dcf69630 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 4 Nov 2023 19:34:51 +0800 Subject: [PATCH] update --- chip/zgpio.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chip/zgpio.cpp b/chip/zgpio.cpp index 02d1d45..bd4742d 100644 --- a/chip/zgpio.cpp +++ b/chip/zgpio.cpp @@ -140,6 +140,7 @@ void ZGPIO::initAsInput(Pin_t pin, GPIOMode_t mode, GPIOIrqType_t irqtype, bool m_irqtype = irqtype; m_gpiotype = kType_Input; + m_pin = pin; m_gpio = chip_get_gpio(pin); m_pinoff = chip_get_pinoff(pin); @@ -194,7 +195,7 @@ void ZGPIO::initAsOutput(Pin_t pin, GPIOMode_t mode, bool mirror, bool initLevel m_mode = mode; m_irqtype = kIRQ_noIrq; m_gpiotype = kType_Output; - + m_pin = pin; m_gpio = chip_get_gpio(pin); m_pinoff = chip_get_pinoff(pin); @@ -314,7 +315,7 @@ bool ZGPIO::getState() { } bool ZGPIO::setState(bool state) { if (m_pin == PinNull) return true; - + if (m_mirror) state = !state; if (m_log_when_setstate) ZEARLY_LOGI(TAG, "%s%s set %d", chip_gpio_group_get_name(m_gpio), chip_pinoff_get_name(m_pinoff), state);