diff --git a/app/dts/bindings/animations/animation_base.yaml b/app/dts/bindings/animations/animation_base.yaml index a8f10655..342ee894 100644 --- a/app/dts/bindings/animations/animation_base.yaml +++ b/app/dts/bindings/animations/animation_base.yaml @@ -9,15 +9,14 @@ properties: Pixel positions to which the animation should apply. blending-mode: - type: int - required: false + type: string enum: - - 0 - - 1 - - 2 - - 3 - - 4 - - 5 - default: 0 + - "normal" + - "multiply" + - "lighten" + - "darken" + - "screen" + - "subtract" + default: "normal" description: | Blending mode for the animation to use during render. diff --git a/app/dts/bindings/animations/zmk,animation-control.yaml b/app/dts/bindings/animations/zmk,animation-control.yaml index 7549f044..82f049b1 100644 --- a/app/dts/bindings/animations/zmk,animation-control.yaml +++ b/app/dts/bindings/animations/zmk,animation-control.yaml @@ -21,7 +21,6 @@ properties: brightness-steps: type: int - required: false default: 5 description: | How many brightness steps should be supported. diff --git a/app/dts/bindings/animations/zmk,animation-ripple.yaml b/app/dts/bindings/animations/zmk,animation-ripple.yaml index 88f5416c..df1a7eea 100644 --- a/app/dts/bindings/animations/zmk,animation-ripple.yaml +++ b/app/dts/bindings/animations/zmk,animation-ripple.yaml @@ -11,7 +11,6 @@ include: animation_base.yaml properties: duration: type: int - required: false default: 1000 description: | Approximate ripple travel time in milliseconds. @@ -20,7 +19,7 @@ properties: type: int required: true description: | - Ripple color. + Ripple color in HSL format. buffer-size: type: int diff --git a/app/dts/bindings/animations/zmk,animation-solid.yaml b/app/dts/bindings/animations/zmk,animation-solid.yaml index b4247885..5cca9f27 100644 --- a/app/dts/bindings/animations/zmk,animation-solid.yaml +++ b/app/dts/bindings/animations/zmk,animation-solid.yaml @@ -11,7 +11,6 @@ include: animation_base.yaml properties: duration: type: int - required: false default: 5 description: | Animation duration in seconds. @@ -22,4 +21,4 @@ properties: type: array required: true description: | - The colors to cycle through during the animation. + The colors to cycle through during the animation in HSL format. diff --git a/app/dts/bindings/zmk,animation.yaml b/app/dts/bindings/zmk,animation.yaml index 32b90395..1f82f7b4 100644 --- a/app/dts/bindings/zmk,animation.yaml +++ b/app/dts/bindings/zmk,animation.yaml @@ -11,7 +11,13 @@ properties: required: true description: | This array should contain all driver devices responsible for illuminating animated LEDs. - The devices must implement Zephyr's LED Strip Interface and expose a chain-lenght devicetree property. + The devices must implement Zephyr's LED Strip Interface. + + chain-lengths: + type: array + required: true + description: | + This field contains the number of LEDs controlled by each driver device. pixels: type: phandle-array @@ -23,7 +29,6 @@ properties: key-pixels: type: array - required: false description: | Use this field to specify the pixel index corresponding to each key following the order used in your keymap. diff --git a/app/src/animation/animation.c b/app/src/animation/animation.c index 53a2f5f8..ad3b1500 100644 --- a/app/src/animation/animation.c +++ b/app/src/animation/animation.c @@ -25,9 +25,6 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #define PHANDLE_TO_DEVICE(node_id, prop, idx) DEVICE_DT_GET(DT_PHANDLE_BY_IDX(node_id, prop, idx)), -#define PHANDLE_TO_CHAIN_LENGTH(node_id, prop, idx) \ - DT_PROP_BY_PHANDLE_IDX(node_id, prop, idx, chain_length), - #define PHANDLE_TO_PIXEL(node_id, prop, idx) \ { \ .position_x = DT_PHA_BY_IDX(node_id, prop, idx, position_x), \ @@ -47,8 +44,7 @@ static const size_t drivers_size = DT_INST_PROP_LEN(0, drivers); /** * Array containing the number of LEDs handled by each device. */ -static const uint8_t pixels_per_driver[] = { - DT_INST_FOREACH_PROP_ELEM(0, drivers, PHANDLE_TO_CHAIN_LENGTH)}; +static const uint8_t pixels_per_driver[] = DT_INST_PROP(0, chain_lengths); /** * Pointer to the root animation diff --git a/app/src/animation/animation_ripple.c b/app/src/animation/animation_ripple.c index 80cae740..aa1b2966 100644 --- a/app/src/animation/animation_ripple.c +++ b/app/src/animation/animation_ripple.c @@ -184,7 +184,7 @@ static const struct animation_api animation_ripple_api = { .pixel_map = &animation_ripple_##idx##_pixel_map[0], \ .pixel_map_size = DT_INST_PROP_LEN(idx, pixels), \ .event_buffer_size = DT_INST_PROP(idx, buffer_size), \ - .blending_mode = DT_INST_PROP(idx, blending_mode), \ + .blending_mode = DT_INST_ENUM_IDX(idx, blending_mode), \ .distance_per_frame = \ (255 * 1000 / DT_INST_PROP(idx, duration)) / CONFIG_ZMK_ANIMATION_FPS, \ .ripple_width = DT_INST_PROP(idx, ripple_width) / 2, \