1# Copyright 2023 Google LLC
2# SPDX-License-Identifier: Apache-2.0
3
4description: |
5  ADC based analog axis input device
6
7  Implement an input device generating absolute axis events by periodically
8  reading from some ADC channels.
9
10  Example configuration:
11
12  #include <zephyr/dt-bindings/input/input-event-codes.h>
13
14  analog_axis {
15          compatible = "analog-axis";
16          poll-period-ms = <15>;
17          axis-x {
18                  io-channels = <&adc 0>;
19                  in-deadzone = <50>;
20                  in-min = <100>;
21                  in-max = <800>;
22                  zephyr,axis = <INPUT_ABS_X>;
23          };
24  };
25
26compatible: "analog-axis"
27
28include: base.yaml
29
30properties:
31  poll-period-ms:
32    type: int
33    default: 15
34    description: |
35      How often to get new ADC samples for the various configured axes in
36      milliseconds. Defaults to 15ms if unspecified.
37
38child-binding:
39  properties:
40    io-channels:
41      type: phandle-array
42      required: true
43      description: |
44        ADC IO channel to use.
45
46    out-min:
47      type: int
48      default: 0
49      description: |
50        Minimum value to output on input events. Defaults to 0 if unspecified.
51
52    out-max:
53      type: int
54      default: 255
55      description: |
56        Maximum value to output on input events. Defaults to 255 if
57        unspecified.
58
59    in-deadzone:
60      type: int
61      default: 0
62      description: |
63        Deadzone for the input center value. If specified input values between
64        the center of the range plus or minus this value will be reported as
65        center. Defaults to 0, no deadzone.
66
67    in-min:
68      type: int
69      required: true
70      description: |
71        Input value that corresponds to the minimum output value.
72
73    in-max:
74      type: int
75      required: true
76      description: |
77        Input value that corresponds to the maximum output value.
78
79    zephyr,axis:
80      type: int
81      required: true
82      description: |
83        The input code for the axis to report for the device, typically any of
84        INPUT_ABS_*.
85
86    invert-input:
87      type: boolean
88      description: |
89        If set, invert the raw ADC value before processing it. Useful for
90        differential channels.
91
92    invert-output:
93      type: boolean
94      description: |
95        If set, invert the output value.
96