risc-v/esp32c3: Allow pin to be configured as Input and Output simultaneously

This commit is contained in:
Gustavo Henrique Nihei 2021-03-02 11:08:32 -03:00 committed by Xiang Xiao
parent 85620c3c1a
commit bc335009d9
1 changed files with 6 additions and 6 deletions

View File

@ -134,11 +134,15 @@ int esp32c3_configgpio(int pin, gpio_pinattr_t attr)
{
putreg32((1ul << pin), GPIO_ENABLE_W1TC_REG);
/* Input enable */
func |= FUN_IE;
if ((attr & PULLUP) != 0)
{
func |= FUN_PU;
}
else if (attr & PULLDOWN)
else if ((attr & PULLDOWN) != 0)
{
func |= FUN_PD;
}
@ -146,7 +150,7 @@ int esp32c3_configgpio(int pin, gpio_pinattr_t attr)
/* Handle output pins */
else if ((attr & OUTPUT) != 0)
if ((attr & OUTPUT) != 0)
{
putreg32((1ul << pin), GPIO_ENABLE_W1TS_REG);
}
@ -155,10 +159,6 @@ int esp32c3_configgpio(int pin, gpio_pinattr_t attr)
func |= (uint32_t)(2ul << FUN_DRV_S);
/* Input enable... Required for output as well? */
func |= FUN_IE;
/* Select the pad's function. If no function was given, consider it a
* normal input or output (i.e. function3).
*/