mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-16 12:51:47 +00:00
Merge 598a139b2b
into f0b04b2a3a
This commit is contained in:
commit
670940fcfc
@ -11,7 +11,6 @@
|
||||
},
|
||||
"matrix_pins": {
|
||||
"cols": ["D1", "D4", "D5", "D6", "D7", "B0", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN"],
|
||||
"custom": true,
|
||||
"custom_lite": true,
|
||||
"rows": ["D0", "C3", "B1", "B2", "B3"]
|
||||
},
|
||||
|
@ -26,7 +26,6 @@
|
||||
"matrix_pins": {
|
||||
"cols": ["A10", "A9", "A8", "B1", "B0", "A7", "A6", "A5", "A4", "A3", "A2", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "C14"],
|
||||
"rows": ["B5", "B4", "B3", "A15", "A14", "A13"],
|
||||
"custom": true,
|
||||
"custom_lite": true
|
||||
},
|
||||
"diode_direction": "ROW2COL"
|
||||
|
@ -27,7 +27,6 @@
|
||||
"matrix_pins": {
|
||||
"cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", null, null, null, null, null, null, null, null],
|
||||
"rows": ["B5", "B4", "B3", "A15", "A14", "A13"],
|
||||
"custom": true,
|
||||
"custom_lite": true
|
||||
},
|
||||
"diode_direction": "ROW2COL",
|
||||
|
@ -96,11 +96,10 @@ def generate_rules_mk(cli):
|
||||
rules_mk_lines.append(generate_rule('SPLIT_TRANSPORT', 'custom'))
|
||||
|
||||
# Set CUSTOM_MATRIX, if needed
|
||||
if kb_info_json.get('matrix_pins', {}).get('custom'):
|
||||
if kb_info_json.get('matrix_pins', {}).get('custom_lite'):
|
||||
rules_mk_lines.append(generate_rule('CUSTOM_MATRIX', 'lite'))
|
||||
else:
|
||||
rules_mk_lines.append(generate_rule('CUSTOM_MATRIX', 'yes'))
|
||||
if kb_info_json.get('matrix_pins', {}).get('custom_lite'):
|
||||
rules_mk_lines.append(generate_rule('CUSTOM_MATRIX', 'lite'))
|
||||
elif kb_info_json.get('matrix_pins', {}).get('custom'):
|
||||
rules_mk_lines.append(generate_rule('CUSTOM_MATRIX', 'yes'))
|
||||
|
||||
if converter:
|
||||
rules_mk_lines.append(generate_rule('CONVERT_TO', converter))
|
||||
|
@ -302,6 +302,24 @@ def _extract_features(info_data, rules):
|
||||
return info_data
|
||||
|
||||
|
||||
def _extract_matrix_rules(info_data, rules):
|
||||
"""Find all the features enabled in rules.mk.
|
||||
"""
|
||||
if rules.get('CUSTOM_MATRIX', 'no') != 'no':
|
||||
if 'matrix_pins' in info_data and 'custom' in info_data['matrix_pins']:
|
||||
_log_warning(info_data, 'Custom Matrix is specified in both info.json and rules.mk, the rules.mk values win.')
|
||||
|
||||
if 'matrix_pins' not in info_data:
|
||||
info_data['matrix_pins'] = {}
|
||||
|
||||
if rules['CUSTOM_MATRIX'] == 'lite':
|
||||
info_data['matrix_pins']['custom_lite'] = True
|
||||
else:
|
||||
info_data['matrix_pins']['custom'] = True
|
||||
|
||||
return info_data
|
||||
|
||||
|
||||
def _pin_name(pin):
|
||||
"""Returns the proper representation for a pin.
|
||||
"""
|
||||
@ -549,7 +567,6 @@ def _extract_matrix_info(info_data, config_c):
|
||||
row_pins = config_c.get('MATRIX_ROW_PINS', '').replace('{', '').replace('}', '').strip()
|
||||
col_pins = config_c.get('MATRIX_COL_PINS', '').replace('{', '').replace('}', '').strip()
|
||||
direct_pins = config_c.get('DIRECT_PINS', '').replace(' ', '')[1:-1]
|
||||
info_snippet = {}
|
||||
|
||||
if 'MATRIX_ROWS' in config_c and 'MATRIX_COLS' in config_c:
|
||||
if 'matrix_size' in info_data:
|
||||
@ -564,26 +581,20 @@ def _extract_matrix_info(info_data, config_c):
|
||||
if 'matrix_pins' in info_data and 'cols' in info_data['matrix_pins'] and 'rows' in info_data['matrix_pins']:
|
||||
_log_warning(info_data, 'Matrix pins are specified in both info.json and config.h, the config.h values win.')
|
||||
|
||||
info_snippet['cols'] = _extract_pins(col_pins)
|
||||
info_snippet['rows'] = _extract_pins(row_pins)
|
||||
if 'matrix_pins' not in info_data:
|
||||
info_data['matrix_pins'] = {}
|
||||
|
||||
info_data['matrix_pins']['cols'] = _extract_pins(col_pins)
|
||||
info_data['matrix_pins']['rows'] = _extract_pins(row_pins)
|
||||
|
||||
if direct_pins:
|
||||
if 'matrix_pins' in info_data and 'direct' in info_data['matrix_pins']:
|
||||
_log_warning(info_data, 'Direct pins are specified in both info.json and config.h, the config.h values win.')
|
||||
|
||||
info_snippet['direct'] = _extract_direct_matrix(direct_pins)
|
||||
if 'matrix_pins' not in info_data:
|
||||
info_data['matrix_pins'] = {}
|
||||
|
||||
if config_c.get('CUSTOM_MATRIX', 'no') != 'no':
|
||||
if 'matrix_pins' in info_data and 'custom' in info_data['matrix_pins']:
|
||||
_log_warning(info_data, 'Custom Matrix is specified in both info.json and config.h, the config.h values win.')
|
||||
|
||||
info_snippet['custom'] = True
|
||||
|
||||
if config_c['CUSTOM_MATRIX'] == 'lite':
|
||||
info_snippet['custom_lite'] = True
|
||||
|
||||
if info_snippet:
|
||||
info_data['matrix_pins'] = info_snippet
|
||||
info_data['matrix_pins']['direct'] = _extract_direct_matrix(direct_pins)
|
||||
|
||||
return info_data
|
||||
|
||||
@ -752,6 +763,7 @@ def _extract_rules_mk(info_data, rules):
|
||||
|
||||
# Merge in config values that can't be easily mapped
|
||||
_extract_features(info_data, rules)
|
||||
_extract_matrix_rules(info_data, rules)
|
||||
|
||||
return info_data
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user