How to use GPIO43 as Input on a ESP32-S3

bullt1980@gmail.com
Posts: 2
Joined: Thu Aug 01, 2024 6:45 pm

How to use GPIO43 as Input on a ESP32-S3

Postby bullt1980@gmail.com » Thu Aug 01, 2024 6:48 pm

Hi,

I'd like use the GPIO43 on ESP32-S3 as Input.

I'm doing this (I don't know what I have to put on <XX>):
[Codebox]
gpio_iomux_in(GPIO_NUM_43, <XX>);
gpio_config_t config{BIT(43), GPIO_MODE_INPUT, GPIO_PULLUP_ENABLE, GPIO_PULLDOWN_DISABLE, GPIO_INTR_POSEDGE}; gpio_config(&config);
gpio_install_isr_service(0);
gpio_isr_handler_add(GPIO_NUM_43, button_handler, this);
[/Codebox]

How do I have to do to use the GPIO43 as Input?

Thank you

bullt1980@gmail.com
Posts: 2
Joined: Thu Aug 01, 2024 6:45 pm

Re: How to use GPIO43 as Input on a ESP32-S3

Postby bullt1980@gmail.com » Sun Aug 04, 2024 8:45 am

Hi,

I found the solution:
  1.         void init(void)
  2.         {
  3.             gpio_set_direction(GPIO_NUM_43, GPIO_MODE_INPUT);
  4.             gpio_config_t config{(1ULL << 43),
  5.                                  GPIO_MODE_INPUT,
  6.                                  GPIO_PULLUP_DISABLE,
  7.                                  GPIO_PULLDOWN_DISABLE,
  8.                                  GPIO_INTR_POSEDGE};
  9.             gpio_config(&config);
  10.             gpio_install_isr_service(0);
  11.             gpio_isr_handler_add(GPIO_NUM_43, button_handler, this);
  12.         }

ESP_Sprite
Posts: 9709
Joined: Thu Nov 26, 2015 4:08 am

Re: How to use GPIO43 as Input on a ESP32-S3

Postby ESP_Sprite » Tue Aug 06, 2024 9:28 am

Note the gpio_set_direction is not needed, and generally you want to install the interrupt handler before you configure the GPIO to generate an interrupt.

Who is online

Users browsing this forum: Bing [Bot] and 109 guests