Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.
/ esp-button Public archive
generated from mdvorak-iot/esp-lib-template

Button handler, with software debounce logic and long-press support.

License

Notifications You must be signed in to change notification settings

mdvorak/esp-button

Repository files navigation

button

test

Button handler, with software debounce logic and long-press support.

Internally, it is using interrupts and esp_timer for debounce. Does not poll state when idle, only while button is being pressed (this is necessary, as it is impossible to disambiguate press and release in an interrupt routine).

Usage

To reference this library by your project, add it as git submodule, using command

git submodule add https://github.com/mdvorak/esp-button.git components/button

and include either of the header files

#include <button.h>

For full example, see button_example_main.c.

Development

Prepare ESP-IDF development environment .

Configure example application with

cd example/
idf.py menuconfig

Flash it via (in the example dir)

idf.py build flash monitor

As an alternative, you can use PlatformIO to build and flash the example project.