Tidy up devicetree bindings
This commit is contained in:
parent
66180b5480
commit
8bcee4f3b9
7 changed files with 19 additions and 22 deletions
|
@ -9,15 +9,14 @@ properties:
|
||||||
Pixel positions to which the animation should apply.
|
Pixel positions to which the animation should apply.
|
||||||
|
|
||||||
blending-mode:
|
blending-mode:
|
||||||
type: int
|
type: string
|
||||||
required: false
|
|
||||||
enum:
|
enum:
|
||||||
- 0
|
- "normal"
|
||||||
- 1
|
- "multiply"
|
||||||
- 2
|
- "lighten"
|
||||||
- 3
|
- "darken"
|
||||||
- 4
|
- "screen"
|
||||||
- 5
|
- "subtract"
|
||||||
default: 0
|
default: "normal"
|
||||||
description: |
|
description: |
|
||||||
Blending mode for the animation to use during render.
|
Blending mode for the animation to use during render.
|
||||||
|
|
|
@ -21,7 +21,6 @@ properties:
|
||||||
|
|
||||||
brightness-steps:
|
brightness-steps:
|
||||||
type: int
|
type: int
|
||||||
required: false
|
|
||||||
default: 5
|
default: 5
|
||||||
description: |
|
description: |
|
||||||
How many brightness steps should be supported.
|
How many brightness steps should be supported.
|
||||||
|
|
|
@ -11,7 +11,6 @@ include: animation_base.yaml
|
||||||
properties:
|
properties:
|
||||||
duration:
|
duration:
|
||||||
type: int
|
type: int
|
||||||
required: false
|
|
||||||
default: 1000
|
default: 1000
|
||||||
description: |
|
description: |
|
||||||
Approximate ripple travel time in milliseconds.
|
Approximate ripple travel time in milliseconds.
|
||||||
|
@ -20,7 +19,7 @@ properties:
|
||||||
type: int
|
type: int
|
||||||
required: true
|
required: true
|
||||||
description: |
|
description: |
|
||||||
Ripple color.
|
Ripple color in HSL format.
|
||||||
|
|
||||||
buffer-size:
|
buffer-size:
|
||||||
type: int
|
type: int
|
||||||
|
|
|
@ -11,7 +11,6 @@ include: animation_base.yaml
|
||||||
properties:
|
properties:
|
||||||
duration:
|
duration:
|
||||||
type: int
|
type: int
|
||||||
required: false
|
|
||||||
default: 5
|
default: 5
|
||||||
description: |
|
description: |
|
||||||
Animation duration in seconds.
|
Animation duration in seconds.
|
||||||
|
@ -22,4 +21,4 @@ properties:
|
||||||
type: array
|
type: array
|
||||||
required: true
|
required: true
|
||||||
description: |
|
description: |
|
||||||
The colors to cycle through during the animation.
|
The colors to cycle through during the animation in HSL format.
|
||||||
|
|
|
@ -11,7 +11,13 @@ properties:
|
||||||
required: true
|
required: true
|
||||||
description: |
|
description: |
|
||||||
This array should contain all driver devices responsible for illuminating animated LEDs.
|
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:
|
pixels:
|
||||||
type: phandle-array
|
type: phandle-array
|
||||||
|
@ -23,7 +29,6 @@ properties:
|
||||||
|
|
||||||
key-pixels:
|
key-pixels:
|
||||||
type: array
|
type: array
|
||||||
required: false
|
|
||||||
description: |
|
description: |
|
||||||
Use this field to specify the pixel index corresponding to each key
|
Use this field to specify the pixel index corresponding to each key
|
||||||
following the order used in your keymap.
|
following the order used in your keymap.
|
||||||
|
|
|
@ -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_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) \
|
#define PHANDLE_TO_PIXEL(node_id, prop, idx) \
|
||||||
{ \
|
{ \
|
||||||
.position_x = DT_PHA_BY_IDX(node_id, prop, idx, position_x), \
|
.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.
|
* Array containing the number of LEDs handled by each device.
|
||||||
*/
|
*/
|
||||||
static const uint8_t pixels_per_driver[] = {
|
static const uint8_t pixels_per_driver[] = DT_INST_PROP(0, chain_lengths);
|
||||||
DT_INST_FOREACH_PROP_ELEM(0, drivers, PHANDLE_TO_CHAIN_LENGTH)};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pointer to the root animation
|
* Pointer to the root animation
|
||||||
|
|
|
@ -184,7 +184,7 @@ static const struct animation_api animation_ripple_api = {
|
||||||
.pixel_map = &animation_ripple_##idx##_pixel_map[0], \
|
.pixel_map = &animation_ripple_##idx##_pixel_map[0], \
|
||||||
.pixel_map_size = DT_INST_PROP_LEN(idx, pixels), \
|
.pixel_map_size = DT_INST_PROP_LEN(idx, pixels), \
|
||||||
.event_buffer_size = DT_INST_PROP(idx, buffer_size), \
|
.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 = \
|
.distance_per_frame = \
|
||||||
(255 * 1000 / DT_INST_PROP(idx, duration)) / CONFIG_ZMK_ANIMATION_FPS, \
|
(255 * 1000 / DT_INST_PROP(idx, duration)) / CONFIG_ZMK_ANIMATION_FPS, \
|
||||||
.ripple_width = DT_INST_PROP(idx, ripple_width) / 2, \
|
.ripple_width = DT_INST_PROP(idx, ripple_width) / 2, \
|
||||||
|
|
Loading…
Add table
Reference in a new issue