feat: Add LED indicator support (#3239)

This adds a new zmk,indicator-leds device, which maps HID indicator
states onto any devices that implement the LED driver API. This adds
support for things like a caps lock LED.

The name was chosen so that more drivers could be added later as
zmk,indicator-*, for example a version that uses the LED strip API.
This commit is contained in:
Joel Spadin
2026-03-23 01:35:35 -05:00
committed by GitHub
parent a1aca03aa0
commit 197f899777
12 changed files with 540 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2026 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <dt-bindings/zmk/hid_usage.h>
// hid.h defines HID_USAGE_LED_NUM_LOCK as the minimum value, so that is bit
// zero in the report, and all other indicators are relative to that.
#define HID_INDICATOR_NUM_LOCK (1 << (HID_USAGE_LED_NUM_LOCK - HID_USAGE_LED_NUM_LOCK))
#define HID_INDICATOR_CAPS_LOCK (1 << (HID_USAGE_LED_CAPS_LOCK - HID_USAGE_LED_NUM_LOCK))
#define HID_INDICATOR_SCROLL_LOCK (1 << (HID_USAGE_LED_SCROLL_LOCK - HID_USAGE_LED_NUM_LOCK))
#define HID_INDICATOR_COMPOSE (1 << (HID_USAGE_LED_COMPOSE - HID_USAGE_LED_NUM_LOCK))
#define HID_INDICATOR_KANA (1 << (HID_USAGE_LED_KANA - HID_USAGE_LED_NUM_LOCK))