[已解决] ESP32S2>34的gpio做普通gpio不能中断吗?

hello_galaxy
Posts: 10
Joined: Mon Jul 19, 2021 12:20 pm

[已解决] ESP32S2>34的gpio做普通gpio不能中断吗?

Postby hello_galaxy » Mon Jul 26, 2021 3:48 am

用到gpio35 gpio36用于按键检测,log发现
// 0~39 except from 20, 24, 28~31 are valid
#define SOC_GPIO_VALID_GPIO_MASK (0xFFFFFFFFFFULL & ~(0ULL | BIT20 | BIT24 | BIT28 | BIT29 | BIT30 | BIT31))
#define GPIO_IS_VALID_GPIO(gpio_num) (((1ULL << (gpio_num)) & SOC_GPIO_VALID_GPIO_MASK) != 0)
是这样的!
Last edited by hello_galaxy on Wed Jul 28, 2021 10:12 am, edited 1 time in total.

ESP_Gargamel
Posts: 786
Joined: Wed Nov 14, 2018 8:45 am

Re: ESP32S2>34的gpio做普通gpio不能中断吗?

Postby ESP_Gargamel » Mon Jul 26, 2021 6:42 am

你问的是 ESP32-S2?但你这几行代码是 ESP32 的,S2 的应该是这样的:

Code: Select all

// 0~47 except from 22~25, 47 are valid
#define SOC_GPIO_VALID_GPIO_MASK             (0xFFFFFFFFFFFFULL & ~(0ULL | BIT22 | BIT23 | BIT24 | BIT25 | BIT47))
// GPIO 46, 47 are input only
#define SOC_GPIO_VALID_OUTPUT_GPIO_MASK     (SOC_GPIO_VALID_GPIO_MASK & ~(0ULL | BIT46 | BIT47))
你可以用 examples/peripherals/gpio/generic_gpio 试一下,把 INPUT 改成 IO35 & IO36。

hello_galaxy
Posts: 10
Joined: Mon Jul 19, 2021 12:20 pm

Re: ESP32S2>34的gpio做普通gpio不能中断吗?

Postby hello_galaxy » Wed Jul 28, 2021 10:11 am

好的,感谢

Who is online

Users browsing this forum: No registered users and 151 guests