make custom keycodes actually work

This commit is contained in:
Zach White 2021-09-09 08:07:34 -07:00
parent 5b0b8ba654
commit 9eaee65ac3
2 changed files with 14 additions and 12 deletions

View file

@ -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']:

View file

@ -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)