Add animation devicetree bindings

This commit is contained in:
Kuba Birecki 2021-12-02 12:54:03 +01:00
parent 9d714c0b69
commit c3beca12bd
3 changed files with 54 additions and 0 deletions

View file

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

View file

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

View file

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