Skip to content

Instantly share code, notes, and snippets.

@Fuhrmann
Forked from reywood/keymap.c
Created September 14, 2020 01:03
Show Gist options
  • Save Fuhrmann/3b0d1092ffb999e8bf36aaf71c060ef5 to your computer and use it in GitHub Desktop.
Save Fuhrmann/3b0d1092ffb999e8bf36aaf71c060ef5 to your computer and use it in GitHub Desktop.
Using only a subset of RGB matrix effects
#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