underglow-layer: use behaviors to control RGBs
This commit is contained in:
parent
aa151f7473
commit
f178f86a54
20 changed files with 352 additions and 26 deletions
9
app/include/dt-bindings/zmk/hid_indicators.h
Normal file
9
app/include/dt-bindings/zmk/hid_indicators.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#define NUM_LOCK 0
|
||||
#define CAPS_LOCK 1
|
||||
#define SCROLL_LOCK 2
|
||||
|
|
@ -14,4 +14,5 @@
|
|||
#define PURPLE 0x800080
|
||||
#define PINK 0xffc0cb
|
||||
#define WHITE 0xffffff
|
||||
#define ______ 0x000000
|
||||
#define ___ 0x000000
|
||||
#define BLACK 0x000000
|
||||
15
app/include/zmk/events/underglow_color_changed.h
Normal file
15
app/include/zmk/events/underglow_color_changed.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2024 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <zmk/event_manager.h>
|
||||
|
||||
struct zmk_underglow_color_changed {
|
||||
uint32_t layers;
|
||||
};
|
||||
|
||||
ZMK_EVENT_DECLARE(zmk_underglow_color_changed);
|
||||
|
|
@ -12,7 +12,18 @@
|
|||
#define ZMK_RGBMAP_LAYERS_LEN \
|
||||
(DT_FOREACH_CHILD(DT_INST(0, zmk_underglow_layer), ZMK_RGB_CHILD_LEN_PLUS_ONE) 0)
|
||||
|
||||
#define ZMK_RGBMAP_EXTRACT_BINDING(idx, drv_inst) \
|
||||
{ \
|
||||
.behavior_dev = DEVICE_DT_NAME(DT_PHANDLE_BY_IDX(drv_inst, bindings, idx)), \
|
||||
.param1 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(drv_inst, bindings, idx, param1), (0), \
|
||||
(DT_PHA_BY_IDX(drv_inst, bindings, idx, param1))), \
|
||||
.param2 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(drv_inst, bindings, idx, param2), (0), \
|
||||
(DT_PHA_BY_IDX(drv_inst, bindings, idx, param2))), \
|
||||
}
|
||||
|
||||
const int rgb_pixel_lookup(int idx);
|
||||
const int zmk_rgbmap_id(uint8_t layer);
|
||||
uint32_t *rgb_underglow_get_bindings(uint8_t layer);
|
||||
const struct zmk_behavior_binding *rgb_underglow_get_bindings(uint8_t layer);
|
||||
|
||||
uint8_t rgb_underglow_top_layer_with_state(uint32_t state_to_test);
|
||||
uint8_t rgb_underglow_top_layer(void);
|
||||
Loading…
Add table
Add a link
Reference in a new issue