Browse Source

make custom keycodes actually work

json_custom_keycodes
Zach White 2 years ago
parent
commit
9eaee65ac3
2 changed files with 14 additions and 12 deletions
  1. +13
    -11
      lib/python/qmk/cli/generate/layouts.py
  2. +1
    -1
      tmk_core/rules.mk

+ 13
- 11
lib/python/qmk/cli/generate/layouts.py 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']:


+ 1
- 1
tmk_core/rules.mk 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)


Loading…
Cancel
Save