summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2022-09-26 10:04:21 +1000
committerGitHub <noreply@github.com>2022-09-26 01:04:21 +0100
commit675d91b813db6488ccc1ca55555ebbf0d4a45dc0 (patch)
tree1ee01a98cd8c902c267dc52a4a7bfd6cd7adcd60
parent5c2b598c42b102f6133a4b8cece61246d09a82fd (diff)
Generate DD RGBLight/LED/RGB Matrix animation defines (#18459)
-rw-r--r--data/mappings/info_config.json10
-rw-r--r--data/schemas/keyboard.jsonschema12
-rwxr-xr-xlib/python/qmk/cli/generate/config_h.py15
3 files changed, 27 insertions, 10 deletions
diff --git a/data/mappings/info_config.json b/data/mappings/info_config.json
index b27081e037..49b0a1bfe0 100644
--- a/data/mappings/info_config.json
+++ b/data/mappings/info_config.json
@@ -64,16 +64,6 @@
"RGB_DI_PIN": {"info_key": "rgblight.pin"},
"RGBLED_NUM": {"info_key": "rgblight.led_count", "value_type": "int"},
"RGBLED_SPLIT": {"info_key": "rgblight.split_count", "value_type": "array.int"},
- "RGBLIGHT_EFFECT_ALTERNATING": {"info_key": "rgblight.animations.alternating", "value_type": "bool"},
- "RGBLIGHT_EFFECT_BREATHING": {"info_key": "rgblight.animations.breathing", "value_type": "bool"},
- "RGBLIGHT_EFFECT_CHRISTMAS": {"info_key": "rgblight.animations.christmas", "value_type": "bool"},
- "RGBLIGHT_EFFECT_KNIGHT": {"info_key": "rgblight.animations.knight", "value_type": "bool"},
- "RGBLIGHT_EFFECT_RAINBOW_MOOD": {"info_key": "rgblight.animations.rainbow_mood", "value_type": "bool"},
- "RGBLIGHT_EFFECT_RAINBOW_SWIRL": {"info_key": "rgblight.animations.rainbow_swirl", "value_type": "bool"},
- "RGBLIGHT_EFFECT_RGB_TEST": {"info_key": "rgblight.animations.rgb_test", "value_type": "bool"},
- "RGBLIGHT_EFFECT_SNAKE": {"info_key": "rgblight.animations.snake", "value_type": "bool"},
- "RGBLIGHT_EFFECT_STATIC_GRADIENT": {"info_key": "rgblight.animations.static_gradient", "value_type": "bool"},
- "RGBLIGHT_EFFECT_TWINKLE": {"info_key": "rgblight.animations.twinkle"},
"RGBLIGHT_LAYER_BLINK": {"info_key": "rgblight.layers.blink", "value_type": "bool"},
"RGBLIGHT_LAYERS": {"info_key": "rgblight.layers.enabled", "value_type": "bool"},
"RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF": {"info_key": "rgblight.layers.override_rgb", "value_type": "bool"},
diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema
index ff5163e737..1906ce5f75 100644
--- a/data/schemas/keyboard.jsonschema
+++ b/data/schemas/keyboard.jsonschema
@@ -264,6 +264,12 @@
"led_matrix": {
"type": "object",
"properties": {
+ "animations": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "boolean"
+ }
+ },
"driver": {"type": "string"},
"center_point": {
"type": "array",
@@ -308,6 +314,12 @@
"rgb_matrix": {
"type": "object",
"properties": {
+ "animations": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "boolean"
+ }
+ },
"driver": {"type": "string"},
"center_point": {
"type": "array",
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py
index d6e87c8803..3752174841 100755
--- a/lib/python/qmk/cli/generate/config_h.py
+++ b/lib/python/qmk/cli/generate/config_h.py
@@ -156,6 +156,12 @@ def generate_split_config(kb_info_json, config_h_lines):
generate_encoder_config(kb_info_json['split']['encoder']['right'], config_h_lines, '_RIGHT')
+def generate_led_animations_config(led_feature_json, config_h_lines, prefix):
+ for animation in led_feature_json.get('animations', {}):
+ if led_feature_json['animations'][animation]:
+ config_h_lines.append(generate_define(f'{prefix}{animation.upper()}'))
+
+
@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to')
@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
@cli.argument('-kb', '--keyboard', arg_only=True, type=keyboard_folder, completer=keyboard_completer, required=True, help='Keyboard to generate config.h for.')
@@ -186,5 +192,14 @@ def generate_config_h(cli):
if 'split' in kb_info_json:
generate_split_config(kb_info_json, config_h_lines)
+ if 'led_matrix' in kb_info_json:
+ generate_led_animations_config(kb_info_json['led_matrix'], config_h_lines, 'ENABLE_LED_MATRIX_')
+
+ if 'rgb_matrix' in kb_info_json:
+ generate_led_animations_config(kb_info_json['rgb_matrix'], config_h_lines, 'ENABLE_RGB_MATRIX_')
+
+ if 'rgblight' in kb_info_json:
+ generate_led_animations_config(kb_info_json['rgblight'], config_h_lines, 'RGBLIGHT_EFFECT_')
+
# Show the results
dump_lines(cli.args.output, config_h_lines, cli.args.quiet)