Last active
September 14, 2020 01:03
-
-
Save reywood/867334be795d7b845f32063ea359a004 to your computer and use it in GitHub Desktop.
Using only a subset of RGB matrix effects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include QMK_KEYBOARD_H | |
uint8_t rgb_matrix_effects[] = { | |
RGB_MATRIX_NONE, | |
RGB_MATRIX_SOLID_COLOR, | |
RGB_MATRIX_BAND_VAL, | |
RGB_MATRIX_JELLYBEAN_RAINDROPS | |
}; | |
uint8_t current_rgb_matrix_effect_index = 0; | |
enum custom_keycodes { | |
RGB_NXT = SAFE_RANGE | |
}; | |
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |
// Assign RGB_NXT to one of the keys in your keymap | |
}; | |
void matrix_init_user(void) { | |
rgb_matrix_mode(rgb_matrix_effects[current_rgb_matrix_effect_index]); | |
} | |
void increment_current_rgb_matrix_effect_index() { | |
current_rgb_matrix_effect_index++; | |
uint8_t effect_count = sizeof(rgb_matrix_effects) / sizeof(uint8_t); | |
if (current_rgb_matrix_effect_index >= effect_count) { | |
current_rgb_matrix_effect_index = 0; | |
} | |
} | |
bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |
if (record->event.pressed) { | |
switch (keycode) { | |
case RGB_NXT: | |
increment_current_rgb_matrix_effect_index(); | |
rgb_matrix_mode(rgb_matrix_effects[current_rgb_matrix_effect_index]); | |
return false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment