underglow-layer: enable only if config exists in devicetree
This commit is contained in:
parent
0ca086a845
commit
da994be0ba
5 changed files with 55 additions and 16 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#include <zephyr/sys/util.h>
|
||||
|
||||
#include <zmk/split/bluetooth/peripheral_layers.h>
|
||||
#include <zmk/keymap.h>
|
||||
|
||||
static uint32_t peripheral_layers = 0;
|
||||
|
||||
|
|
@ -10,4 +11,15 @@ void set_peripheral_layers_state(uint32_t new_layers) { peripheral_layers = new_
|
|||
|
||||
bool peripheral_layer_active(uint8_t layer) {
|
||||
return (peripheral_layers & (BIT(layer))) == (BIT(layer));
|
||||
};
|
||||
};
|
||||
|
||||
uint8_t peripheral_highest_layer_active(void) {
|
||||
if (peripheral_layers > 0) {
|
||||
for (uint8_t layer = ZMK_KEYMAP_LAYERS_LEN - 1; layer > 0; layer--) {
|
||||
if ((peripheral_layers & (BIT(layer))) == (BIT(layer)) || layer == 0) {
|
||||
return layer;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue