Closed hfakkiz closed 6 months ago
This PR is related to this one: https://github.com/Analog-Devices-MSDK/msdk/pull/866
The final changes should be consistent across these two PRs.
@sihyung-maxim correct the changes shall be consistent.
Default pullup pulldown shall be "MXC_GPIO_PAD_PULL_UP" and "MXC_GPIO_PAD_PULL_DOWN" to be consistent and simplify things. The below configuration will work on Zephyr side.
gpio.h file
typedef enum {
MXC_GPIO_PAD_NONE, ///< No pull-up or pull-down
MXC_GPIO_PAD_PULL_UP, ///< Set pad to weak pull-up
MXC_GPIO_PAD_PULL_DOWN, ///< Set pad to weak pull-down
MXC_GPIO_PAD_WEAK_PULL_UP = MXC_GPIO_PAD_PULL_UP, ///< Set pad to weak pull-up
MXC_GPIO_PAD_WEAK_PULL_DOWN = MXC_GPIO_PAD_PULL_DOWN, ///< Set pad to weak pull-down
} mxc_gpio_pad_t;
gpio_me12.c file
switch (cfg->pad) {
case MXC_GPIO_PAD_NONE:
gpio->padctrl0 &= ~cfg->mask;
break;
case MXC_GPIO_PAD_PULL_UP:
gpio->padctrl0 |= cfg->mask;
gpio->ps |= cfg->mask;
break;
case MXC_GPIO_PAD_PULL_DOWN:
gpio->padctrl0 |= cfg->mask;
gpio->ps &= ~cfg->mask;
break;
default:
return E_BAD_PARAM;
}
@sihyung-maxim correct the changes shall be consistent.
Default pullup pulldown shall be "MXC_GPIO_PAD_PULL_UP" and "MXC_GPIO_PAD_PULL_DOWN" to be consistent and simplify things. The below configuration will work on Zephyr side.
gpio.h file
typedef enum { MXC_GPIO_PAD_NONE, ///< No pull-up or pull-down MXC_GPIO_PAD_PULL_UP, ///< Set pad to weak pull-up MXC_GPIO_PAD_PULL_DOWN, ///< Set pad to weak pull-down MXC_GPIO_PAD_WEAK_PULL_UP = MXC_GPIO_PAD_PULL_UP, ///< Set pad to weak pull-up MXC_GPIO_PAD_WEAK_PULL_DOWN = MXC_GPIO_PAD_PULL_DOWN, ///< Set pad to weak pull-down } mxc_gpio_pad_t;
gpio_me12.c file
switch (cfg->pad) { case MXC_GPIO_PAD_NONE: gpio->padctrl0 &= ~cfg->mask; break; case MXC_GPIO_PAD_PULL_UP: gpio->padctrl0 |= cfg->mask; gpio->ps |= cfg->mask; break; case MXC_GPIO_PAD_PULL_DOWN: gpio->padctrl0 |= cfg->mask; gpio->ps &= ~cfg->mask; break; default: return E_BAD_PARAM; }
Updated code as this.
Pull Request Template
Description
ME12 only supports high-impedance, weak pullup and weak pulldown options.
This commit removes other options and corrects related register values of PAD configuration.
Checklist Before Requesting Review