原SDK如下,无法进行GPIO输入操作:
if (config->pinDirection == kGPIO_DigitalInput)
{
base->PDDR &= ~(1U << ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT)));
}
else
{
GPIO_PinWrite(port, pin, config->outputLogic);
base->PDDR |= (1U << ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT)));
}
改成下列后,可以进行GPIO输入操作了
if (config->pinDirection == kGPIO_DigitalInput)
{
base->PDDR &= ~(1U << ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT)));
base->PIDR &= ~(1U << ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT)));
}
else
{
GPIO_PinWrite(port, pin, config->outputLogic);
base->PDDR |= (1U << ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT)));
base->PIDR |= (1U << ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT)));
}
是否原SDK有问题?还是我的方法有问题?
Hi Yudong:
Thank you for your feedback. PIDR register should be configured. Let me discuss with the soft team and get it back to you later.
Regards
Daniel