diff options
| author | greedyhao <[email protected]> | 2021-11-08 10:06:44 +0800 |
|---|---|---|
| committer | greedyhao <[email protected]> | 2021-11-08 10:06:44 +0800 |
| commit | 9d27d8c94bc012633346cbe8bb6ccd4b5fdc5a9d (patch) | |
| tree | 7a590493e09a6b05731a980add219e3fb1e0945f | |
| parent | 8e0c469d0c2f4379e6958462241a5e0b0b6aa466 (diff) | |
[bluetrum] add gpio input nopull
| -rw-r--r-- | bsp/bluetrum/libraries/hal_drivers/drv_gpio.c | 3 | ||||
| -rw-r--r-- | bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal_gpio.c | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/bsp/bluetrum/libraries/hal_drivers/drv_gpio.c b/bsp/bluetrum/libraries/hal_drivers/drv_gpio.c index a99f5561ca..0ba351d584 100644 --- a/bsp/bluetrum/libraries/hal_drivers/drv_gpio.c +++ b/bsp/bluetrum/libraries/hal_drivers/drv_gpio.c @@ -128,6 +128,9 @@ static void ab32_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) switch (mode) { case PIN_MODE_INPUT: + gpio_init.pull = GPIO_NOPULL; + gpio_init.dir = GPIO_DIR_INPUT; + break; case PIN_MODE_INPUT_PULLUP: gpio_init.pull = GPIO_PULLUP; gpio_init.dir = GPIO_DIR_INPUT; diff --git a/bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal_gpio.c b/bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal_gpio.c index 0a3fe31844..7b1601befd 100644 --- a/bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal_gpio.c +++ b/bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal_gpio.c @@ -72,12 +72,16 @@ void hal_gpio_init(hal_sfr_t gpiox, gpio_init_t gpio_init) switch (gpio_init->pull) { case GPIO_PULLUP: + gpiox[GPIOxPD] &= ~BIT(iocurrent); gpiox[GPIOxPU] |= BIT(iocurrent); break; case GPIO_PULLDOWN: + gpiox[GPIOxPU] &= ~BIT(iocurrent); gpiox[GPIOxPD] |= BIT(iocurrent); break; case GPIO_NOPULL: + gpiox[GPIOxPU] &= ~BIT(iocurrent); + gpiox[GPIOxPD] &= ~BIT(iocurrent); default: break; } |
