Page 1 of 1

How to use GPIO43 as Input on a ESP32-S3

Posted: Thu Aug 01, 2024 6:48 pm
by bullt1980@gmail.com
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

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

Posted: Sun Aug 04, 2024 8:45 am
by bullt1980@gmail.com
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.         }

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

Posted: Tue Aug 06, 2024 9:28 am
by ESP_Sprite
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.