qmk_firmware/keyboards/handwired
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
..
2x5keypad [Keyboard] Update default keymaps to use layer_state_t (#7444) 2019-11-21 22:40:29 -08:00
6macro Cleanup rules.mk for 16U2 and 32U2 keyboards (#6768) 2019-09-19 09:55:14 -07:00
42 Remove all references to "CUSTOM_MATRIX" as a diode direction (#7937) 2020-01-19 23:05:51 -08:00
108key_trackpoint Cleanup rules.mk for USB64 and USB128 keyboards (#6769) 2019-09-19 09:55:03 -07:00
412_64 Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
aek64 BACKLIGHT_ON_STATE config.h fixes (#8862) 2020-04-30 16:24:13 +10:00
aplx2 [Keyboard] Aplx2 osu! keyboard (#8847) 2020-04-27 10:25:51 -07:00
aranck [Keyboard] Aranck handwired keyboard to support community MIT layouts, also minor optimisations done (#7737) 2020-01-01 09:44:22 -08:00
arrow_pad Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
atreus50 Create ajp10304 userspace and ortho_4x12 layout. (#9304) 2020-07-09 20:18:51 +01:00
bdn9_ble BACKLIGHT_ON_STATE config.h fixes (#8862) 2020-04-30 16:24:13 +10:00
bento [Keyboard] Bento handwired macro pad (#9973) 2020-08-18 13:45:33 -07:00
bluepill Set MCU for some F103 boards (#8459) 2020-03-19 01:33:17 +00:00
boss566y/redragon_vara [Keyboard] Added Handwired Redragon Keyboard (#9590) 2020-07-08 06:33:43 -07:00
brain Klackygears add user and handwired brain (#9154) 2020-06-28 12:07:57 +01:00
cans12er [Keyboard] Added Cans12er keyboard (#7455) 2019-11-23 16:56:18 -08:00
chiron Miscellaneous rules.mk cleanups (#7212) 2019-10-31 13:11:36 +00:00
ck4x4 Enable memcore to fix malloc/rand crashes (#8695) 2020-04-05 22:15:40 +01:00
cmd60 Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
co60 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
colorlice [Keyboard] Adjust ColorLice to work with QMK configurator (#7572) 2019-12-09 09:44:07 -08:00
d48 [Keyboard] Added D48 keyboard (#8548) 2020-05-08 23:59:50 -07:00
dactyl Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
dactyl_left Clean up some remaining rules.mk bootloader stuff (#8165) 2020-02-16 11:45:42 -08:00
dactyl_manuform handwired/dactyl_manuform/5x6_5: fix broken keyboard and keymap reference (#9921) 2020-08-07 04:40:41 -07:00
dactyl_promicro Enforce definition of DIODE_DIRECTION for non-custom matrix boards (#7915) 2020-01-19 14:11:57 +11:00
daishi Convert two handwired default keymaps to Dynamic Macro feature (#8166) 2020-02-13 22:20:18 -08:00
datahand Cleanup rules.mk for USB64 and USB128 keyboards (#6769) 2019-09-19 09:55:03 -07:00
ddg_56 [Keyboard] Add DGG-56 Handwired (#8740) 2020-04-18 17:20:42 -07:00
downbubble Cleanup rules.mk for USB64 and USB128 keyboards (#6769) 2019-09-19 09:55:03 -07:00
eagleii [Keyboard] Addition Eagle II keyboard (#7927) 2020-01-19 18:07:30 -08:00
fc200rt_qmk Remove no-longer-necessary LTO checks from keyboards' config.h files (#8773) 2020-04-19 23:56:48 +01:00
ferris Upstream a good default keymap for the Ferris handwired (#9926) 2020-08-24 14:56:48 -07:00
fivethirteen Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
floorboard Remove no-longer-necessary LTO checks from keyboards' config.h files (#8773) 2020-04-19 23:56:48 +01:00
frenchdev Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
fruity60 Fix capitalisation of "GitHub" (#9184) 2020-05-25 19:43:14 -07:00
gamenum Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
hacked_motospeed Enforce definition of DIODE_DIRECTION for non-custom matrix boards (#7915) 2020-01-19 14:11:57 +11:00
heisenberg Heisenberg handwired keyboard added (#7643) 2019-12-18 09:41:41 +11:00
hexon38 [Keyboard] Remove PREVENT_STUCK_MODIFIERS from config.h files (#7592) 2019-12-09 16:00:27 -08:00
hnah40 Remove DEBUG_LEVEL from V-USB rules.mk (#9117) 2020-05-17 21:37:04 +01:00
hnah40rgb [Keyboard] add new keyboard hnah40rgb (#7083) 2019-10-23 16:38:44 -07:00
hnah108 Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
ibm122m Cleanup rules.mk for USB64 and USB128 keyboards (#6769) 2019-09-19 09:55:03 -07:00
jn68m Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
jopr Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
jot50 [Keyboard] Update default keymaps to use layer_state_t (#7444) 2019-11-21 22:40:29 -08:00
jotanck Jotanck (#9531) 2020-06-24 23:08:24 -07:00
jotpad16 [Keyboard] jotpad16 status leds (#8643) 2020-04-12 10:25:09 -07:00
jtallbean Remove no-longer-necessary LTO checks from keyboards' config.h files (#8773) 2020-04-19 23:56:48 +01:00
juliet [Keyboard] add Juliet (#9240) 2020-06-05 02:13:31 -07:00
k8split [Keyboard] handwired/k8split (#9133) 2020-05-21 16:37:09 -07:00
k_numpad17 Add more missing info.json layouts (#9595) 2020-06-30 17:53:24 +01:00
kbod Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
ks63 [Keyboard] Add new keyboard ks63 handwired (#9712) 2020-07-30 11:08:17 -07:00
lovelive9 Add more missing info.json layouts (#9595) 2020-06-30 17:53:24 +01:00
maartenwut Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
magicforce61 Change ?= to = in keyboard rules.mk (#9390) 2020-06-15 03:06:10 -07:00
magicforce68 Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
mechboards_micropad Fix capitalisation of "GitHub" (#9184) 2020-05-25 19:43:14 -07:00
minorca Clean up some remaining rules.mk bootloader stuff (#8165) 2020-02-16 11:45:42 -08:00
ms_sculpt_mobile 2020 May 30 Breaking Changes Update (#9215) 2020-05-30 13:14:59 -07:00
myskeeb Fix 'does not have a readme.md' warnings (#9294) 2020-06-04 02:07:37 -07:00
nicekey Enforce definition of DIODE_DIRECTION for non-custom matrix boards (#7915) 2020-01-19 14:11:57 +11:00
not_so_minidox Change ?= to = in keyboard rules.mk (#9390) 2020-06-15 03:06:10 -07:00
novem Fix handwired/novem Configurator config (#9291) 2020-06-04 01:57:37 -07:00
numbrero Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
numpad20 Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
obuwunkunubi/spaget [Keyboard] obuwunkunubi/spaget handwired (#8738) 2020-04-09 12:45:08 -07:00
onekey Hid joystick interface (#4226) 2020-08-29 14:30:02 -07:00
ortho5x13 Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
owlet60 Clean up includes for glcdfont headers (#7745) 2020-03-01 17:56:50 +11:00
p65rgb [Keyboard] Add p65rgb PCB (#7753) 2020-01-02 08:57:47 -08:00
p1800fl [Keyboard] Fix Configurator layout data for handwired/1800fl (#9393) 2020-06-15 03:10:15 -07:00
pilcrow Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
postageboard Postage Board MCU (#7424) 2019-11-20 16:38:51 -08:00
prime_exl Fix incorrect key sizes in Configurator (#9073) 2020-05-13 20:00:37 +01:00
prime_exl_plus [Keyboard] Add Prime_EXL Plus to handwired (#8238) 2020-02-25 13:21:59 -08:00
prkl30 [Keymap] Add Erkhal keymap to PRKL30 (#8355) 2020-03-11 16:06:47 -07:00
promethium Change analogRead calls to analogReadPin (#9023) 2020-08-29 14:30:02 -07:00
pterodactyl [Keyboard] Pterodactyl handwired (#9884) 2020-08-22 12:59:24 -07:00
pteron [Keyboard] Remove PREVENT_STUCK_MODIFIERS from config.h files (#7592) 2019-12-09 16:00:27 -08:00
pteron38 [Keyboard] Handwired pteron38 (#10035) 2020-08-26 01:12:19 -07:00
qc60 Remove keymap_config extern from default keymaps (#7399) 2019-11-20 22:31:36 +00:00
reddot Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
retro_refit Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
riblee_f401 [Keyboard] Add handwired 12*5 blackpill keyboard (#9855) 2020-08-06 15:30:16 -07:00
rs60 Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
selene [Keyboard] Add "Selene" to the handwired section (#9920) 2020-08-07 13:31:22 -07:00
sick68 fix sick68 space key handwiring location (#8962) 2020-04-29 00:45:51 +01:00
slash Miscellaneous stuff: remove clang-complete and autocomplete.sh, fix some rules.mk comments (#8784) 2020-04-15 02:03:49 -07:00
space_oddity Convert two handwired default keymaps to Dynamic Macro feature (#8166) 2020-02-13 22:20:18 -08:00
splittest Move splittest I2C (#8346) 2020-03-09 15:36:40 +11:00
steamvan 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
sticc14 [Keyboard] Complete info.json for Sticc14 handwired (#7208) 2019-10-30 22:02:08 -07:00
stream_cheap [Keyboard] Added a new handwired 2x3,2x4,2x5 keyboard called the Stream_cheap (#9871) 2020-07-31 16:18:06 -07:00
swiftrax/cowfish fix handwired/swiftrax/cowfish PID and VID (#9922) 2020-08-13 00:08:41 +10:00
symmetry60 [Keyboard] Add new keyboard Symmetry60 (#7327) 2019-11-11 21:04:35 -08:00
tennie Remove all references to "CUSTOM_MATRIX" as a diode direction (#7937) 2020-01-19 23:05:51 -08:00
terminus_mini Remove keymap_config extern from default keymaps (#7399) 2019-11-20 22:31:36 +00:00
trackpoint Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
tradestation Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
traveller Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
tritium_numpad Cleanup rules.mk for 32U4 keyboards, H (#7030) 2019-10-20 12:51:37 -07:00
twadlee/tp69 [Keyboard] handwired/twadlee/tp69 (#9013) 2020-05-18 01:52:55 -07:00
unk [Keyboard] Add UNK keyboard. (#9571) 2020-06-29 16:32:59 -07:00
videowriter Remove no-longer-necessary LTO checks from keyboards' config.h files (#8773) 2020-04-19 23:56:48 +01:00
wabi [Keyboard] Wabi handwire (#9704) 2020-08-16 18:33:20 -07:00
woodpad Change ?= to = in keyboard rules.mk (#9390) 2020-06-15 03:06:10 -07:00
wulkan Enforce definition of DIODE_DIRECTION for non-custom matrix boards (#7915) 2020-01-19 14:11:57 +11:00
xealous [Keyboard] Update default keymaps to use layer_state_t (#7444) 2019-11-21 22:40:29 -08:00
xealousbrown Update to xealousbrown. (#8215) 2020-04-21 00:41:15 -07:00
z150 [Keyboard] Add keyboard Zenith Z-150 (#9811) 2020-07-26 22:44:50 +01:00
zergo update info.json file for handwired/zergo (#10117) 2020-08-26 12:36:23 -07:00