1.7 KiB
1.7 KiB
Component: Button
After creating a new button object by calling function button_create()
, the button object can create press events, every press event can have its own callback.
List of supported events:
- Button pressed
- Button released
- Button pressed repeat
- Button press repeat done
- Button single click
- Button double click
- Button multiple click
- Button long press start
- Button long press hold
- Button long press up
- Button Press end
There are three ways this driver can handle buttons:
- Buttons connected to standard digital GPIO
- Multiple buttons connected to single ADC channel
- Matrix keyboard employs multiple GPIOs for operation.
- Custom button connect to any driver
The component supports the following functionalities:
- Creation of an unlimited number of buttons, accommodating various types simultaneously.
- Multiple callback functions for a single event.
- Allowing customization of the consecutive key press count to any desired number.
- Facilitating the setup of callbacks for any specified long-press duration.
- Support power save mode (Only for gpio button)
Add component to your project
Please use the component manager command add-dependency
to add the button
to your project's dependency, during the CMake
step the component will be downloaded automatically
idf.py add-dependency "espressif/button=*"