analog-axis

Vendor: Generic or vendor-independent

Note

An implementation of a driver matching this compatible is available in drivers/input/input_analog_axis.c.

Description

ADC based analog axis input device

Implement an input device generating absolute axis events by periodically
reading from some ADC channels.

Example configuration:

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

analog_axis {
        compatible = "analog-axis";
        poll-period-ms = <15>;
        axis-x {
                io-channels = <&adc 0>;
                in-deadzone = <50>;
                in-min = <100>;
                in-max = <800>;
                zephyr,axis = <INPUT_ABS_X>;
        };
};

Properties

Top level properties

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

Properties not inherited from the base binding file.

Name

Type

Details

poll-period-ms

int

How often to get new ADC samples for the various configured axes in
milliseconds. Defaults to 15ms if unspecified.

Default value: 15

Child node properties

Name

Type

Details

io-channels

phandle-array

ADC IO channel to use.

This property is required.

out-min

int

Minimum value to output on input events. Defaults to 0 if unspecified.

out-max

int

Maximum value to output on input events. Defaults to 255 if
unspecified.

Default value: 255

in-deadzone

int

Deadzone for the input center value. If specified input values between
the center of the range plus or minus this value will be reported as
center. Defaults to 0, no deadzone.

in-min

int

Input value that corresponds to the minimum output value.

This property is required.

in-max

int

Input value that corresponds to the maximum output value.

This property is required.

zephyr,axis

int

The input code for the axis to report for the device, typically any of
INPUT_ABS_*.

This property is required.

invert-input

boolean

If set, invert the raw ADC value before processing it. Useful for
differential channels.

invert-output

boolean

If set, invert the output value.