Skip to content

Commit

Permalink
disable RGB for BM40
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelromao committed Sep 30, 2023
1 parent 9ec89ab commit deea1cd
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 59 deletions.
116 changes: 58 additions & 58 deletions src/qmk/keyboards/kprepublic/bm40hsrgb/keymaps/rafaelromao/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,61 +169,61 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

// RGB Indicators

extern os_t os;
extern select_word_t select_word;
const int led_count = 47;

void set_rgblight_by_layer(uint32_t layer) {
for (int i = 0; i < led_count; i++) {
switch (layer) {
case _LOCK:
case _ALPHA1:
break;
case _NUMPAD:
rgb_matrix_set_color(i, RGB_PURPLE);
break;
case _SYSTEM:
rgb_matrix_set_color(i, RGB_RED);
break;
default:
rgb_matrix_set_color(i, RGB_BLUE);
break;
}
}
}

void set_current_layer_rgb(void) {
set_rgblight_by_layer(get_highest_layer(layer_state | default_layer_state));
}

layer_state_t layer_state_set_user(layer_state_t state) {
set_rgblight_by_layer(biton32(state));
return state;
}

bool rgb_matrix_indicators_user(void) {
uint8_t mods = get_mods();
uint8_t oneshot_mods = get_oneshot_mods();
uint8_t oneshot_locked_mods = get_oneshot_locked_mods();

bool isShift = mods & MOD_MASK_SHIFT || oneshot_mods & MOD_MASK_SHIFT || oneshot_locked_mods & MOD_MASK_SHIFT;
bool isCtrl = mods & MOD_MASK_CTRL || oneshot_mods & MOD_MASK_CTRL || oneshot_locked_mods & MOD_MASK_CTRL;
bool isAlt = mods & MOD_MASK_ALT || oneshot_mods & MOD_MASK_ALT || oneshot_locked_mods & MOD_MASK_ALT;
bool isGui = mods & MOD_MASK_GUI || oneshot_mods & MOD_MASK_GUI || oneshot_locked_mods & MOD_MASK_GUI;

for (int i = 0; i < led_count; i++) {
if (select_word.state != STATE_NONE) {
rgb_matrix_set_color(i, RGB_GREEN);
} else if (has_any_smart_case()) {
rgb_matrix_set_color(i, RGB_YELLOW);
} else if (isShift) {
rgb_matrix_set_color(i, RGB_BLUE);
} else if (isCtrl || isAlt || isGui) {
rgb_matrix_set_color(i, RGB_WHITE);
} else {
set_current_layer_rgb();
}
}

return false;
}
// extern os_t os;
// extern select_word_t select_word;
// const int led_count = 47;

// void set_rgblight_by_layer(uint32_t layer) {
// for (int i = 0; i < led_count; i++) {
// switch (layer) {
// case _LOCK:
// case _ALPHA1:
// break;
// case _NUMPAD:
// rgb_matrix_set_color(i, RGB_PURPLE);
// break;
// case _SYSTEM:
// rgb_matrix_set_color(i, RGB_RED);
// break;
// default:
// rgb_matrix_set_color(i, RGB_BLUE);
// break;
// }
// }
// }

// void set_current_layer_rgb(void) {
// set_rgblight_by_layer(get_highest_layer(layer_state | default_layer_state));
// }

// layer_state_t layer_state_set_user(layer_state_t state) {
// set_rgblight_by_layer(biton32(state));
// return state;
// }

// bool rgb_matrix_indicators_user(void) {
// uint8_t mods = get_mods();
// uint8_t oneshot_mods = get_oneshot_mods();
// uint8_t oneshot_locked_mods = get_oneshot_locked_mods();

// bool isShift = mods & MOD_MASK_SHIFT || oneshot_mods & MOD_MASK_SHIFT || oneshot_locked_mods & MOD_MASK_SHIFT;
// bool isCtrl = mods & MOD_MASK_CTRL || oneshot_mods & MOD_MASK_CTRL || oneshot_locked_mods & MOD_MASK_CTRL;
// bool isAlt = mods & MOD_MASK_ALT || oneshot_mods & MOD_MASK_ALT || oneshot_locked_mods & MOD_MASK_ALT;
// bool isGui = mods & MOD_MASK_GUI || oneshot_mods & MOD_MASK_GUI || oneshot_locked_mods & MOD_MASK_GUI;

// for (int i = 0; i < led_count; i++) {
// if (select_word.state != STATE_NONE) {
// rgb_matrix_set_color(i, RGB_GREEN);
// } else if (has_any_smart_case()) {
// rgb_matrix_set_color(i, RGB_YELLOW);
// } else if (isShift) {
// rgb_matrix_set_color(i, RGB_BLUE);
// } else if (isCtrl || isAlt || isGui) {
// rgb_matrix_set_color(i, RGB_WHITE);
// } else {
// set_current_layer_rgb();
// }
// }

// return false;
// }
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
DYNAMIC_MACRO_ENABLE = no
LEADER_ENABLE = no
LEADER_ENABLE = no
RGB_MATRIX_ENABLE = no

0 comments on commit deea1cd

Please sign in to comment.