|
|
@ -136,7 +136,7 @@ void ZGPIO::initAsInput(Pin_t pin, GPIOMode_t mode, GPIOIrqType_t irqtype, bool |
|
|
|
m_mirror = mirror; |
|
|
|
m_mode = mode; |
|
|
|
m_irqtype = irqtype; |
|
|
|
m_gpiotype = kInput; |
|
|
|
m_gpiotype = kType_Input; |
|
|
|
|
|
|
|
m_gpio = chip_get_gpio(pin); |
|
|
|
m_pinoff = chip_get_pinoff(pin); |
|
|
@ -178,7 +178,7 @@ void ZGPIO::initAsOutput(Pin_t pin, GPIOMode_t mode, bool mirror, bool initLevel |
|
|
|
m_mirror = mirror; |
|
|
|
m_mode = mode; |
|
|
|
m_irqtype = kIRQ_noIrq; |
|
|
|
m_gpiotype = kOutput; |
|
|
|
m_gpiotype = kType_Output; |
|
|
|
|
|
|
|
m_gpio = chip_get_gpio(pin); |
|
|
|
m_pinoff = chip_get_pinoff(pin); |
|
|
@ -189,25 +189,23 @@ void ZGPIO::initAsOutput(Pin_t pin, GPIOMode_t mode, bool mirror, bool initLevel |
|
|
|
initLevel = m_mirror ? !initLevel : initLevel; |
|
|
|
GPIO_PinState pinState = initLevel ? GPIO_PIN_SET : GPIO_PIN_RESET; |
|
|
|
|
|
|
|
if (m_mode == kOutput_nopull || m_mode == kOutput_pullup || m_mode == kOutput_pulldown || m_mode == kOutput_od) { |
|
|
|
HAL_GPIO_WritePin(m_gpio, m_pinoff, pinState); |
|
|
|
} |
|
|
|
if (m_mode == kOutput_nopull) { |
|
|
|
HAL_GPIO_WritePin(m_gpio, m_pinoff, pinState); |
|
|
|
if (m_mode == kMode_nopull) { |
|
|
|
m_GPIO_InitStruct.Pin = m_pinoff; |
|
|
|
m_GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
|
|
|
m_GPIO_InitStruct.Pull = GPIO_NOPULL; |
|
|
|
m_GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
|
|
|
} else if (m_mode == kOutput_pullup) { |
|
|
|
} else if (m_mode == kMode_pullup) { |
|
|
|
m_GPIO_InitStruct.Pin = m_pinoff; |
|
|
|
m_GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
|
|
|
m_GPIO_InitStruct.Pull = GPIO_PULLUP; |
|
|
|
m_GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
|
|
|
} else if (m_mode == kOutput_pulldown) { |
|
|
|
} else if (m_mode == kMode_pulldown) { |
|
|
|
m_GPIO_InitStruct.Pin = m_pinoff; |
|
|
|
m_GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
|
|
|
m_GPIO_InitStruct.Pull = GPIO_PULLDOWN; |
|
|
|
m_GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
|
|
|
} else if (m_mode == kOutput_od) { |
|
|
|
} else if (m_mode == kMode_od) { |
|
|
|
m_GPIO_InitStruct.Pin = m_pinoff; |
|
|
|
m_GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD; |
|
|
|
m_GPIO_InitStruct.Pull = 0; |
|
|
|