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