qmk_firmware/quantum/process_keycode
a-chol d4be07dad3 Hid joystick interface (#4226)
* add support for hid gamepad interface
add documentation for HID joystick
Add joystick_task to read analog axes values even when no key is pressed or release. update doc
Update docs/feature_joystick.md
Manage pin setup and read to maintain matrix scan after analog read

* Incorporates patches and changes to HID reporting

There are some patches provided by @a-chol incorporated on this commit,
and also some changes I made to the HID Report structure.

The most interesting is the one dealing with number of buttons: Linux
doesn't seem to care, but Windows requires the HID structure to be byte
aligned (that's in the spec). So if one declares 8/16/32... buttons they
should not have any issues, but this is what happens when you have 9
buttons:

```
 bits |0|1|2|3|4|5|6|7|
      |*|*|*|*|*|*|*|*| axis 0 (report size 8)
      |*|*|*|*|*|*|*|*| ...
      |*|*|*|*|*|*|*|*|
      |*|*|*|*|*|*|*|*|
      |*|*|*|*|*|*|*|*|
      |*|*|*|*|*|*|*|*|
      |*|*|*|*|*|*|*|*| axis 6
      |*|*|*|*|*|*|*|*| first 8 buttons (report size 1)
      |*| | | | | | | | last of 9 buttons, not aligned
```

So for that I added a conditonal that will add a number of reports with
size 1 to make sure it aligns to the next multiple of 8. Those reports
send dummy inputs that don't do anything aside from aligning the data.

Tested on Linux, Windows 10 and Street Fighter (where the joystick is
recognized as direct-input)

* Add save and restore of each pin used in reading joystick (AVR).
Allow output pin to be JS_VIRTUAL_AXIS if the axis is connected to Vcc
instead of an output pin from the MCU.

Fix joystick report id

Fix broken v-usb hid joystick interface. Make it more resilient to unusual settings (none multiple of eight button count, 0 buttons or 0 axes)

Correct adc reading for multiple axes. Piecewise range conversion for uncentered raw value range. Input, output and ground pin configuration per axis.

Documentation fixes

* Fix port addressing for joystick analog read

* The other required set of changes
As per the PR, the changes still holding it up.
Add onekey for testing.
Fix ARM builds.
Fix device descriptor when either axes or buttons is zero.
Add compile-time check for at least one axis or button.
Move definition to try to fix conflict.
PR review comments.
qmk cformat

* avoid float functions to compute range mapping for axis adc reading

* Remove V-USB support for now. Updated docs accordingly.

* Update tmk_core/protocol/lufa/lufa.c

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Update tmk_core/protocol/usb_descriptor.c

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Update tmk_core/protocol/usb_descriptor.c

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Update tmk_core/protocol/usb_descriptor.c

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Add support for joystick adc reading for stm32 MCUs. Fix joystick hid report sending for chibios

* Fix HID joystick report sending for ChibiOS.
Add one analog axis to the onekey:joystick keymap.
Fix pin state save and restore during joystick analog read for STM32
MCUs.

* Update tmk_core/protocol/chibios/usb_main.c

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Update tmk_core/protocol/lufa/lufa.c

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Add missing mcuconf.h and halconf.h to onekey:joystick keymap.
Add suggested fixes from PR.

* Switch saveState and restoreState signature to use pin_t type.
onekey:joystick : add a second axis, virtual and programmatically animated.

* Update docs/feature_joystick.md

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Update docs/feature_joystick.md

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Add PR corrections

* Remove halconf.h and mcuconf.h from onekey keymaps

* Change ADC_PIN to A0

Co-authored-by: achol <allecooll@hotmail.com>
Co-authored-by: José Júnior <jose.junior@gmail.com>
Co-authored-by: a-chol <achol@notamail.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
Co-authored-by: Ryan <fauxpark@gmail.com>
2020-08-29 14:30:02 -07:00
..
process_audio.c clang-format changes 2019-08-30 15:01:52 -07:00
process_audio.h Adds support for Planck Rev 6 (#2666) 2018-07-16 11:48:31 -04:00
process_auto_shift.c Smallish overhaul of Auto-Shift feature (#6067) 2019-11-03 09:52:01 -08:00
process_auto_shift.h Smallish overhaul of Auto-Shift feature (#6067) 2019-11-03 09:52:01 -08:00
process_backlight.c 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
process_backlight.h 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
process_clicky.c clang-format changes 2019-08-30 15:01:52 -07:00
process_clicky.h Add On/Off keycodes 2018-09-25 13:28:36 -07:00
process_combo.c Bigger combo index (#9318) 2020-08-29 14:30:02 -07:00
process_combo.h Bigger combo index (#9318) 2020-08-29 14:30:02 -07:00
process_dynamic_macro.c format code according to conventions [skip ci] 2020-07-07 21:43:51 +00:00
process_dynamic_macro.h [Core] Convert Dynamic Macro to a Core Feature (#5948) 2019-11-04 22:59:13 -08:00
process_grave_esc.c Relocate grave keycode processing (#8082) 2020-02-04 18:49:10 -08:00
process_grave_esc.h Relocate grave keycode processing (#8082) 2020-02-04 18:49:10 -08:00
process_joystick.c Hid joystick interface (#4226) 2020-08-29 14:30:02 -07:00
process_joystick.h Hid joystick interface (#4226) 2020-08-29 14:30:02 -07:00
process_key_lock.c clang-format changes 2019-08-30 15:01:52 -07:00
process_key_lock.h clang-format changes 2019-08-30 15:01:52 -07:00
process_leader.c clang-format changes 2019-08-30 15:01:52 -07:00
process_leader.h clang-format changes 2019-08-30 15:01:52 -07:00
process_magic.c Fix FORCE_NKRO handling (#7601) 2019-12-11 11:39:30 -08:00
process_magic.h Relocate magic keycode processing (#7512) 2019-12-03 19:48:55 +00:00
process_midi.c clang-format changes 2019-08-30 15:01:52 -07:00
process_midi.h clang-format changes 2019-08-30 15:01:52 -07:00
process_music.c clang-format changes 2019-08-30 15:01:52 -07:00
process_music.h clang-format changes 2019-08-30 15:01:52 -07:00
process_printer_bb.c clang-format changes 2019-08-30 15:01:52 -07:00
process_printer.c clang-format changes 2019-08-30 15:01:52 -07:00
process_printer.h Fix warnings in process_printer 2017-04-13 16:00:29 +03:00
process_rgb.c Improve keycode handling for RGB (#7677) 2020-06-22 09:38:58 +01:00
process_rgb.h Relocate RGB keycode processing (#7508) 2019-12-16 12:27:53 -08:00
process_space_cadet.c Update features to use Custom Tapping Term when appropriate (#6259) 2020-08-29 14:30:02 -07:00
process_space_cadet.h Update features to use Custom Tapping Term when appropriate (#6259) 2020-08-29 14:30:02 -07:00
process_steno.c switching to you know whats up mode (#7921) 2020-01-17 16:15:58 -05:00
process_steno.h switching to you know whats up mode (#7921) 2020-01-17 16:15:58 -05:00
process_tap_dance.c Update features to use Custom Tapping Term when appropriate (#6259) 2020-08-29 14:30:02 -07:00
process_tap_dance.h Run clang-format manually to fix recently changed files 2019-11-17 08:25:58 -08:00
process_terminal_nop.h Updates send_string functionality, adds terminal feature (#1657) 2017-09-12 00:43:10 -04:00
process_terminal.c Send string keycode tweaks (#7471) 2019-11-25 23:16:58 -08:00
process_terminal.h clang-format changes 2019-08-30 15:01:52 -07:00
process_ucis.c qmk cformat (#9500) 2020-06-22 11:21:48 +10:00
process_ucis.h Standardize how unicode is processed (fixes #8768) (#8770) 2020-06-18 08:07:34 +01:00
process_unicode_common.c qmk cformat (#9500) 2020-06-22 11:21:48 +10:00
process_unicode_common.h Standardize how unicode is processed (fixes #8768) (#8770) 2020-06-18 08:07:34 +01:00
process_unicode.c clang-format changes 2019-08-30 15:01:52 -07:00
process_unicode.h New keycode macro (XP) for shifted character pairs using UNICODEMAP + bug fixes and improvements (#4803) 2019-05-03 09:33:00 -07:00
process_unicodemap.c qmk cformat (#9500) 2020-06-22 11:21:48 +10:00
process_unicodemap.h send_unicode_string(): Add support for code points > 0xFFFF (#8236) 2020-02-25 12:54:51 +11:00