AliOS-Things icon indicating copy to clipboard operation
AliOS-Things copied to clipboard

MCU esp8266 hal_gpio_init 和 hal_gpio_input_get GPIO16 input bug

Open seblee opened this issue 7 years ago • 0 comments

Describe the bug platform/mcu/esp8266/hal/gpio.c hal_gpio_init 函数无法初始化gpio16 hal_gpio_input_get 无法get gpio16 状态 environment

  1. branch(version): rel_2.1.0
  2. Desktop OS(windows linux or macOS):windows vs code + alios studio
  3. example: xxxxxxxx@esp8266 4.

Expected behavior

Screenshots hal_gpio_init Line44 没有判断config,直接配置成输出了 看图 image 改为

    if (gpio->port == 16)
    {
        if (
            (gpio->config == OUTPUT_PUSH_PULL) ||
            (gpio->config == OUTPUT_OPEN_DRAIN_NO_PULL) ||
            (gpio->config == OUTPUT_OPEN_DRAIN_PULL_UP))
        {
            gpio16_output_conf();
            return 0;
        }
        else if ((gpio->config == INPUT_PULL_UP) ||
                 (gpio->config == INPUT_PULL_DOWN) ||
                 (gpio->config == INPUT_HIGH_IMPEDANCE))
        {
            gpio16_input_conf();
            return 0;
        }
        return EIO;
    }

hal_gpio_input_get Line178 下面少个 return 0 image 改为

int32_t hal_gpio_input_get(aos_gpio_dev_t *gpio, uint32_t *value)
{
    if (gpio == NULL || value == NULL)
    {
        return EIO;
    }
    if (gpio->port == 16)
    {
        *value = gpio16_input_get();
        return 0;
    }
    *value = GPIO_INPUT_GET(gpio->port);

    return 0;
}

Additional context

seblee avatar Jul 12 '19 14:07 seblee