Tidy up devicetree bindings

This commit is contained in:
Kuba Birecki 2023-06-21 12:19:46 +02:00
parent 66180b5480
commit 8bcee4f3b9
7 changed files with 19 additions and 22 deletions

View file

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

View file

@ -21,7 +21,6 @@ properties:
brightness-steps:
type: int
required: false
default: 5
description: |
How many brightness steps should be supported.

View file

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

View file

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

View file

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

View file

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

View file

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