From 1714765941cc1291ff6d493d756e0d40e578cf02 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Thu, 7 Mar 2024 22:08:34 +0100 Subject: [PATCH 1/4] Get started with LEDControl documentation Signed-off-by: Evy Bongers --- plugins/Kaleidoscope-LEDControl/README.md | 50 ++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/plugins/Kaleidoscope-LEDControl/README.md b/plugins/Kaleidoscope-LEDControl/README.md index 675d2c9a67..a021c18611 100644 --- a/plugins/Kaleidoscope-LEDControl/README.md +++ b/plugins/Kaleidoscope-LEDControl/README.md @@ -1,6 +1,54 @@ # Kaleidoscope-LEDControl This is a plugin for [Kaleidoscope][fw], for controlling the LEDs, and LED -effects. +effects. It is also a building block for plugins that control LEDs. [fw]: https://github.com/keyboardio/Kaleidoscope + +## Using the extension + +## Plugin methods + +### `.next_mode(void)` + +> Activates the next LED mode. cycles to the first LED mode if the current LED +> mode is the last one. + +### `.prev_mode(void)` + +> Activates the previous LED mode. cycles to the last LED mode if the current +> LED mode is the first one. + +### `.set_mode(uint8_t mode_id)` +### `.get_mode_index()` +### `.get_mode()` +### `.refreshAll()` +### `.setCrgbAt(uint8_t led_index, cRGB crgb)` +### `.setCrgbAt(KeyAddr key_addr, cRGB color)` +### `.getCrgbAt(uint8_t led_index)` +### `.getCrgbAt(KeyAddr key_addr)` +### `.syncLeds(void)` +### `.set_all_leds_to(uint8_t r, uint8_t g, uint8_t b)` +### `.set_all_leds_to(cRGB color)` +### `.setSyncInterval(uint8_t interval)` +### `.setBrightness(uint8_t brightness)` +### `.getBrightness()` + +### `.onSetup()` +### `.setup(void)` +### `.onKeyEvent(KeyEvent &event)` +### `.afterEachCycle()` +### `.update(void)` + +> Triggers the currently active LED mode to update. It is up to the LED mode to +> handle this correctly. + +### `.refreshAt(KeyAddr key_addr)` + +> Triggers the currently active LED mode to refresh the LED at the specified key +> address. + +### `.activate(LEDModeInterface *plugin)` +### `.disable()` +### `.enable()` +### `.isEnabled()` From 7942fad328b464117246dfefeabb092263dc335a Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Tue, 12 Mar 2024 18:08:19 +0100 Subject: [PATCH 2/4] Add documentation for a number of methods Signed-off-by: Evy Bongers --- plugins/Kaleidoscope-LEDControl/README.md | 70 ++++++++++++++++++++++- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/plugins/Kaleidoscope-LEDControl/README.md b/plugins/Kaleidoscope-LEDControl/README.md index a021c18611..7108918352 100644 --- a/plugins/Kaleidoscope-LEDControl/README.md +++ b/plugins/Kaleidoscope-LEDControl/README.md @@ -11,33 +11,87 @@ effects. It is also a building block for plugins that control LEDs. ### `.next_mode(void)` -> Activates the next LED mode. cycles to the first LED mode if the current LED +> Activates the next LED mode. Cycles to the first LED mode if the current LED > mode is the last one. ### `.prev_mode(void)` -> Activates the previous LED mode. cycles to the last LED mode if the current +> Activates the previous LED mode. Cycles to the last LED mode if the current > LED mode is the first one. +### `.get_mode()` + + ### `.set_mode(uint8_t mode_id)` + +> Activates a LED mode by its index in the firmware. If the index exceeds the +> numer of led modes, the method returns early. + ### `.get_mode_index()` -### `.get_mode()` + +> Returns the index of the currently active LED mode. + ### `.refreshAll()` + +> If the hardware has LEDs and LEDs are enabled, turn all LEDs off and then +> trigger the current LED mode to refresh. + ### `.setCrgbAt(uint8_t led_index, cRGB crgb)` + +> Sets the specified LED to the provided color. + ### `.setCrgbAt(KeyAddr key_addr, cRGB color)` + +> Sets the LED for the specified key to the provided color. + ### `.getCrgbAt(uint8_t led_index)` + +> Get the LED color of the specified LED. + ### `.getCrgbAt(KeyAddr key_addr)` + +> Get the LED color of the LED for the specified key. + ### `.syncLeds(void)` + + ### `.set_all_leds_to(uint8_t r, uint8_t g, uint8_t b)` + +> Set all LEDs using the provided rgb values. + ### `.set_all_leds_to(cRGB color)` + +> Set all LEDs to the specified color. + ### `.setSyncInterval(uint8_t interval)` + +> Set the interval at which the LEDs should sync, in milliseconds. +> +> Note: LED updates are considered on each cycle of the runtime. Because of +> that, the interval effectively means that _at least_ `interval` milliseconds +> has passed before LEDs are synced. + ### `.setBrightness(uint8_t brightness)` + +> Set the brightness for all LEDs. + ### `.getBrightness()` +> Returns the current brightness of the LEDs as a uint8_t. + ### `.onSetup()` + +> See [[event-handler-hooks]] + ### `.setup(void)` ### `.onKeyEvent(KeyEvent &event)` + +> See [[event-handler-hooks]] + ### `.afterEachCycle()` + +> See [[event-handler-hooks]] + ### `.update(void)` > Triggers the currently active LED mode to update. It is up to the LED mode to @@ -49,6 +103,16 @@ effects. It is also a building block for plugins that control LEDs. > address. ### `.activate(LEDModeInterface *plugin)` + + ### `.disable()` + +> Turn off all LEDs and disables updating LEDs + ### `.enable()` + +> Enables updating LEDs and calls `refreshAll()` + ### `.isEnabled()` + +> Returns a bool value reflecting whether LEDs are currently enabled. From c2732de11162ad86ca5cf4747af0aac4ccc46bca Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Wed, 13 Mar 2024 22:03:15 +0100 Subject: [PATCH 3/4] Add documentation for two more methods Signed-off-by: Evy Bongers --- plugins/Kaleidoscope-LEDControl/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/Kaleidoscope-LEDControl/README.md b/plugins/Kaleidoscope-LEDControl/README.md index 7108918352..a0f8dd95ad 100644 --- a/plugins/Kaleidoscope-LEDControl/README.md +++ b/plugins/Kaleidoscope-LEDControl/README.md @@ -21,6 +21,10 @@ effects. It is also a building block for plugins that control LEDs. ### `.get_mode()` +> Returns the current LED mode. + +### `.get_mode()` + ### `.set_mode(uint8_t mode_id)` @@ -54,6 +58,7 @@ effects. It is also a building block for plugins that control LEDs. ### `.syncLeds(void)` +> Force an update of all LEDs. ### `.set_all_leds_to(uint8_t r, uint8_t g, uint8_t b)` From 44f6d8856ba8c06107f71a7e05bf6f22b7765019 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Wed, 13 Mar 2024 22:09:06 +0100 Subject: [PATCH 4/4] Be consistent with paragraph spacing Signed-off-by: Evy Bongers --- plugins/Kaleidoscope-LEDControl/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/Kaleidoscope-LEDControl/README.md b/plugins/Kaleidoscope-LEDControl/README.md index a0f8dd95ad..aa06a4a630 100644 --- a/plugins/Kaleidoscope-LEDControl/README.md +++ b/plugins/Kaleidoscope-LEDControl/README.md @@ -89,6 +89,8 @@ effects. It is also a building block for plugins that control LEDs. > See [[event-handler-hooks]] ### `.setup(void)` + + ### `.onKeyEvent(KeyEvent &event)` > See [[event-handler-hooks]]