[nrf52,gpio] switch input gpio to polling mode (#11664)

This commit is contained in:
tomaszduda23
2025-11-02 23:19:28 +01:00
committed by GitHub
parent 338190abec
commit 70ea3af578
2 changed files with 8 additions and 4 deletions

View File

@@ -39,6 +39,7 @@ CONFIG_SCHEMA = (
# due to hardware limitations or lack of reliable interrupt support. This ensures
# stable operation on these platforms. Future maintainers should verify platform
# capabilities before changing this default behavior.
# nrf52 has no gpio interrupts implemented yet
cv.SplitDefault(
CONF_USE_INTERRUPT,
bk72xx=False,
@@ -46,7 +47,7 @@ CONFIG_SCHEMA = (
esp8266=True,
host=True,
ln882x=False,
nrf52=True,
nrf52=False,
rp2040=True,
rtl87xx=False,
): cv.boolean,

View File

@@ -8,8 +8,8 @@ namespace zephyr {
static const char *const TAG = "zephyr";
static int flags_to_mode(gpio::Flags flags, bool inverted, bool value) {
int ret = 0;
static gpio_flags_t flags_to_mode(gpio::Flags flags, bool inverted, bool value) {
gpio_flags_t ret = 0;
if (flags & gpio::FLAG_INPUT) {
ret |= GPIO_INPUT;
}
@@ -79,7 +79,10 @@ void ZephyrGPIOPin::pin_mode(gpio::Flags flags) {
if (nullptr == this->gpio_) {
return;
}
gpio_pin_configure(this->gpio_, this->pin_ % 32, flags_to_mode(flags, this->inverted_, this->value_));
auto ret = gpio_pin_configure(this->gpio_, this->pin_ % 32, flags_to_mode(flags, this->inverted_, this->value_));
if (ret != 0) {
ESP_LOGE(TAG, "gpio %u cannot be configured %d.", this->pin_, ret);
}
}
std::string ZephyrGPIOPin::dump_summary() const {