summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/generate/layouts.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/cli/generate/layouts.py')
-rwxr-xr-xlib/python/qmk/cli/generate/layouts.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/python/qmk/cli/generate/layouts.py b/lib/python/qmk/cli/generate/layouts.py
index e44266e1c8..a21311bd49 100755
--- a/lib/python/qmk/cli/generate/layouts.py
+++ b/lib/python/qmk/cli/generate/layouts.py
@@ -40,16 +40,12 @@ def generate_layouts(cli):
# Build the layouts.h file.
layouts_h_lines = ['/* This file was generated by `qmk generate-layouts`. Do not edit or copy.', ' */', '', '#pragma once']
- if 'matrix_pins' in kb_info_json:
- if 'direct' in kb_info_json['matrix_pins']:
- col_num = len(kb_info_json['matrix_pins']['direct'][0])
- row_num = len(kb_info_json['matrix_pins']['direct'])
- elif 'cols' in kb_info_json['matrix_pins'] and 'rows' in kb_info_json['matrix_pins']:
- col_num = len(kb_info_json['matrix_pins']['cols'])
- row_num = len(kb_info_json['matrix_pins']['rows'])
- else:
- cli.log.error('%s: Invalid matrix config.', cli.config.generate_layouts.keyboard)
- return False
+ if 'matrix_size' not in kb_info_json:
+ cli.log.error('%s: Invalid matrix config.', cli.config.generate_layouts.keyboard)
+ return False
+
+ col_num = kb_info_json['matrix_size']['cols']
+ row_num = kb_info_json['matrix_size']['rows']
for layout_name in kb_info_json['layouts']:
if kb_info_json['layouts'][layout_name]['c_macro']: