From c3beca12bde0003711fca7f74c9d3f3aec33c72f Mon Sep 17 00:00:00 2001 From: Kuba Birecki Date: Thu, 2 Dec 2021 12:54:03 +0100 Subject: [PATCH] Add animation devicetree bindings --- app/dts/bindings/zmk,animation-pixel.yaml | 11 +++++++++ app/dts/bindings/zmk,animation.yaml | 28 +++++++++++++++++++++++ app/include/dt-bindings/zmk/animation.h | 15 ++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 app/dts/bindings/zmk,animation-pixel.yaml create mode 100644 app/dts/bindings/zmk,animation.yaml create mode 100644 app/include/dt-bindings/zmk/animation.h diff --git a/app/dts/bindings/zmk,animation-pixel.yaml b/app/dts/bindings/zmk,animation-pixel.yaml new file mode 100644 index 00000000..a5588dc6 --- /dev/null +++ b/app/dts/bindings/zmk,animation-pixel.yaml @@ -0,0 +1,11 @@ +# Copyright (c) 2020, The ZMK Contributors +# SPDX-License-Identifier: MIT + +description: Pixel configuration + +compatible: "zmk,animation-pixel" + +pixel-cells: + - animation + - position_x + - position_y diff --git a/app/dts/bindings/zmk,animation.yaml b/app/dts/bindings/zmk,animation.yaml new file mode 100644 index 00000000..664de459 --- /dev/null +++ b/app/dts/bindings/zmk,animation.yaml @@ -0,0 +1,28 @@ +# Copyright (c) 2020, The ZMK Contributors +# SPDX-License-Identifier: MIT + +description: Global animation configuration + +compatible: "zmk,animation" + +properties: + drivers: + type: phandles + 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. + + animations: + type: phandles + required: true + description: | + Handles to all active animations. + + pixels: + type: phandle-array + required: true + description: | + This field contains the pixel configuration for the entire board. + The order of this array determines in what order pixels are sent to the driver device API. + If multiple driving devices are used, their chain-length property determines the size of the buffer for each device. diff --git a/app/include/dt-bindings/zmk/animation.h b/app/include/dt-bindings/zmk/animation.h new file mode 100644 index 00000000..3b74d025 --- /dev/null +++ b/app/include/dt-bindings/zmk/animation.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/** + * Maps HSL color settings into a single uint32_t value + * that can be cast to zmk_color_hsl. + */ +#ifdef CONFIG_BIG_ENDIAN +#define HSL(h, s, l) ((h << 16) + (s << 8) + l) +#else +#define HSL(h, s, l) (h + (s << 16) + (l << 24)) +#endif