diff options
author | jonylee@hfd <108282809+jonylee1986@users.noreply.github.com> | 2023-06-20 10:31:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-19 19:31:46 -0700 |
commit | d98b60c8f607c9d3d40b187ab9ea47e4fa6df2ef (patch) | |
tree | f58367965c491f0daf4113c27c5eb18f3d93ff5c /keyboards/inland/kb83/rgb_matrix_kb.inc | |
parent | 808228c1a89cda24ca9e9c4d6516b7964bf00e85 (diff) |
Move kb83 keyboard (#20761)
* move hfdkb/keyboard_sw/k83 --> inland/kb83
* move hfdkb/keyboard_sw/k83 --> inland/kb83
* Update data/mappings/keyboard_aliases.hjson
* Update keyboard_aliases.hjson
* fixed the Configurator layout data
* fixed the Configurator layout data
* Revert "Update keyboard_aliases.hjson"
This reverts commit c085c547656d09a14b9b0fad6a00f9551106719f.
* Revert "fixed the Configurator layout data"
* Update keyboard_aliases.hjson
* Update info.json
Diffstat (limited to 'keyboards/inland/kb83/rgb_matrix_kb.inc')
-rw-r--r-- | keyboards/inland/kb83/rgb_matrix_kb.inc | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/keyboards/inland/kb83/rgb_matrix_kb.inc b/keyboards/inland/kb83/rgb_matrix_kb.inc new file mode 100644 index 0000000000..56e2bd31cb --- /dev/null +++ b/keyboards/inland/kb83/rgb_matrix_kb.inc @@ -0,0 +1,51 @@ +// !!! DO NOT ADD #pragma once !!! // + +// Step 1. +// Declare custom effects using the RGB_MATRIX_EFFECT macro +// (note the lack of semicolon after the macro!) + +RGB_MATRIX_EFFECT(turn_off_rgb) +RGB_MATRIX_EFFECT(kb_reset_rgb) + +// Step 2. +// Define effects inside the `RGB_MATRIX_CUSTOM_EFFECT_IMPLS` ifdef block + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +// e.g: A simple effect, self-contained within a single method +static bool turn_off_rgb(effect_params_t *params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return rgb_matrix_check_finished_leds(led_max); +} + +// e.g: A more complex effect, relying on external methods and state, with +// dedicated init and run methods +static uint8_t some_global_state; +static void kb_reset_rgb_init(effect_params_t* params) { + some_global_state = 0; +} +static bool kb_reset_rgb_run(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + some_global_state++; + if(some_global_state&0x01){ + for (uint8_t i = led_min; i < led_max; i++) + rgb_matrix_set_color(i, 0, 0, 0); + } + else{ + for (uint8_t i = led_min; i < led_max; i++) + rgb_matrix_set_color(i, 0xc0, 0xc0, 0xc0); + } + if(some_global_state>=7) + rgb_matrix_init(); + return rgb_matrix_check_finished_leds(led_max); +} + +static bool kb_reset_rgb(effect_params_t* params) { + if (params->init) kb_reset_rgb_init(params); + return kb_reset_rgb_run(params); +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |