zephyr/dts/bindings/input/adc-keys.yaml

71 lines
1.8 KiB
YAML
Raw Normal View History

# Copyright (c) 2024 Chen Xingyu <hi@xingrz.me>
# SPDX-License-Identifier: Apache-2.0
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>;
};
};
};
compatible: "adc-keys"
include: base.yaml
properties:
io-channels:
type: phandle-array
required: true
description: Phandle to an ADC channel.
sample-period-ms:
type: int
default: 20
description: |
Sample period in milliseconds.
If not specified defaults to 20.
keyup-threshold-mv:
type: int
required: true
description: |
Millivolt value to which all the keys are considered up.
child-binding:
description: ADC KEYS child node.
properties:
press-thresholds-mv:
type: array
required: true
description: |
Array of millivolt values to consider a key pressed.
zephyr,code:
type: int
required: true
description: Key code to emit.