-
-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
[Feature Request] Documentation for using simple switches with JOYSTICK_ENABLE #13344
Comments
Hey, so in the current implementation, the buttons are just numbered and map are interpreted by the os in an os-specific way, I guess. You can define JOYSTICK_AXES_COUNT 0 to not have any axis defined and JOYSTICK_BUTTON_COUNT to something greater than 0 to only have buttons. Does that solve your use case? |
It feels like it doesn't, but maybe it does? Let's start with a use case- Someone buys a joystick and some arcade buttons and connects them up to a promicro using directpins. Now they have 12 switches to assign keycodes to. The buttons are fairly obvious as you just assign |
How about these:
|
Ha! I guess I hadn't fully understood what you mean't in the initial request : a physical directional cross that sends analog values as axes not button presses? |
Now that I look at it, I guess the sample in the doc is missing some code to write the actual value to the axis. |
Is this what is happening when a commercial NES-style controller is plugged in? If so yes. |
For some more context, what I want in the end is for someone who knows little about how game controllers work to be able to use this for their custom controller. There's a lot of prior art here- fight sticks, flight controllers, console style controllers, etc. Right now you have to understand a lot of technical detail to make use of any of this, unless you stick solely to |
I suspect those NES controllers are using these for the D-pad, rather than sending fake analog values: EDIT: Guess not? I found this converter project for original controllers, which like Mousekeys just sets the X/Y fields to the centre value by default (its report descriptor specifies a range of 0-255, so 128) and flips between the min and max accordingly. But it might be nice to have the D-pad usages anyway, if Windows and Linux support them? Certainly seems like Linux does: https://elixir.bootlin.com/linux/v5.12.13/source/drivers/hid/hid-input.c#L698 |
I dug out an old Logitech F510 I have to see what it does, and it does seem to supply max values as part of an axis. Using this code I got this from the cross axis on the left (which I can feel has switches, not pots):
I get something similar when I plug in a gensis usb controller:
And when I plug in a TG-16 controller:
This seems to indicate that Axis 0 and Axis 2 are considered "movement" axis by default, and either would be good candidates for |
On button assignments it would be useful to note standard button mappings. Just checking the three I have here there seem to be some commonalities. TG-16 gamepad:1 axis, 4 buttons Crosspad controls Axis 2
Genesis gamepad:1 axis, 8 buttons Crosspad controls Axis 0
Logitech F510, in primary mode1:3 axis, 10 buttons Left analog stick controls Axis 02 Right analog stick controls Axis 1 Crosspad controls Axis 2
Logitech F510, in alternate mode1:3 axis, 8 buttons Left analog stick controls Axis 03 Right analog stick left/right controls Axis 1. X values is always -32767 while Y value reflects position. Right analog stick up/down controls Axis 2. X value reflects position while Y value is always -32767. LT (left bottom trigger) controls Axis 1. X value reflects position while Y value is always 0. Resting position X value is -32767. RT (right bottom trigger) controls Axis 2. X value is always -2 while Y value reflects position. Resting position Y value is -32767. Crosspad is disabled unless Mode is pressed.3
Footnotes:
|
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs. |
I'm working on a project like this right now and either some documentation or predefined |
Some games/apps don't support D-PAD input. For normal D-PAD (mapped to HID 0x90 Up, 0x91 Down, 0x92 Right, 0x93 Left)
For D-PAD mapped to joystick (to use with JOYSTICK_AXIS_VIRTUAL)
|
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs. |
This issue has been automatically closed because it has not had activity in the last 30 days. If this issue is still valid, re-open the issue and let us know. |
Did someone find a solution? I just soldered an arduino to my old ZX Spectrum Joystick. Works fine with QMK, but can not find how to made it DPAD_UP DPAD_DOWN DPAD_LEFT DPAD_RIGHT instead of keyboard UP DOWN LEFT RIGHT with QMK. |
@davewongillies thanks, RPI is a bit overkill for 5 button device. And I like QMK layers, just need exactly what was discussed here. Something like JS_UP JS_DOWN JS_LEFT JS_RGHT |
Its a pipico, so its just a micro controller, so it not really overkill |
Feature Request Type
Description
WIth #4226 by @a-chol we added gamepad support and support for analog joysticks. However, not all game controllers use analog joysticks. The documentation says that you can use digital switches instead of analog joysticks, but it does not explain how.
It would be even better if we had dedicated keycodes for this, EG
JS_UP
,JS_DOWN
,JS_LEFT
, andJS_RIGHT
.The text was updated successfully, but these errors were encountered: