Page 1 of 1

ESP32-C3 - Double use for RST button

Posted: Sun Apr 30, 2023 12:01 am
by 456h7H
Hi forum,

I have an esp32-c3-wroom-02 based board with 2 buttons, one for boot loader and one for reset. I'm able to put my controller into download mode to upload my code by pressing the RST button while pressing the boot button.

This works fine. However, I need to be able to associate a piece of code to the RST press. Seeing as the RST is part of the controller logic, a single press will restart the controller. I was wondering if maybe I could detect a long press and associate a function with it.

Any idea if this is possible?

Re: ESP32-C3 - Double use for RST button

Posted: Sun Apr 30, 2023 1:39 am
by ESP_Sprite
Not in code. The ESP32 is entirely halted in reset state during the time that RST is pressed, so there's no way to detect a long press in software. Best you could potentially do is add an external RC circuit to another GPIO, with the C only discharging entirely in a long press, and use that GPIO to detect that in sofware. Alternatively, the BOOT button is connected to GPIO9 and functions as a normal button after boot, so you're free to use that for whatever function.

Re: ESP32-C3 - Double use for RST button

Posted: Mon May 01, 2023 1:07 am
by 456h7H
Thank you so much ESP_Sprite! That just saved me a lot of work! Thank you!