keyboard stuff
at master 633 lines 25 kB view raw view rendered
1# LED Matrix Lighting {#led-matrix-lighting} 2 3This feature allows you to use LED matrices driven by external drivers. It hooks into the backlight system so you can use the same keycodes as backlighting to control it. 4 5If you want to use RGB LED's you should use the [RGB Matrix Subsystem](rgb_matrix) instead. 6 7## Driver Configuration {#driver-configuration} 8 9LED Matrix is an abstraction layer on top of an underlying LED driver API. The list of supported LED drivers is below; see the respective documentation for information on how to configure the driver. 10 11|Driver |Max LEDs| 12|-------------------------------------|--------| 13|[IS31FL3218](../drivers/is31fl3218) |18 | 14|[IS31FL3236](../drivers/is31fl3236) |36 | 15|[IS31FL3729](../drivers/is31fl3729) |135 | 16|[IS31FL3731](../drivers/is31fl3731) |144 | 17|[IS31FL3733](../drivers/is31fl3733) |192 | 18|[IS31FL3736](../drivers/is31fl3736) |96 | 19|[IS31FL3737](../drivers/is31fl3737) |144 | 20|[IS31FL3741](../drivers/is31fl3741) |351 | 21|[IS31FL3742A](../drivers/is31fl3742a)|180 | 22|[IS31FL3743A](../drivers/is31fl3743a)|198 | 23|[IS31FL3745](../drivers/is31fl3745) |144 | 24|[IS31FL3746A](../drivers/is31fl3746a)|72 | 25|[SNLED27351](../drivers/snled27351) |192 | 26 27To assign the LED Matrix driver, add the following to your `rules.mk`, for example: 28 29```make 30LED_MATRIX_DRIVER = is31fl3218 31``` 32 33## Common Configuration {#common-configuration} 34 35From this point forward the configuration is the same for all the drivers. The `led_config_t` struct provides a key electrical matrix to led index lookup table, what the physical position of each LED is on the board, and what type of key or usage the LED if the LED represents. Here is a brief example: 36 37```c 38led_config_t g_led_config = { { 39 // Key Matrix to LED Index 40 { 5, NO_LED, NO_LED, 0 }, 41 { NO_LED, NO_LED, NO_LED, NO_LED }, 42 { 4, NO_LED, NO_LED, 1 }, 43 { 3, NO_LED, NO_LED, 2 } 44}, { 45 // LED Index to Physical Position 46 { 188, 16 }, { 187, 48 }, { 149, 64 }, { 112, 64 }, { 37, 48 }, { 38, 16 } 47}, { 48 // LED Index to Flag 49 1, 4, 4, 4, 4, 1 50} }; 51``` 52 53The first part, `// Key Matrix to LED Index`, tells the system what key this LED represents by using the key's electrical matrix row & col. The second part, `// LED Index to Physical Position` represents the LED's physical `{ x, y }` position on the keyboard. The default expected range of values for `{ x, y }` is the inclusive range `{ 0..224, 0..64 }`. This default expected range is due to effects that calculate the center of the keyboard for their animations. The easiest way to calculate these positions is imagine your keyboard is a grid, and the top left of the keyboard represents `{ x, y }` coordinate `{ 0, 0 }` and the bottom right of your keyboard represents `{ 224, 64 }`. Using this as a basis, you can use the following formula to calculate the physical position: 54 55```c 56x = 224 / (NUMBER_OF_COLS - 1) * COL_POSITION 57y = 64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION 58``` 59 60Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based on the physical layout of your keyboard, not the electrical layout. 61 62As mentioned earlier, the center of the keyboard by default is expected to be `{ 112, 32 }`, but this can be changed if you want to more accurately calculate the LED's physical `{ x, y }` positions. Keyboard designers can implement `#define LED_MATRIX_CENTER { 112, 32 }` in their config.h file with the new center point of the keyboard, or where they want it to be allowing more possibilities for the `{ x, y }` values. Do note that the maximum value for x or y is 255, and the recommended maximum is 224 as this gives animations runoff room before they reset. 63 64`// LED Index to Flag` is a bitmask, whether or not a certain LEDs is of a certain type. It is recommended that LEDs are set to only 1 type. 65 66## Flags {#flags} 67 68|Define |Value |Description | 69|----------------------------|------|-------------------------------------------------| 70|`HAS_FLAGS(bits, flags)` |*n/a* |Evaluates to `true` if `bits` has all `flags` set| 71|`HAS_ANY_FLAGS(bits, flags)`|*n/a* |Evaluates to `true` if `bits` has any `flags` set| 72|`LED_FLAG_NONE` |`0x00`|If this LED has no flags | 73|`LED_FLAG_ALL` |`0xFF`|If this LED has all flags | 74|`LED_FLAG_MODIFIER` |`0x01`|If the LED is on a modifier key | 75|`LED_FLAG_KEYLIGHT` |`0x04`|If the LED is for key backlight | 76|`LED_FLAG_INDICATOR` |`0x08`|If the LED is for keyboard state indication | 77 78## Keycodes {#keycodes} 79 80|Key |Aliases |Description | 81|-------------------------------|---------|-----------------------------------| 82|`QK_LED_MATRIX_ON` |`LM_ON` |Turn on LED Matrix | 83|`QK_LED_MATRIX_OFF` |`LM_OFF` |Turn off LED Matrix | 84|`QK_LED_MATRIX_TOGGLE` |`LM_TOGG`|Toggle LED Matrix on or off | 85|`QK_LED_MATRIX_MODE_NEXT` |`LM_NEXT`|Cycle through animations | 86|`QK_LED_MATRIX_MODE_PREVIOUS` |`LM_PREV`|Cycle through animations in reverse| 87|`QK_LED_MATRIX_BRIGHTNESS_UP` |`LM_BRIU`|Increase the brightness level | 88|`QK_LED_MATRIX_BRIGHTNESS_DOWN`|`LM_BRID`|Decrease the brightness level | 89|`QK_LED_MATRIX_SPEED_UP` |`LM_SPDU`|Increase the animation speed | 90|`QK_LED_MATRIX_SPEED_DOWN` |`LM_SPDD`|Decrease the animation speed | 91|`QK_LED_MATRIX_FLAG_NEXT` |`LM_FLGN`|Cycle through flags | 92|`QK_LED_MATRIX_FLAG_PREVIOUS` |`LM_FLGP`|Cycle through flags in reverse | 93 94## LED Matrix Effects {#led-matrix-effects} 95 96These are the effects that are currently available: 97 98```c 99enum led_matrix_effects { 100 LED_MATRIX_NONE = 0, 101 LED_MATRIX_SOLID = 1, // Static single val, no speed support 102 LED_MATRIX_ALPHAS_MODS, // Static dual val, speed is val for LEDs marked as modifiers 103 LED_MATRIX_BREATHING, // Cycling brightness animation 104 LED_MATRIX_BAND, // Band fading brightness scrolling left to right 105 LED_MATRIX_BAND_PINWHEEL, // 3 blade spinning pinwheel fades brightness 106 LED_MATRIX_BAND_SPIRAL, // Spinning spiral fades brightness 107 LED_MATRIX_CYCLE_LEFT_RIGHT, // Full gradient scrolling left to right 108 LED_MATRIX_CYCLE_UP_DOWN, // Full gradient scrolling top to bottom 109 LED_MATRIX_CYCLE_OUT_IN, // Full gradient scrolling out to in 110 LED_MATRIX_DUAL_BEACON, // Full gradient spinning around center of keyboard 111 LED_MATRIX_SOLID_REACTIVE_SIMPLE, // Pulses keys hit then fades out 112 LED_MATRIX_SOLID_REACTIVE_WIDE, // Value pulses near a single key hit then fades out 113 LED_MATRIX_SOLID_REACTIVE_MULTIWIDE, // Value pulses near multiple key hits then fades out 114 LED_MATRIX_SOLID_REACTIVE_CROSS, // Value pulses the same column and row of a single key hit then fades out 115 LED_MATRIX_SOLID_REACTIVE_MULTICROSS, // Value pulses the same column and row of multiple key hits then fades out 116 LED_MATRIX_SOLID_REACTIVE_NEXUS, // Value pulses away on the same column and row of a single key hit then fades out 117 LED_MATRIX_SOLID_REACTIVE_MULTINEXUS, // Value pulses away on the same column and row of multiple key hits then fades out 118 LED_MATRIX_SOLID_SPLASH, // Value pulses away from a single key hit then fades out 119 LED_MATRIX_SOLID_MULTISPLASH, // Value pulses away from multiple key hits then fades out 120 LED_MATRIX_WAVE_LEFT_RIGHT, // Sine wave scrolling from left to right 121 LED_MATRIX_WAVE_UP_DOWN, // Sine wave scrolling from up to down 122 LED_MATRIX_EFFECT_MAX 123}; 124``` 125 126You can enable a single effect by defining `ENABLE_[EFFECT_NAME]` in your `config.h`: 127 128 129|Define |Description | 130|-------------------------------------------------------|----------------------------------------------| 131|`#define ENABLE_LED_MATRIX_ALPHAS_MODS` |Enables `LED_MATRIX_ALPHAS_MODS` | 132|`#define ENABLE_LED_MATRIX_BREATHING` |Enables `LED_MATRIX_BREATHING` | 133|`#define ENABLE_LED_MATRIX_BAND` |Enables `LED_MATRIX_BAND` | 134|`#define ENABLE_LED_MATRIX_BAND_PINWHEEL` |Enables `LED_MATRIX_BAND_PINWHEEL` | 135|`#define ENABLE_LED_MATRIX_BAND_SPIRAL` |Enables `LED_MATRIX_BAND_SPIRAL` | 136|`#define ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT` |Enables `LED_MATRIX_CYCLE_LEFT_RIGHT` | 137|`#define ENABLE_LED_MATRIX_CYCLE_UP_DOWN` |Enables `LED_MATRIX_CYCLE_UP_DOWN` | 138|`#define ENABLE_LED_MATRIX_CYCLE_OUT_IN` |Enables `LED_MATRIX_CYCLE_OUT_IN` | 139|`#define ENABLE_LED_MATRIX_DUAL_BEACON` |Enables `LED_MATRIX_DUAL_BEACON` | 140|`#define ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT` |Enables `LED_MATRIX_WAVE_LEFT_RIGHT` | 141|`#define ENABLE_LED_MATRIX_WAVE_UP_DOWN` |Enables `LED_MATRIX_WAVE_UP_DOWN` | 142 143|Reactive Defines |Description | 144|-------------------------------------------------------|----------------------------------------------| 145|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE` |Enables `LED_MATRIX_SOLID_REACTIVE_SIMPLE` | 146|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE` |Enables `LED_MATRIX_SOLID_REACTIVE_WIDE` | 147|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` |Enables `LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` | 148|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS` |Enables `LED_MATRIX_SOLID_REACTIVE_CROSS` | 149|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS` |Enables `LED_MATRIX_SOLID_REACTIVE_MULTICROSS`| 150|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS` |Enables `LED_MATRIX_SOLID_REACTIVE_NEXUS` | 151|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS` |Enables `LED_MATRIX_SOLID_REACTIVE_MULTINEXUS`| 152|`#define ENABLE_LED_MATRIX_SOLID_SPLASH` |Enables `LED_MATRIX_SOLID_SPLASH` | 153|`#define ENABLE_LED_MATRIX_SOLID_MULTISPLASH` |Enables `LED_MATRIX_SOLID_MULTISPLASH` | 154 155::: tip 156These modes introduce additional logic that can increase firmware size. 157::: 158 159## Custom LED Matrix Effects {#custom-led-matrix-effects} 160 161By setting `LED_MATRIX_CUSTOM_USER = yes` in `rules.mk`, new effects can be defined directly from your keymap or userspace, without having to edit any QMK core files. To declare new effects, create a `led_matrix_user.inc` file in the user keymap directory or userspace folder. 162 163::: tip 164Hardware maintainers who want to limit custom effects to a specific keyboard can create a `led_matrix_kb.inc` file in the root of the keyboard directory, and add `LED_MATRIX_CUSTOM_KB = yes` to the keyboard level `rules.mk`. 165::: 166 167```c 168// !!! DO NOT ADD #pragma once !!! // 169 170// Step 1. 171// Declare custom effects using the LED_MATRIX_EFFECT macro 172// (note the lack of semicolon after the macro!) 173LED_MATRIX_EFFECT(my_cool_effect) 174LED_MATRIX_EFFECT(my_cool_effect2) 175 176// Step 2. 177// Define effects inside the `LED_MATRIX_CUSTOM_EFFECT_IMPLS` ifdef block 178#ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS 179 180// e.g: A simple effect, self-contained within a single method 181static bool my_cool_effect(effect_params_t* params) { 182 LED_MATRIX_USE_LIMITS(led_min, led_max); 183 for (uint8_t i = led_min; i < led_max; i++) { 184 led_matrix_set_value(i, 0xFF); 185 } 186 return led_matrix_check_finished_leds(led_max); 187} 188 189// e.g: A more complex effect, relying on external methods and state, with 190// dedicated init and run methods 191static uint8_t some_global_state; 192static void my_cool_effect2_complex_init(effect_params_t* params) { 193 some_global_state = 1; 194} 195static bool my_cool_effect2_complex_run(effect_params_t* params) { 196 LED_MATRIX_USE_LIMITS(led_min, led_max); 197 for (uint8_t i = led_min; i < led_max; i++) { 198 led_matrix_set_value(i, some_global_state++); 199 } 200 return led_matrix_check_finished_leds(led_max); 201} 202static bool my_cool_effect2(effect_params_t* params) { 203 if (params->init) my_cool_effect2_complex_init(params); 204 return my_cool_effect2_complex_run(params); 205} 206 207#endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS 208``` 209 210To switch to your custom effect programmatically, simply call `led_matrix_mode()` and prepend `LED_MATRIX_CUSTOM_` to the effect name your specified in `LED_MATRIX_EFFECT()`. For example, an effect declared as `LED_MATRIX_EFFECT(my_cool_effect)` would be referenced with: 211 212```c 213led_matrix_mode(LED_MATRIX_CUSTOM_my_cool_effect); 214``` 215 216For inspiration and examples, check out the built-in effects under `quantum/led_matrix/animations/`. 217 218 219## Naming 220 221If you wish to be able to use the name of an effect in your code -- say for a display indicator -- then you can enable the function `led_matrix_get_mode_name` in the following manner: 222 223In your keymap's `config.h`: 224```c 225#define LED_MATRIX_MODE_NAME_ENABLE 226``` 227 228In your `keymap.c` 229```c 230const char* effect_name = led_matrix_get_mode_name(led_matrix_get_mode()); 231// do something with `effect_name`, like `oled_write_ln(effect_name, false);` 232``` 233 234::: info 235`led_matrix_get_mode_name()` is not enabled by default as it increases the amount of flash memory used by the firmware based on the number of effects enabled. 236::: 237 238 239## Additional `config.h` Options {#additional-configh-options} 240 241```c 242#define LED_MATRIX_MODE_NAME_ENABLE // enables led_matrix_get_mode_name() 243#define LED_MATRIX_KEYRELEASES // reactive effects respond to keyreleases (instead of keypresses) 244#define LED_MATRIX_TIMEOUT 0 // number of milliseconds to wait until led automatically turns off 245#define LED_MATRIX_SLEEP // turn off effects when suspended 246#define LED_MATRIX_LED_PROCESS_LIMIT (LED_MATRIX_LED_COUNT + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) 247#define LED_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) 248#define LED_MATRIX_MAXIMUM_BRIGHTNESS 255 // limits maximum brightness of LEDs 249#define LED_MATRIX_DEFAULT_ON true // Sets the default enabled state, if none has been set 250#define LED_MATRIX_DEFAULT_MODE LED_MATRIX_SOLID // Sets the default mode, if none has been set 251#define LED_MATRIX_DEFAULT_VAL LED_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set 252#define LED_MATRIX_DEFAULT_SPD 127 // Sets the default animation speed, if none has been set 253#define LED_MATRIX_VAL_STEP 8 // The value by which to increment the brightness per adjustment action 254#define LED_MATRIX_SPD_STEP 16 // The value by which to increment the animation speed per adjustment action 255#define LED_MATRIX_DEFAULT_FLAGS LED_FLAG_ALL // Sets the default LED flags, if none has been set 256#define LED_MATRIX_SPLIT { X, Y } // (Optional) For split keyboards, the number of LEDs connected on each half. X = left, Y = Right. 257 // If reactive effects are enabled, you also will want to enable SPLIT_TRANSPORT_MIRROR 258#define LED_MATRIX_FLAG_STEPS { LED_FLAG_ALL, LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER, LED_FLAG_NONE } // Sets the flags which can be cycled through. 259``` 260 261## EEPROM storage {#eeprom-storage} 262 263The EEPROM for it is currently shared with the RGB Matrix system (it's generally assumed only one feature would be used at a time). 264 265## Callbacks {#callbacks} 266 267### Indicators {#indicators} 268 269If you want to set custom indicators, such as an LED for Caps Lock, or layer indication, then you can use the `led_matrix_indicators_kb` function on the keyboard level source file, or `led_matrix_indicators_user` function in the user `keymap.c`. 270```c 271bool led_matrix_indicators_kb(void) { 272 if (!led_matrix_indicators_user()) { 273 return false; 274 } 275 led_matrix_set_value(index, value); 276 return true; 277} 278``` 279 280In addition, there are the advanced indicator functions. These are aimed at those with heavily customized displays, where rendering every LED per cycle is expensive. This includes a special macro to help make this easier to use: `LED_MATRIX_INDICATOR_SET_VALUE(i, v)`. 281 282```c 283void led_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { 284 LED_MATRIX_INDICATOR_SET_VALUE(index, value); 285 return false; 286} 287``` 288 289## API {#api} 290 291### `void led_matrix_toggle(void)` {#api-led-matrix-toggle} 292 293Toggle LED Matrix on or off. 294 295--- 296 297### `void led_matrix_toggle_noeeprom(void)` {#api-led-matrix-toggle-noeeprom} 298 299Toggle LED Matrix on or off. New state is not written to EEPROM. 300 301--- 302 303### `void led_matrix_enable(void)` {#api-led-matrix-enable} 304 305Turn LED Matrix on. 306 307--- 308 309### `void led_matrix_enable_noeeprom(void)` {#api-led-matrix-enable-noeeprom} 310 311Turn LED Matrix on. New state is not written to EEPROM. 312 313--- 314 315### `void led_matrix_disable(void)` {#api-led-matrix-disable} 316 317Turn LED Matrix off. 318 319--- 320 321### `void led_matrix_disable_noeeprom(void)` {#api-led-matrix-disable-noeeprom} 322 323Turn LED Matrix off. New state is not written to EEPROM. 324 325--- 326 327### `bool led_matrix_is_enabled(void)` {#api-led-matrix-is-enabled} 328 329Get the current enabled state of LED Matrix. 330 331#### Return Value {#api-led-matrix-is-enabled-return} 332 333`true` if LED Matrix is enabled. 334 335--- 336 337### `void led_matrix_set_value(uint8_t index, uint8_t v)` {#led-matrix-set-value} 338 339Set the brightness of a single LED. 340 341This function can only be run from within an effect or indicator callback, otherwise the currently running animation will simply overwrite it on the next frame. 342 343#### Arguments {#api-led-matrix-set-value-arguments} 344 345 - `uint8_t index` 346 The LED index, from 0 to `LED_MATRIX_LED_COUNT - 1`. 347 - `uint8_t v` 348 The brightness value to set. 349 350--- 351 352### `void led_matrix_set_value_all(uint8_t v)` {#api-led-matrix-set-value-all} 353 354Set the brightness of all LEDs. 355 356This function can only be run from within an effect or indicator callback, otherwise the currently running animation will simply overwrite it on the next frame. 357 358#### Arguments {#api-led-matrix-set-value-all-arguments} 359 360 - `uint8_t v` 361 The brightness value to set. 362 363--- 364 365### `void led_matrix_mode(uint8_t mode)` {#api-led-matrix-mode} 366 367Set the currently running effect. 368 369#### Arguments {#api-led-matrix-mode-arguments} 370 371 - `uint8_t mode` 372 The effect to switch to. 373 374--- 375 376### `void led_matrix_mode_noeeprom(uint8_t mode)` {#api-led-matrix-mode-noeeprom} 377 378Set the currently running effect. New state is not written to EEPROM. 379 380#### Arguments {#api-led-matrix-mode-noeeprom-arguments} 381 382 - `uint8_t mode` 383 The effect to switch to. 384 385--- 386 387### `void led_matrix_step(void)` {#api-led-matrix-step} 388 389Move to the next enabled effect. 390 391--- 392 393### `void led_matrix_step_noeeprom(void)` {#api-led-matrix-step-noeeprom} 394 395Move to the next enabled effect. New state is not written to EEPROM. 396 397--- 398 399### `void led_matrix_step_reverse(void)` {#api-led-matrix-step-reverse} 400 401Move to the previous enabled effect. 402 403--- 404 405### `void led_matrix_step_reverse_noeeprom(void)` {#api-led-matrix-step-reverse-noeeprom} 406 407Move to the previous enabled effect. New state is not written to EEPROM. 408 409--- 410 411### `uint8_t led_matrix_get_mode(void)` {#api-led-matrix-get-mode} 412 413Get the currently running effect. 414 415#### Return Value {#api-led-matrix-get-mode-return} 416 417The index of the currently running effect. 418 419--- 420 421### `void val_matrix_increase_val(void)` {#api-led-matrix-increase-val} 422 423Increase the global effect brightness. 424 425--- 426 427### `void led_matrix_increase_val_noeeprom(void)` {#api-led-matrix-increase-val-noeeprom} 428 429Increase the global effect brightness. New state is not written to EEPROM. 430 431--- 432 433### `void led_matrix_decrease_val(void)` {#api-led-matrix-decrease-val} 434 435Decrease the global effect brightness. 436 437--- 438 439### `void led_matrix_decrease_val_noeeprom(void)` {#api-led-matrix-decrease-val-noeeprom} 440 441Decrease the global effect brightness. New state is not written to EEPROM. 442 443--- 444 445### `uint8_t led_matrix_get_val(void)` {#api-led-matrix-get-val} 446 447Get the current global effect brightness. 448 449#### Return Value {#api-led-matrix-get-val-return} 450 451The current brightness value, from 0 to 255. 452 453--- 454 455### `void led_matrix_increase_speed(void)` {#api-led-matrix-increase-speed} 456 457Increase the effect speed. 458 459--- 460 461### `void led_matrix_increase_speed_noeeprom(void)` {#api-led-matrix-increase-speed-noeeprom} 462 463Increase the effect speed. New state is not written to EEPROM. 464 465--- 466 467### `void led_matrix_decrease_speed(void)` {#api-led-matrix-decrease-speed} 468 469Decrease the effect speed. 470 471--- 472 473### `void led_matrix_decrease_speed_noeeprom(void)` {#api-led-matrix-decrease-speed-noeeprom} 474 475Decrease the effect speed. New state is not written to EEPROM. 476 477--- 478 479### `void led_matrix_set_speed(uint8_t speed)` {#api-led-matrix-set-speed} 480 481Set the effect speed. 482 483#### Arguments {#api-led-matrix-set-speed-arguments} 484 485 - `uint8_t speed` 486 The new speed to set, from 0 to 255. 487 488--- 489 490### `void led_matrix_set_speed_noeeprom(uint8_t speed)` {#api-led-matrix-set-speed-noeeprom} 491 492Set the effect speed. New state is not written to EEPROM. 493 494#### Arguments {#api-led-matrix-set-speed-noeeprom-arguments} 495 496 - `uint8_t speed` 497 The new speed to set, from 0 to 255. 498 499--- 500 501### `uint8_t led_matrix_get_speed(void)` {#api-led-matrix-get-speed} 502 503Get the current effect speed. 504 505#### Return Value {#api-led-matrix-get-speed-return} 506 507The current effect speed, from 0 to 255. 508 509--- 510 511### `void led_matrix_set_flags(led_flags_t flags)` {#api-led-matrix-set-flags} 512 513Set the global effect flags. 514 515#### Arguments {#api-led-matrix-set-flags-arguments} 516 517 - `led_flags_t flags` 518 The [flags](#flags) value to set. 519 520--- 521 522### `void led_matrix_set_flags_noeeprom(led_flags_t flags)` {#api-led-matrix-set-flags-noeeprom} 523 524Set the global effect flags. New state is not written to EEPROM. 525 526#### Arguments {#api-led-matrix-set-flags-noeeprom-arguments} 527 528 - `led_flags_t flags` 529 The [flags](#flags) value to set. 530 531--- 532 533### `void led_matrix_flags_step(void)` {#api-led-matrix-flags-step} 534 535Move to the next flag combination. 536 537--- 538 539### `void led_matrix_flags_step_noeeprom(void)` {#api-led-matrix-flags-step-noeeprom} 540 541Move to the next flag combination. New state is not written to EEPROM. 542 543--- 544 545### `void led_matrix_flags_step_reverse(void)` {#api-led-matrix-flags-step-reverse} 546 547Move to the previous flag combination. 548 549--- 550 551### `void led_matrix_flags_step_reverse_noeeprom(void)` {#api-led-matrix-flags-step-reverse-noeeprom} 552 553Move to the previous flag combination. New state is not written to EEPROM. 554 555--- 556 557### `uint8_t led_matrix_get_flags(void)` {#api-led-matrix-get-flags} 558 559Get the current global effect flags. 560 561#### Return Value {#api-led-matrix-get-flags-return} 562 563The current effect [flags](#flags). 564 565--- 566 567### `void led_matrix_reload_from_eeprom(void)` {#api-led-matrix-reload-from-eeprom} 568 569Reload the effect configuration (enabled, mode and brightness) from EEPROM. 570 571--- 572 573### `bool led_matrix_get_suspend_state(void)` {#api-led-matrix-get-suspend-state} 574 575Get the current suspend state of LED Matrix. 576 577#### Return Value {#api-led-matrix-get-suspend-state-return} 578 579`true` if LED Matrix is currently in the suspended state. 580 581--- 582 583### `bool led_matrix_indicators_kb(void)` {#api-led-matrix-indicators-kb} 584 585Keyboard-level callback, invoked after current animation frame is rendered but before it is flushed to the LEDs. 586 587#### Return Value {#api-led-matrix-indicators-kb-return} 588 589Currently unused. 590 591--- 592 593### `bool led_matrix_indicators_user(void)` {#api-led-matrix-indicators-user} 594 595Keymap-level callback, invoked after current animation frame is rendered but before it is flushed to the LEDs. 596 597#### Return Value {#api-led-matrix-indicators-user-return} 598 599`true` to continue running the keyboard-level callback. 600 601--- 602 603### `bool led_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max)` {#api-led-matrix-indicators-advanced-kb} 604 605Keyboard-level callback, invoked after current animation frame is rendered but before it is flushed to the LEDs. 606 607### Arguments {#api-led-matrix-indicators-advanced-kb-arguments} 608 609 - `uint8_t led_min` 610 The index of the first LED in this batch. 611 - `uint8_t led_max` 612 The index of the last LED in this batch. 613 614#### Return Value {#api-led-matrix-indicators-advanced-kb-return} 615 616Currently unused. 617 618--- 619 620### `bool led_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max)` {#api-led-matrix-indicators-advanced-user} 621 622Keymap-level callback, invoked after current animation frame is rendered but before it is flushed to the LEDs. 623 624### Arguments {#api-led-matrix-indicators-advanced-user-arguments} 625 626 - `uint8_t led_min` 627 The index of the first LED in this batch. 628 - `uint8_t led_max` 629 The index of the last LED in this batch. 630 631#### Return Value {#api-led-matrix-indicators-advanced-user-return} 632 633`true` to continue running the keyboard-level callback.