From 9eaee65ac3752f8f3c6c11261bc7ba425c10a741 Mon Sep 17 00:00:00 2001 From: Zach White Date: Thu, 9 Sep 2021 08:07:34 -0700 Subject: [PATCH] make custom keycodes actually work --- lib/python/qmk/cli/generate/layouts.py | 24 +++++++++++++----------- tmk_core/rules.mk | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/python/qmk/cli/generate/layouts.py b/lib/python/qmk/cli/generate/layouts.py index f8c25f20f2..39bd812284 100755 --- a/lib/python/qmk/cli/generate/layouts.py +++ b/lib/python/qmk/cli/generate/layouts.py @@ -52,19 +52,21 @@ def generate_layouts(cli): return False if 'custom_keycodes' in kb_info_json: + layouts_h_lines.append('\n#ifndef __ASSEMBLER__') layouts_h_lines.append('\n#include "quantum_keycodes.h"') - #layouts_h_lines.append('\nenum custom_keycodes {') + layouts_h_lines.append('\nenum custom_keycodes {') first = True - #for keycode in kb_info_json['custom_keycodes']: - # if first: - # first = False - # layouts_h_lines.append(f'\t{keycode} = SAFE_RANGE,') - # else: - # layouts_h_lines.append(f'\t{keycode},') - #layouts_h_lines.append('\tNEW_SAFE_RANGE') - #layouts_h_lines.append('}\n') - #layouts_h_lines.append('#undef SAFE_RANGE') - #layouts_h_lines.append('#define SAFE_RANGE NEW_SAFE_RANGE') + for keycode in kb_info_json['custom_keycodes']: + if first: + first = False + layouts_h_lines.append(f'\t{keycode} = SAFE_RANGE,') + else: + layouts_h_lines.append(f'\t{keycode},') + layouts_h_lines.append('\tNEW_SAFE_RANGE') + layouts_h_lines.append('};\n') + layouts_h_lines.append('#undef SAFE_RANGE') + layouts_h_lines.append('#define SAFE_RANGE NEW_SAFE_RANGE') + layouts_h_lines.append('#endif // __ASSEMBLER__') for layout_name in kb_info_json['layouts']: if kb_info_json['layouts'][layout_name]['c_macro']: diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 1dfcf75a1f..5a7f299102 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -358,7 +358,7 @@ $1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG)) endif $1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) $1_CXXFLAGS = $$(ALL_CXXFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) -$1_ASFLAGS = $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) +$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)