Implement data driven joysticks (#22947)
This commit is contained in:
parent
938badc3b0
commit
53a0cdc446
10 changed files with 97 additions and 31 deletions
|
@ -7,7 +7,7 @@ from dotty_dict import dotty
|
|||
|
||||
from milc import cli
|
||||
|
||||
from qmk.constants import COL_LETTERS, ROW_LETTERS, CHIBIOS_PROCESSORS, LUFA_PROCESSORS, VUSB_PROCESSORS
|
||||
from qmk.constants import COL_LETTERS, ROW_LETTERS, CHIBIOS_PROCESSORS, LUFA_PROCESSORS, VUSB_PROCESSORS, JOYSTICK_AXES
|
||||
from qmk.c_parse import find_layouts, parse_config_h_file, find_led_config
|
||||
from qmk.json_schema import deep_update, json_load, validate
|
||||
from qmk.keyboard import config_h, rules_mk
|
||||
|
@ -249,8 +249,9 @@ def info_json(keyboard):
|
|||
info_data = _extract_rules_mk(info_data, rules_mk(str(keyboard)))
|
||||
info_data = _extract_config_h(info_data, config_h(str(keyboard)))
|
||||
|
||||
# Ensure that we have matrix row and column counts
|
||||
# Ensure that we have various calculated values
|
||||
info_data = _matrix_size(info_data)
|
||||
info_data = _joystick_axis_count(info_data)
|
||||
|
||||
# Merge in data from <keyboard.c>
|
||||
info_data = _extract_led_config(info_data, str(keyboard))
|
||||
|
@ -800,6 +801,16 @@ def _matrix_size(info_data):
|
|||
return info_data
|
||||
|
||||
|
||||
def _joystick_axis_count(info_data):
|
||||
"""Add info_data['joystick.axis_count'] if required
|
||||
"""
|
||||
if 'axes' in info_data.get('joystick', {}):
|
||||
axes_keys = info_data['joystick']['axes'].keys()
|
||||
info_data['joystick']['axis_count'] = max(JOYSTICK_AXES.index(a) for a in axes_keys) + 1 if axes_keys else 0
|
||||
|
||||
return info_data
|
||||
|
||||
|
||||
def _check_matrix(info_data):
|
||||
"""Check the matrix to ensure that row/column count is consistent.
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue