Skip to content

Commit c7c309c

Browse files
committed
feat: 🎸 Turn off rgb when suspend
1 parent 9ace533 commit c7c309c

5 files changed

Lines changed: 30 additions & 32 deletions

File tree

keyboards/crkbd/rev1/keymaps/maat/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "rgb_matrix.h"
3+
#include "rgb.h"
44

55
// -- To reduce memory use
66
#define LAYER_STATE_8BIT
Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,45 @@
1-
// clang-format off
21
#include "keycodes.h"
32
#include QMK_KEYBOARD_H
43
#include "raw_hid.h"
54
#include "keymap.h"
5+
#ifdef OLED_ENABLE
6+
# include "oled.c"
7+
#endif
68

79
// https://github.com/getreuer/qmk-modules/tree/main/custom_shift_keys
810
const custom_shift_key_t custom_shift_keys[] = {
9-
{KC_2, KC_COMMA},
10-
{KC_3, KC_DOT},
11-
{KC_5, KC_LABK},
12-
{KC_6, KC_RABK},
13-
{KC_7, KC_LPRN},
14-
{KC_9, KC_RPRN},
11+
{KC_2, KC_COMMA}, {KC_3, KC_DOT}, {KC_5, KC_LABK}, {KC_6, KC_RABK}, {KC_7, KC_LPRN}, {KC_9, KC_RPRN},
1512
};
1613

1714
// Notifies the host of the layer change using raw HID
1815
// https://docs.qmk.fm/features/rawhid#usage
1916
//
2017
#ifdef RAW_ENABLE
21-
layer_state_t layer_state_set_user(layer_state_t state) {
22-
uint8_t hi_layer = get_highest_layer(state);
23-
#ifdef CONSOLE_ENABLE
24-
#include "print.h"
25-
uprintf("LAYER: Selected Layer: %d\n", hi_layer);
26-
#endif
27-
uint8_t response[RAW_EPSIZE];
28-
memset(response, 0x00, RAW_EPSIZE);
29-
response[PAYLOAD_BEGIN] = PAYLOAD_MARK;
30-
response[PAYLOAD_BEGIN + 1] = hi_layer;
31-
raw_hid_send(response, RAW_EPSIZE);
32-
return state;
33-
}
18+
layer_state_t layer_state_set_user(layer_state_t state) {
19+
uint8_t hi_layer = get_highest_layer(state);
20+
# ifdef CONSOLE_ENABLE
21+
# include "print.h"
22+
uprintf("LAYER: Selected Layer: %d\n", hi_layer);
23+
# endif
24+
uint8_t response[RAW_EPSIZE];
25+
memset(response, 0x00, RAW_EPSIZE);
26+
response[PAYLOAD_BEGIN] = PAYLOAD_MARK;
27+
response[PAYLOAD_BEGIN + 1] = hi_layer;
28+
raw_hid_send(response, RAW_EPSIZE);
29+
return state;
30+
}
3431
#endif /* ifdef RAW_ENABLE */
3532

3633
// Predictive tap hold: https://github.com/jgandert/qmk_modules/tree/main/predictive_tap_hold
34+
// clang-format off
3735
const uint8_t pth_side_layout[MATRIX_ROWS][MATRIX_COLS] PROGMEM = LAYOUT_split_3x6_3(
3836
PTH_L, PTH_L, PTH_L, PTH_L, PTH_L,PTH_L, PTH_R, PTH_R, PTH_R, PTH_R, PTH_R, PTH_R,
3937
PTH_L, PTH_L, PTH_L, PTH_L, PTH_L,PTH_L, PTH_R, PTH_R, PTH_R, PTH_R, PTH_R, PTH_R,
4038
PTH_L, PTH_L, PTH_L, PTH_L, PTH_L,PTH_L, PTH_R, PTH_R, PTH_R, PTH_R, PTH_R, PTH_R,
4139
PTH_L, PTH_L, PTH_L, PTH_R, PTH_R, PTH_R
4240
);
41+
// clang-format on
4342

4443
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
45-
[L_BASE]=LAYER(LAYER_BASE),
46-
[L_MEDIA]=LAYER(LAYER_MEDIA),
47-
[L_NAV]=LAYER(LAYER_NAV),
48-
[L_NUM]=LAYER(LAYER_NUM),
49-
[L_SYM]=LAYER(LAYER_SYM),
50-
[L_FUN]=LAYER(LAYER_FUN),
44+
[L_BASE] = LAYER(LAYER_BASE), [L_MEDIA] = LAYER(LAYER_MEDIA), [L_NAV] = LAYER(LAYER_NAV), [L_NUM] = LAYER(LAYER_NUM), [L_SYM] = LAYER(LAYER_SYM), [L_FUN] = LAYER(LAYER_FUN),
5145
};
52-
53-
#ifdef OLED_ENABLE
54-
#include "oled.c"
55-
#endif

keyboards/crkbd/rev1/keymaps/maat/rgb_matrix.h renamed to keyboards/crkbd/rev1/keymaps/maat/rgb.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#pragma once
22

3+
#ifdef RGBLIGHT_ENABLE
4+
# define RGBLIGHT_SLEEP
5+
# define RGBLIGHT_SPLIT
6+
# define RGBLIGHT_DEFAULT_HUE 127
7+
#endif
8+
39
#ifdef RGB_MATRIX_ENABLE
410
# define RGB_MATRIX_KEYPRESSES // reacts to keypresses
511
// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)

keyboards/crkbd/rev1/keymaps/maat/rules.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ NKRO_ENABLE = no
1818
#To reduce memory use END
1919

2020
OLED_ENABLE = yes
21+
2122
RGBLIGHT_ENABLE = yes
2223
RGB_MATRIX_ENABLE = no
24+
RGB_DISABLE_WHEN_USB_SUSPENDED = yes
2325

2426
EXTRAKEY_ENABLE = yes # Audio control and System control
2527
AUTO_SHIFT_ENABLE = no

users/maat/keymap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ U_NP, U_NP, LT(L_MOUSE,KC_ESC),LT(L_NAV,KC_BSPC), LT(
2929

3030

3131
#define LAYER_MEDIA \
32-
UG_TOGG, KC_BRID, KC_BRIU, QK_BACKLIGHT_STEP, UG_VALU, QK_BOOT, U_NA, U_NA, U_NA, U_NA, \
32+
UG_TOGG, KC_BRID, KC_BRIU, QK_BACKLIGHT_STEP, UG_VALU, QK_BOOT, U_NA, U_NA, U_NA, KC_SLEP, \
3333
KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, UG_VALD, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, \
3434
UG_NEXT, UG_HUEU, UG_HUED, UG_SATU, UG_SATD, U_NA, U_NA, U_NA, U_NA, U_NA, \
3535
U_NP, U_NP, KC_MUTE, KC_MPLY, KC_MSTP, U_NA, U_NA, U_NA, U_NP, U_NP

0 commit comments

Comments
 (0)