Lines Matching +full:button +full:- +full:input +full:- +full:code
1 .. zephyr:code-sample:: button
2 :name: Button
3 :relevant-api: gpio_interface
10 A simple button demo showcasing the use of GPIO input with interrupts.
11 The sample prints a message to the console each time a button is pressed.
13 .. NOTE:: If you are looking into an implementation of button events with
14 debouncing, check out :ref:`input` and :zephyr:code-sample:`input-dump`
20 The board hardware must have a push button connected via a GPIO pin. These are
23 The button must be configured using the ``sw0`` :ref:`devicetree <dt-guide>`
24 alias, usually in the :ref:`BOARD.dts file <devicetree-in-out-files>`. You will
27 .. code-block:: none
35 the same alias used by the :zephyr:code-sample:`blinky` sample. If this is provided, the LED
36 will be turned on when the button is pressed, and turned off off when it is
48 .. code-block:: devicetree
58 gpio-controller;
59 #gpio-cells = <2>;
65 compatible = "gpio-keys";
68 label = "User button";
75 with a "gpio-keys" :ref:`compatible <dt-important-props>`.
79 - ``gpio0`` is an example node label referring to a GPIO controller
80 - ``PIN`` should be a pin number, like ``8`` or ``0``
81 - ``FLAGS`` should be a logical OR of :ref:`GPIO configuration flags <gpio_api>`
82 meant to apply to the button, such as ``(GPIO_PULL_UP | GPIO_ACTIVE_LOW)``
84 This assumes the common case, where ``#gpio-cells = <2>`` in the ``gpio0``
88 .. code-block:: yaml
90 gpio-cells:
91 - pin
92 - flags
104 .. zephyr-app-commands::
105 :zephyr-app: samples/basic/button
111 pin in input mode, enabling interrupt generation on falling edge. During each
113 the serial console. When the input button gets pressed, the interrupt handler