Browse Source

update

master
zhaohe 2 years ago
parent
commit
f2834c1ccc
  1. 5
      chip/zgpio.cpp

5
chip/zgpio.cpp

@ -140,6 +140,7 @@ void ZGPIO::initAsInput(Pin_t pin, GPIOMode_t mode, GPIOIrqType_t irqtype, bool
m_irqtype = irqtype; m_irqtype = irqtype;
m_gpiotype = kType_Input; m_gpiotype = kType_Input;
m_pin = pin;
m_gpio = chip_get_gpio(pin); m_gpio = chip_get_gpio(pin);
m_pinoff = chip_get_pinoff(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_mode = mode;
m_irqtype = kIRQ_noIrq; m_irqtype = kIRQ_noIrq;
m_gpiotype = kType_Output; m_gpiotype = kType_Output;
m_pin = pin;
m_gpio = chip_get_gpio(pin); m_gpio = chip_get_gpio(pin);
m_pinoff = chip_get_pinoff(pin); m_pinoff = chip_get_pinoff(pin);
@ -314,7 +315,7 @@ bool ZGPIO::getState() {
} }
bool ZGPIO::setState(bool state) { bool ZGPIO::setState(bool state) {
if (m_pin == PinNull) return true; if (m_pin == PinNull) return true;
if (m_mirror) state = !state; 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); 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);

Loading…
Cancel
Save