gpt4 book ai didi

c - ESP8266 GPIO 16 不能用作按钮

转载 作者:行者123 更新时间:2023-11-30 14:44:25 24 4
gpt4 key购买 nike

我有以下代码,但看不到任何日志消息:

void gpio_int_cb(int pin, void *arg) {
LOG(LL_INFO, ("button pushed"));
(void) pin;
(void) arg;
}

extern "C" enum mgos_app_init_result mgos_app_init(void) {

int pin_button = 16;

mgos_gpio_set_pull(pin_button, MGOS_GPIO_PULL_DOWN);
mgos_gpio_set_mode(pin_button, MGOS_GPIO_MODE_INPUT);
mgos_gpio_enable_int(pin_button);
mgos_gpio_set_int_handler(pin_button, MGOS_GPIO_INT_EDGE_POS, gpio_int_cb, NULL);

}

我错过了什么吗?

最佳答案

ESP8266 GPIO16 无法配置中断。来自ESP8266 technical reference :

  1. GPIO16 Related APIs Different from other IO interfaces, GPIO16(XPD_DCDC) belongs to the RTC module instead of the general GPIO module. It can be used to wake up the chip during deep-sleep; it can be configured to input or output mode; but it cannot trigger the IO interrupt.

关于c - ESP8266 GPIO 16 不能用作按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53508232/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com