adc-keys

Vendor: Generic or vendor-independent

Description

Input driver for ADC attached resistor ladder buttons.

The driver itself does not calculate each possible combination of resistor
values. Instead, users are required to specify the voltage for each single
key press or for combinations of key presses.

Example:

#include <dt-bindings/input/input-event-codes.h>

/ {
        buttons {
                compatible = "adc-keys";
                io-channels = <&adc 2>;
                keyup-threshold-mv = <0>;

                key_0 {
                        press-thresholds-mv = <1650>,  /* KEY0 */
                                              <2536>;  /* KEY0 + KEY1 */
                        zephyr,code = <INPUT_KEY_0>;
                };

                key_1 {
                        press-thresholds-mv = <2300>,  /* KEY1 */
                                              <2536>;  /* KEY0 + KEY1 */
                        zephyr,code = <INPUT_KEY_1>;
                };
        };
};

Properties

Top level properties

These property descriptions apply to “adc-keys” nodes themselves. This page also describes child node properties in the following sections.

Properties not inherited from the base binding file.

Name

Type

Details

sample-period-ms

int

Sample period in milliseconds.
If not specified defaults to 20.

Default value: 20

keyup-threshold-mv

int

Millivolt value to which all the keys are considered up.

This property is required.

Child node properties

Name

Type

Details

press-thresholds-mv

array

Array of millivolt values to consider a key pressed.

This property is required.

zephyr,code

int

Key code to emit.

This property is required.