Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: input: add an analog-axis driver #66600

Merged
merged 1 commit into from Jan 10, 2024

Conversation

fabiobaltieri
Copy link
Member

@fabiobaltieri fabiobaltieri commented Dec 16, 2023

Last installment (maybe) of the general purpose input drivers. This is for a generic thumbstick style device connected to an ADC to report as an absolute position input device. Been running the original version of this on one of my toy projects (predating the input subsystem), just finished making it generic, I think it'd be a great addition to the project.

The calibration factors and deadzone in the devicetree are just an initial value stored in RAM, there's an API for overwriting those as well as saving them with the settings subsystems. If saved, they are loaded at boot time automatically.

The deadzone is optional, as it's only needed for a self centering device, for a return to zero device one can just change the limits.

I'll follow up with a shell command and power management down the road, but this is big and functional enough for now.


Add an input driver to read data from an analog device, such as a thumbstick, connected to an ADC channel, and report it as an input device.

@fabiobaltieri fabiobaltieri force-pushed the input-analog-axis branch 4 times, most recently from c3a65bb to 867bc3c Compare December 16, 2023 22:07
drivers/input/input_analog_axis.c Outdated Show resolved Hide resolved
drivers/input/input_analog_axis.c Outdated Show resolved Hide resolved
drivers/input/input_analog_axis.c Outdated Show resolved Hide resolved
drivers/input/input_analog_axis.c Outdated Show resolved Hide resolved
drivers/input/input_analog_axis.c Outdated Show resolved Hide resolved
@fabiobaltieri fabiobaltieri changed the title drivers: input: add analog-axis driver drivers: input: add an analog-axis driver Dec 16, 2023
@fabiobaltieri fabiobaltieri force-pushed the input-analog-axis branch 5 times, most recently from 130e379 to 9bb8f38 Compare December 17, 2023 18:47
@fabiobaltieri fabiobaltieri marked this pull request as ready for review December 17, 2023 19:40
@zephyrbot zephyrbot added area: Input Input Subsystem and Drivers area: Devicetree Binding PR modifies or adds a Device Tree binding labels Dec 17, 2023
include/zephyr/input/input_analog_axis.h Outdated Show resolved Hide resolved
include/zephyr/input/input_analog_axis.h Outdated Show resolved Hide resolved
include/zephyr/input/input_analog_axis.h Outdated Show resolved Hide resolved
include/zephyr/input/input_analog_axis.h Outdated Show resolved Hide resolved
include/zephyr/input/input_analog_axis.h Outdated Show resolved Hide resolved
dts/bindings/input/analog-axis.yaml Outdated Show resolved Hide resolved
dts/bindings/input/analog-axis.yaml Outdated Show resolved Hide resolved
@fabiobaltieri fabiobaltieri force-pushed the input-analog-axis branch 2 times, most recently from a3522dd to 07b7e2a Compare December 18, 2023 10:36
@fabiobaltieri
Copy link
Member Author

fabiobaltieri commented Dec 19, 2023

  • split out the settings stuff in its own file, using the driver apis, so now the basic driver has calibration apis and the settings module uses them to implement persistent calibration, but can as well be skipped if the application wants to do its own thing and all the api are available anyway

include/zephyr/input/input_analog_axis.h Outdated Show resolved Hide resolved
include/zephyr/input/input_analog_axis.h Outdated Show resolved Hide resolved
drivers/input/input_analog_axis.c Outdated Show resolved Hide resolved
include/zephyr/input/input_analog_axis_settings.h Outdated Show resolved Hide resolved
gmarull
gmarull previously approved these changes Jan 2, 2024
@gmarull gmarull requested a review from kartben January 2, 2024 09:18
Add an input driver to read data from an analog device, such as a
thumbstick, connected to an ADC channel, and report it as an input
device.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
@fabiobaltieri
Copy link
Member Author

(merge conflict, rebased).

Copy link
Collaborator

@kartben kartben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc looks good thanks!

@carlescufi carlescufi merged commit bd8cee8 into zephyrproject-rtos:main Jan 10, 2024
18 checks passed
@fabiobaltieri fabiobaltieri deleted the input-analog-axis branch January 10, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree Binding PR modifies or adds a Device Tree binding area: Input Input Subsystem and Drivers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants