-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(drivers): add analog joystick driver #1964
base: main
Are you sure you want to change the base?
Conversation
Analog joystick drivers for THB using ADC to read joystick sensor output and convert the reading to [-1.0 1.0] range
Is it possible to make this a more generic ADC driver, then implement peripherals on top of it? Something like joystick, as well as linear slider, hall effect sensor, etc. |
Thanks for the comment! This is an interesting proposal, and if I understood correctly you are suggesting adding an abstraction layer between the OS ADC API and various sensor implementations, i.e. instead of going [ADC API] --> [Joystick], a generic ADC layer sits in between so [ADC API] --> [Generic Analog] --> [Joystick, slider, etc.] and the intuition would be to put most of the ADC configuration and initialization logic in this [Generic Analog] layer, correct? IMHO I don't think this [Generic Analog] layer can provide much more value than the OS ADC API, in fact, if it was generic enough, it should probably go to the OS ADC API itself. Therefore an additional abstraction layer may not be the best way to go, what do you think? |
Well, I'm not a hardware guy. My comment may be naive and unfeasible. In the first place, what I want is to use magnet switches with hall effect sensors and analog multiplexers. I've done it on top of QMK, which provides a very convenient ADC driver. So I could focus on the custom matrix scan part. I'd like to do this on ZMK too. But honestly, I'm not familiar with ZMK yet, its developing experience is very different from QMK. |
I see, yea what you described is indeed in the scope of an ADC driver, which Zephyr provides a nice abstraction for. A middle layer abstraction on top of that doesn't seem to be useful I think |
Looks like it's time to start learning Zephyr 🥲 |
xinput support would be great! |
Analog joystick drivers using ADC to read joystick sensor output and convert the reading to [-1.0 1.0] range. Joystick of choose in the implementation is THB from C&K, but it should apply to similar products with analog inputs as well.
example usage in dts:
A demo using this joystick as a pointer device can be found here from this project