Add MATRIX_MASKED DD config (#25383)

This commit is contained in:
Joel Challis 2025-06-27 08:17:45 +01:00 committed by GitHub
parent bc5c5e3251
commit a1a5869ef8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 25 additions and 15 deletions

View File

@ -120,6 +120,7 @@
"MATRIX_HAS_GHOST": {"info_key": "matrix_pins.ghost", "value_type": "flag"}, "MATRIX_HAS_GHOST": {"info_key": "matrix_pins.ghost", "value_type": "flag"},
"MATRIX_INPUT_PRESSED_STATE": {"info_key": "matrix_pins.input_pressed_state", "value_type": "int"}, "MATRIX_INPUT_PRESSED_STATE": {"info_key": "matrix_pins.input_pressed_state", "value_type": "int"},
"MATRIX_IO_DELAY": {"info_key": "matrix_pins.io_delay", "value_type": "int"}, "MATRIX_IO_DELAY": {"info_key": "matrix_pins.io_delay", "value_type": "int"},
"MATRIX_MASKED": {"info_key": "matrix_pins.masked", "value_type": "flag"},
// Mouse Keys // Mouse Keys
"MOUSEKEY_DELAY": {"info_key": "mousekey.delay", "value_type": "int"}, "MOUSEKEY_DELAY": {"info_key": "mousekey.delay", "value_type": "int"},

View File

@ -473,6 +473,7 @@
"ghost": {"type": "boolean"}, "ghost": {"type": "boolean"},
"input_pressed_state": {"$ref": "./definitions.jsonschema#/unsigned_int"}, "input_pressed_state": {"$ref": "./definitions.jsonschema#/unsigned_int"},
"io_delay": {"$ref": "./definitions.jsonschema#/unsigned_int"}, "io_delay": {"$ref": "./definitions.jsonschema#/unsigned_int"},
"masked": {"type": "boolean"},
"direct": { "direct": {
"type": "array", "type": "array",
"items": {"$ref": "./definitions.jsonschema#/mcu_pin_array"} "items": {"$ref": "./definitions.jsonschema#/mcu_pin_array"}

View File

@ -480,6 +480,9 @@ Configures the [LED Matrix](features/led_matrix) feature.
* `io_delay` <Badge type="info">Number</Badge> * `io_delay` <Badge type="info">Number</Badge>
* The amount of time to wait between row/col selection and col/row pin reading, in microseconds. * The amount of time to wait between row/col selection and col/row pin reading, in microseconds.
* Default: `30` (30 µs) * Default: `30` (30 µs)
* `masked` <Badge type="info">Boolean</Badge>
* Whether configured intersections should be ignored.
* Default: `false`
* `rows` <Badge type="info">Array: Pin</Badge> * `rows` <Badge type="info">Array: Pin</Badge>
* A list of GPIO pins connected to the matrix rows. * A list of GPIO pins connected to the matrix rows.
* Example: `["B0", "B1", "B2"]` * Example: `["B0", "B1", "B2"]`

View File

@ -72,19 +72,6 @@ def generate_matrix_size(kb_info_json, config_h_lines):
config_h_lines.append(generate_define('MATRIX_ROWS', kb_info_json['matrix_size']['rows'])) config_h_lines.append(generate_define('MATRIX_ROWS', kb_info_json['matrix_size']['rows']))
def generate_matrix_masked(kb_info_json, config_h_lines):
""""Enable matrix mask if required"""
mask_required = False
if 'matrix_grid' in kb_info_json.get('dip_switch', {}):
mask_required = True
if 'matrix_grid' in kb_info_json.get('split', {}).get('handedness', {}):
mask_required = True
if mask_required:
config_h_lines.append(generate_define('MATRIX_MASKED'))
def generate_config_items(kb_info_json, config_h_lines): def generate_config_items(kb_info_json, config_h_lines):
"""Iterate through the info_config map to generate basic config values. """Iterate through the info_config map to generate basic config values.
""" """
@ -202,8 +189,6 @@ def generate_config_h(cli):
generate_matrix_size(kb_info_json, config_h_lines) generate_matrix_size(kb_info_json, config_h_lines)
generate_matrix_masked(kb_info_json, config_h_lines)
if 'matrix_pins' in kb_info_json: if 'matrix_pins' in kb_info_json:
config_h_lines.append(matrix_pins(kb_info_json['matrix_pins'])) config_h_lines.append(matrix_pins(kb_info_json['matrix_pins']))

View File

@ -254,6 +254,7 @@ def info_json(keyboard, force_layout=None):
# Ensure that we have various calculated values # Ensure that we have various calculated values
info_data = _matrix_size(info_data) info_data = _matrix_size(info_data)
info_data = _joystick_axis_count(info_data) info_data = _joystick_axis_count(info_data)
info_data = _matrix_masked(info_data)
# Merge in data from <keyboard.c> # Merge in data from <keyboard.c>
info_data = _extract_led_config(info_data, str(keyboard)) info_data = _extract_led_config(info_data, str(keyboard))
@ -830,6 +831,25 @@ def _joystick_axis_count(info_data):
return info_data return info_data
def _matrix_masked(info_data):
""""Add info_data['matrix_pins.masked'] if required"""
mask_required = False
if 'matrix_grid' in info_data.get('dip_switch', {}):
mask_required = True
if 'matrix_grid' in info_data.get('split', {}).get('handedness', {}):
mask_required = True
if mask_required:
if 'masked' not in info_data.get('matrix_pins', {}):
if 'matrix_pins' not in info_data:
info_data['matrix_pins'] = {}
info_data['matrix_pins']['masked'] = True
return info_data
def _check_matrix(info_data): def _check_matrix(info_data):
"""Check the matrix to ensure that row/column count is consistent. """Check the matrix to ensure that row/column count is consistent.
""" """