Skip to content

Commit

Permalink
Fix broken keyboards (qmk#11412)
Browse files Browse the repository at this point in the history
* Fix a couple errors

* add a dependency for the generated headers
  • Loading branch information
skullydazed authored Jan 3, 2021
1 parent 021bf3b commit 27153e0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
19 changes: 10 additions & 9 deletions lib/python/qmk/cli/generate/layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ 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 '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_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

for layout_name in kb_info_json['layouts']:
if kb_info_json['layouts'][layout_name]['c_macro']:
Expand Down
3 changes: 3 additions & 0 deletions lib/python/qmk/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ def _extract_indicators(info_data, config_c):
_log_warning(info_data, f'Indicator {json_key} is specified in both info.json and config.h, the config.h value wins.')

if config_key in config_c:
if 'indicators' not in info_data:
info_data['indicators'] = {}

info_data['indicators'][json_key] = config_c.get(config_key)

return info_data
Expand Down
8 changes: 4 additions & 4 deletions tmk_core/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -324,27 +324,27 @@ $1_CXXFLAGS = $$(ALL_CXXFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $
$1_ASFLAGS = $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS)

# Compile: create object files from C source files.
$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h | $(BEGIN)
@mkdir -p $$(@D)
@$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
$$(eval CMD := $$(CC) -c $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
@$$(BUILD_CMD)

# Compile: create object files from C++ source files.
$1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
$1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h | $(BEGIN)
@mkdir -p $$(@D)
@$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
$$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
@$$(BUILD_CMD)

$1/%.o : %.cc $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
$1/%.o : %.cc $1/%.d $1/cxxflags.txt $1/compiler.txt $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h | $(BEGIN)
@mkdir -p $$(@D)
@$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
$$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
@$$(BUILD_CMD)

# Assemble: create object files from assembler source files.
$1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN)
$1/%.o : %.S $1/asflags.txt $1/compiler.txt $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h | $(BEGIN)
@mkdir -p $$(@D)
@$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
$$(eval CMD=$$(CC) -c $$($1_ASFLAGS) $$< -o $$@)
Expand Down

0 comments on commit 27153e0

Please sign in to comment.