aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXScorpion2 <rcalt2vt@gmail.com>2019-07-25 13:56:29 -0500
committerDrashna Jaelre <drashna@live.com>2019-07-25 11:56:29 -0700
commit20c0533c4c66b9d222b6ced2fad3ec6be6cad76e (patch)
tree2cceb641e573cafeb6ee68f5083fb532ab80cd93
parenta747953dfae85d3bdfdfe205fc3d4ae6f8d1fe05 (diff)
downloadqmk_firmware-20c0533c4c66b9d222b6ced2fad3ec6be6cad76e.tar.gz
qmk_firmware-20c0533c4c66b9d222b6ced2fad3ec6be6cad76e.zip
[User] Xulkal Keymaps Update (#6392)
* Xulkal changes Refactor rgb & encoder menu Hadron Keymap Refactor oled menu * Fixing horizontal OLED data display * Reverting changes to take to separate prs
-rw-r--r--keyboards/hadron/ver3/keymaps/xulkal/config.h1
-rw-r--r--keyboards/hadron/ver3/keymaps/xulkal/keymap.c73
-rw-r--r--keyboards/hadron/ver3/keymaps/xulkal/rules.mk4
-rw-r--r--keyboards/massdrop/ctrl/keymaps/default/keymap.c4
-rw-r--r--keyboards/massdrop/ctrl/keymaps/xulkal/config.h23
-rw-r--r--keyboards/massdrop/ctrl/keymaps/xulkal/keymap.c13
-rw-r--r--keyboards/rgbkb/sol/keymaps/xulkal/config.h31
-rw-r--r--keyboards/rgbkb/sol/keymaps/xulkal/keymap.c6
-rw-r--r--keyboards/rgbkb/sol/keymaps/xulkal/rules.mk10
-rw-r--r--users/xulkal/custom_encoder.c67
-rw-r--r--users/xulkal/custom_keycodes.h12
-rw-r--r--users/xulkal/custom_oled.c207
-rw-r--r--users/xulkal/custom_rgb.c64
-rw-r--r--users/xulkal/custom_rgb.h14
-rw-r--r--users/xulkal/custom_tap_dance.c16
-rw-r--r--users/xulkal/custom_tap_dance.h7
-rw-r--r--users/xulkal/layouts.h4
-rw-r--r--users/xulkal/process_records.c35
-rw-r--r--users/xulkal/process_records.h1
-rw-r--r--users/xulkal/rules.mk20
20 files changed, 457 insertions, 155 deletions
diff --git a/keyboards/hadron/ver3/keymaps/xulkal/config.h b/keyboards/hadron/ver3/keymaps/xulkal/config.h
new file mode 100644
index 000000000..6f70f09be
--- /dev/null
+++ b/keyboards/hadron/ver3/keymaps/xulkal/config.h
@@ -0,0 +1 @@
#pragma once
diff --git a/keyboards/hadron/ver3/keymaps/xulkal/keymap.c b/keyboards/hadron/ver3/keymaps/xulkal/keymap.c
new file mode 100644
index 000000000..0b7fd6f5e
--- /dev/null
+++ b/keyboards/hadron/ver3/keymaps/xulkal/keymap.c
@@ -0,0 +1,73 @@
1#include QMK_KEYBOARD_H
2#include "xulkal.h"
3
4#define EXPAND_LAYOUT(...) LAYOUT(__VA_ARGS__)
5
6const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
7 /* Qwerty Layout
8 * ,-----------------------------------------------------------------------------------.
9 * | GESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | BkSp |
10 * |------+------+------+------+------+------|------+------+------+------+------+------+--------------------.
11 * | Tab | Q | W | E | R | T | Y | U | I | O | P | \ | 7 | 8 | 9 |
12 * |------+------+------+------+------+------|------+------+------+------+------+------+------+------+------|
13 * |FN(CAPS)| A | S | D | F | G | H | J | K | L | ; | Enter| 4 | 5 | 6 |
14 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
15 * | Sft[ | Z | X | C | V | B | N | M | , | . | / | Sft] | 1 | 2 | 3 |
16 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
17 * | Ctl- | Win | LOWER| RAISE| Alt | Space| Space| Left | Up | Down | Right| Ctl= | 0 | . | = |
18 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------'
19 */
20 [_QWERTY] = EXPAND_LAYOUT( \
21 _________________QWERTY_L1_________________, _________________QWERTY_R1_________________,\
22 _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_P7, KC_P8, KC_P9, \
23 _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_P4, KC_P5, KC_P6, \
24 _________________QWERTY_L4_________________, _________________QWERTY_R4_________________, KC_P1, KC_P2, KC_P3, \
25 _________________QWERTY_L5_________________, _________________QWERTY_R5_________________, KC_P0, KC_DOT, KC_EQL \
26 ),
27
28#ifndef GAMELAYER_DISABLE
29 [_GAME] = EXPAND_LAYOUT( \
30 ___________________GAME_L1_________________, ___________________GAME_R1_________________, \
31 ___________________GAME_L2_________________, ___________________GAME_R2_________________, _______, _______, _______, \
32 ___________________GAME_L3_________________, ___________________GAME_R3_________________, _______, _______, _______, \
33 ___________________GAME_L4_________________, ___________________GAME_R4_________________, _______, _______, _______, \
34 ___________________GAME_L5_________________, ___________________GAME_R5_________________, _______, _______, _______ \
35 ),
36#endif
37
38 [_LOWER] = EXPAND_LAYOUT( \
39 __________________LOWER_L1_________________, __________________LOWER_R1_________________, \
40 __________________LOWER_L2_________________, __________________LOWER_R2_________________, _______, _______, _______, \
41 __________________LOWER_L3_________________, __________________LOWER_R3_________________, _______, _______, _______, \
42 __________________LOWER_L4_________________, __________________LOWER_R4_________________, _______, _______, _______, \
43 __________________LOWER_L5_________________, __________________LOWER_R5_________________, _______, _______, _______ \
44 ),
45
46 [_RAISE] = EXPAND_LAYOUT( \
47 __________________RAISE_L1_________________, __________________RAISE_R1_________________, \
48 __________________RAISE_L2_________________, __________________RAISE_R2_________________, _______, _______, _______, \
49 __________________RAISE_L3_________________, __________________RAISE_R3_________________, _______, _______, _______, \
50 __________________RAISE_L4_________________, __________________RAISE_R4_________________, _______, _______, _______, \
51 __________________RAISE_L5_________________, __________________RAISE_R5_________________, _______, _______, _______ \
52 ),
53
54#ifdef TRILAYER_ENABLED
55 [_ADJUST] = EXPAND_LAYOUT( \
56 _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, \
57 _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, _______, _______, _______, \
58 _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, _______, _______, _______, \
59 _________________ADJUST_L4_________________, _________________ADJUST_R4_________________, _______, _______, _______, \
60 _________________ADJUST_L5_________________, _________________ADJUST_R5_________________, _______, _______, _______ \
61 ),
62#endif
63};
64
65bool music_mask_user(uint16_t keycode) {
66 switch (keycode) {
67 case RAISE:
68 case LOWER:
69 return false;
70 default:
71 return true;
72 }
73}
diff --git a/keyboards/hadron/ver3/keymaps/xulkal/rules.mk b/keyboards/hadron/ver3/keymaps/xulkal/rules.mk
new file mode 100644
index 000000000..0305226b3
--- /dev/null
+++ b/keyboards/hadron/ver3/keymaps/xulkal/rules.mk
@@ -0,0 +1,4 @@
1# Overridden build options
2
3COMMAND_ENABLE = no
4ENCODER_ENABLER = no
diff --git a/keyboards/massdrop/ctrl/keymaps/default/keymap.c b/keyboards/massdrop/ctrl/keymaps/default/keymap.c
index 53c96d95d..39122ee49 100644
--- a/keyboards/massdrop/ctrl/keymaps/default/keymap.c
+++ b/keyboards/massdrop/ctrl/keymaps/default/keymap.c
@@ -102,11 +102,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
102 if (record->event.pressed) { 102 if (record->event.pressed) {
103 switch (rgb_matrix_get_flags()) { 103 switch (rgb_matrix_get_flags()) {
104 case LED_FLAG_ALL: { 104 case LED_FLAG_ALL: {
105 rgb_matrix_set_flags(LED_FLAG_KEYLIGHT); 105 rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER);
106 rgb_matrix_set_color_all(0, 0, 0); 106 rgb_matrix_set_color_all(0, 0, 0);
107 } 107 }
108 break; 108 break;
109 case LED_FLAG_KEYLIGHT: { 109 case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: {
110 rgb_matrix_set_flags(LED_FLAG_UNDERGLOW); 110 rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
111 rgb_matrix_set_color_all(0, 0, 0); 111 rgb_matrix_set_color_all(0, 0, 0);
112 } 112 }
diff --git a/keyboards/massdrop/ctrl/keymaps/xulkal/config.h b/keyboards/massdrop/ctrl/keymaps/xulkal/config.h
new file mode 100644
index 000000000..a078fece0
--- /dev/null
+++ b/keyboards/massdrop/ctrl/keymaps/xulkal/config.h
@@ -0,0 +1,23 @@
1/*
2This is the c configuration file for the keymap
3
4Copyright 2012 Jun Wako <wakojun@gmail.com>
5Copyright 2015 Jack Humbert
6
7This program is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#pragma once
22
23#define RGB_MATRIX_TOG_LAYERS
diff --git a/keyboards/massdrop/ctrl/keymaps/xulkal/keymap.c b/keyboards/massdrop/ctrl/keymaps/xulkal/keymap.c
index 8b45b53ec..debfa3b47 100644
--- a/keyboards/massdrop/ctrl/keymaps/xulkal/keymap.c
+++ b/keyboards/massdrop/ctrl/keymaps/xulkal/keymap.c
@@ -8,7 +8,6 @@ enum ctrl_keycodes {
8 DBG_MTRX, //DEBUG Toggle Matrix Prints 8 DBG_MTRX, //DEBUG Toggle Matrix Prints
9 DBG_KBD, //DEBUG Toggle Keyboard Prints 9 DBG_KBD, //DEBUG Toggle Keyboard Prints
10 DBG_MOU, //DEBUG Toggle Mouse Prints 10 DBG_MOU, //DEBUG Toggle Mouse Prints
11 MD_BOOT, //Restart into bootloader after hold timeout
12}; 11};
13 12
14#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode 13#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode
@@ -21,7 +20,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
21 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, TD_BSPC, KC_INS, KC_HOME, KC_PGUP, \ 20 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, TD_BSPC, KC_INS, KC_HOME, KC_PGUP, \
22 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, TD_DEL, KC_END, KC_PGDN, \ 21 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, TD_DEL, KC_END, KC_PGDN, \
23 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ 22 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \
24 KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, TD_COMM, TD_DOT, KC_SLSH, KC_RSPC, KC_UP, \ 23 KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, TD_COMM, KC_DOT, KC_SLSH, KC_RSPC, KC_UP, \
25 KC_LCPO, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LOWER, KC_APP, KC_RCPC, KC_LEFT, KC_DOWN, KC_RGHT \ 24 KC_LCPO, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LOWER, KC_APP, KC_RCPC, KC_LEFT, KC_DOWN, KC_RGHT \
26 ), 25 ),
27 26
@@ -39,7 +38,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39 [_LOWER] = LAYOUT( 38 [_LOWER] = LAYOUT(
40 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______, \ 39 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______, \
41 _______, RGB_RMOD,RGB_MOD, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU, \ 40 _______, RGB_RMOD,RGB_MOD, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU, \
42 RGB_SPI, RGB_SAI, RGB_VAI, RGB_HUI, MD_BOOT, QWERTY, _______, U_T_AUTO,U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \ 41 RGB_SPI, RGB_SAI, RGB_VAI, RGB_HUI, RESET, QWERTY, _______, U_T_AUTO,U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \
43 RGB_SPD, RGB_SAD, RGB_VAD, RGB_HUD, RGBRST, GAME, _______, _______, _______, _______, _______, _______, _______, \ 42 RGB_SPD, RGB_SAD, RGB_VAD, RGB_HUD, RGBRST, GAME, _______, _______, _______, _______, _______, _______, _______, \
44 _______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, \ 43 _______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, \
45 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ 44 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
@@ -62,8 +61,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
62 61
63bool process_record_keymap(uint16_t keycode, keyrecord_t *record) 62bool process_record_keymap(uint16_t keycode, keyrecord_t *record)
64{ 63{
65 static uint16_t reset_timer;
66
67 switch (keycode) { 64 switch (keycode) {
68 case U_T_AUTO: 65 case U_T_AUTO:
69 if (record->event.pressed && MODS_SHIFT && MODS_CTRL) 66 if (record->event.pressed && MODS_SHIFT && MODS_CTRL)
@@ -89,12 +86,6 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record)
89 if (record->event.pressed) 86 if (record->event.pressed)
90 TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); 87 TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
91 return false; 88 return false;
92 case MD_BOOT:
93 if (record->event.pressed)
94 reset_timer = timer_read() + 500;
95 else if (timer_expired(reset_timer))
96 reset_keyboard();
97 return false;
98 } 89 }
99 90
100 return true; 91 return true;
diff --git a/keyboards/rgbkb/sol/keymaps/xulkal/config.h b/keyboards/rgbkb/sol/keymaps/xulkal/config.h
new file mode 100644
index 000000000..a5c35cfae
--- /dev/null
+++ b/keyboards/rgbkb/sol/keymaps/xulkal/config.h
@@ -0,0 +1,31 @@
1/*
2This is the c configuration file for the keymap
3
4Copyright 2012 Jun Wako <wakojun@gmail.com>
5Copyright 2015 Jack Humbert
6
7This program is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#pragma once
22
23// Xulkal custom stuff
24#if KEYBOARD_rgbkb_sol_rev2
25 #define OLED_90ROTATION
26 #define RGB_MATRIX_TOG_LAYERS
27 #define RGB_MATRIX_HUE_STEP 8
28 #define RGB_MATRIX_SAT_STEP 8
29 #define RGB_MATRIX_VAL_STEP 8
30 #define RGB_MATRIX_SPD_STEP 8
31#endif
diff --git a/keyboards/rgbkb/sol/keymaps/xulkal/keymap.c b/keyboards/rgbkb/sol/keymaps/xulkal/keymap.c
index e51edd907..c508b0ca8 100644
--- a/keyboards/rgbkb/sol/keymaps/xulkal/keymap.c
+++ b/keyboards/rgbkb/sol/keymaps/xulkal/keymap.c
@@ -21,7 +21,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
21 * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------| 21 * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
22 * | Sft[ | Z | X | C | V | B | RGB | |RGBRST| N | M | , | . | / | Sft] | 22 * | Sft[ | Z | X | C | V | B | RGB | |RGBRST| N | M | , | . | / | Sft] |
23 * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------| 23 * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
24 * | Ctl- | Win | LOWER| RAISE| Alt | Space|RGBRMOD| |RGBMOD| Space| Left | Up | Down | Right| Ctl= | 24 * | Ctl- | Win | LOWER| RAISE| Alt | Space| ENC1 | | ENC2 | Space| Left | Up | Down | Right| Ctl= |
25 * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------' 25 * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------'
26 * | Space| DEL | | Enter| Space| 26 * | Space| DEL | | Enter| Space|
27 * `-------------' `-------------' 27 * `-------------' `-------------'
@@ -31,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
31 _________________QWERTY_L2_________________, KC_LBRC, KC_RBRC, _________________QWERTY_R2_________________, \ 31 _________________QWERTY_L2_________________, KC_LBRC, KC_RBRC, _________________QWERTY_R2_________________, \
32 _________________QWERTY_L3_________________, KC_GRV, KC_QUOT, _________________QWERTY_R3_________________, \ 32 _________________QWERTY_L3_________________, KC_GRV, KC_QUOT, _________________QWERTY_R3_________________, \
33 _________________QWERTY_L4_________________, RGB_TOG, RGBRST, _________________QWERTY_R4_________________, \ 33 _________________QWERTY_L4_________________, RGB_TOG, RGBRST, _________________QWERTY_R4_________________, \
34 _________________QWERTY_L5_________________, RGB_RMOD, RGB_MOD, _________________QWERTY_R5_________________, \ 34 _________________QWERTY_L5_________________, KC_ENC1, KC_ENC2, _________________QWERTY_R5_________________, \
35 KC_SPC, TD_DEL, KC_ENT, KC_SPC \ 35 KC_SPC, TD_DEL, KC_ENT, KC_SPC \
36 ), 36 ),
37 37
@@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
41 ___________________GAME_L2_________________, KC_LBRC, KC_RBRC, ___________________GAME_R2_________________, \ 41 ___________________GAME_L2_________________, KC_LBRC, KC_RBRC, ___________________GAME_R2_________________, \
42 ___________________GAME_L3_________________, KC_GRV, KC_QUOT, ___________________GAME_R3_________________, \ 42 ___________________GAME_L3_________________, KC_GRV, KC_QUOT, ___________________GAME_R3_________________, \
43 ___________________GAME_L4_________________, RGB_TOG, RGBRST, ___________________GAME_R4_________________, \ 43 ___________________GAME_L4_________________, RGB_TOG, RGBRST, ___________________GAME_R4_________________, \
44 ___________________GAME_L5_________________, RGB_RMOD, RGB_MOD, ___________________GAME_R5_________________, \ 44 ___________________GAME_L5_________________, KC_ENC1, KC_ENC2, ___________________GAME_R5_________________, \
45 KC_SPC, KC_DEL, KC_ENT, KC_SPC \ 45 KC_SPC, KC_DEL, KC_ENT, KC_SPC \
46 ), 46 ),
47#endif 47#endif
diff --git a/keyboards/rgbkb/sol/keymaps/xulkal/rules.mk b/keyboards/rgbkb/sol/keymaps/xulkal/rules.mk
index 238d1cf23..6a14a99af 100644
--- a/keyboards/rgbkb/sol/keymaps/xulkal/rules.mk
+++ b/keyboards/rgbkb/sol/keymaps/xulkal/rules.mk
@@ -10,8 +10,14 @@ FULLHAND_ENABLE = yes # Enables the additional 24 Full Hand LEDs
10# Misc 10# Misc
11OLED_DRIVER_ENABLE = yes # Enable the OLED Driver 11OLED_DRIVER_ENABLE = yes # Enable the OLED Driver
12 12
13 13# Not using the encoder for rev1
14 14ifeq ($(strip $(KEYBOARD)), rgbkb/sol/rev1)
15 ENCODER_ENABLE = no
16 RGB_OLED_MENU = no
17else
18 ENCODER_ENABLE = yes
19 RGB_OLED_MENU = 0
20endif
15 21
16# Do not edit past here 22# Do not edit past here
17 23
diff --git a/users/xulkal/custom_encoder.c b/users/xulkal/custom_encoder.c
index 076a9891a..cd029944f 100644
--- a/users/xulkal/custom_encoder.c
+++ b/users/xulkal/custom_encoder.c
@@ -1,13 +1,72 @@
1#include "custom_encoder.h" 1#include "custom_encoder.h"
2#include "custom_keycodes.h"
3
4#ifdef RGB_OLED_MENU
5#include "custom_rgb.h"
6
7// I'm lazy and like constants over calculations, also using it as a compile time check
8#if defined(RGB_MATRIX_ENABLE)
9 #define RGB_FUNCTION_COUNT 6
10#elif defined(RGBLIGHT_ENABLE)
11 #define RGB_FUNCTION_COUNT 5
12#endif
13
14typedef void (*rgb_f)(void);
15
16const rgb_f rgb_functions[RGB_FUNCTION_COUNT][2] = {
17#if defined(RGB_MATRIX_ENABLE)
18 { rgb_matrix_increase_hue, rgb_matrix_decrease_hue },
19 { rgb_matrix_increase_sat, rgb_matrix_decrease_sat },
20 { rgb_matrix_increase_val, rgb_matrix_decrease_val },
21 { rgb_matrix_increase_speed, rgb_matrix_decrease_speed },
22 { rgb_matrix_step, rgb_matrix_step_reverse },
23 { rgb_matrix_increase_flags, rgb_matrix_decrease_flags }
24#elif defined(RGBLIGHT_ENABLE)
25 { rgblight_increase_hue, rgblight_decrease_hue },
26 { rgblight_increase_sat, rgblight_decrease_sat },
27 { rgblight_increase_val, rgblight_decrease_val },
28 { rgblight_increase_speed, rgblight_decrease_speed },
29 { rgblight_step, rgblight_step_reverse }
30#endif
31};
32
33// Start at the end for mode
34uint8_t rgb_encoder_state = 4;
35
36bool process_record_encoder(uint16_t keycode, keyrecord_t *record)
37{
38 switch (keycode)
39 {
40 case RGB_ENC:
41 if (record->event.pressed) {
42 if (get_mods() & MOD_MASK_SHIFT) {
43 rgb_encoder_state = (rgb_encoder_state - 1);
44 if (rgb_encoder_state >= RGB_FUNCTION_COUNT)
45 rgb_encoder_state = RGB_FUNCTION_COUNT - 1;
46 } else {
47 rgb_encoder_state = (rgb_encoder_state + 1) % RGB_FUNCTION_COUNT;
48 }
49 }
50 return false;
51 }
52 return true;
53}
54#endif // RGB_OLED_MENU
2 55
3#ifdef ENCODER_ENABLE
4const uint16_t PROGMEM encoders[][2] = { 56const uint16_t PROGMEM encoders[][2] = {
5 { KC_PGUP, KC_PGDN }, 57 { KC_PGUP, KC_PGDN },
6 { KC_DOWN, KC_UP } 58 { KC_VOLU, KC_VOLD }
7}; 59};
8 60
9void encoder_update_user(uint8_t index, bool clockwise) 61void encoder_update_user(uint8_t index, bool clockwise)
10{ 62{
11 tap_code16(pgm_read_word(&encoders[index][clockwise])); 63 if (!is_keyboard_master())
64 return;
65
66#ifdef RGB_OLED_MENU
67 if (index == RGB_OLED_MENU)
68 (*rgb_functions[rgb_encoder_state][clockwise])();
69 else
70#endif // RGB_OLED_MENU
71 tap_code16(pgm_read_word(&encoders[index][clockwise]));
12} 72}
13#endif
diff --git a/users/xulkal/custom_keycodes.h b/users/xulkal/custom_keycodes.h
index d4ae0bd47..7ced92bf4 100644
--- a/users/xulkal/custom_keycodes.h
+++ b/users/xulkal/custom_keycodes.h
@@ -10,6 +10,9 @@ enum custom_keycodes {
10 TD_DOT, 10 TD_DOT,
11 TD_MAX, 11 TD_MAX,
12#endif 12#endif
13#ifdef ENCODER_ENABLE
14 RGB_ENC,
15#endif
13 KEYMAP_SAFE_RANGE 16 KEYMAP_SAFE_RANGE
14}; 17};
15 18
@@ -26,3 +29,12 @@ enum custom_keycodes {
26 29
27#define LOWER MO(_LOWER) 30#define LOWER MO(_LOWER)
28#define RAISE MO(_RAISE) 31#define RAISE MO(_RAISE)
32
33
34#ifdef ENCODER_ENABLE
35#define KC_ENC1 RGB_ENC
36#define KC_ENC2 KC_MPLY
37#else
38#define KC_ENC1 RGB_RMOD
39#define KC_ENC2 RGB_MOD
40#endif
diff --git a/users/xulkal/custom_oled.c b/users/xulkal/custom_oled.c
index 7280ef701..448e6ca10 100644
--- a/users/xulkal/custom_oled.c
+++ b/users/xulkal/custom_oled.c
@@ -3,12 +3,15 @@
3 3
4#include <stdio.h> 4#include <stdio.h>
5 5
6#ifdef OLED_DRIVER_ENABLE
7
8#ifdef RGBLIGHT_ENABLE 6#ifdef RGBLIGHT_ENABLE
9rgblight_config_t rgblight_config; 7rgblight_config_t rgblight_config;
10#endif 8#endif
11 9
10#if KEYBOARD_helix_rev2
11extern uint8_t is_master;
12bool is_keyboard_master(void) { return is_master; }
13#endif
14
12static void render_logo(void) 15static void render_logo(void)
13{ 16{
14 static const char PROGMEM font_logo[] = { 17 static const char PROGMEM font_logo[] = {
@@ -18,21 +21,38 @@ static void render_logo(void)
18 oled_write_P(font_logo, false); 21 oled_write_P(font_logo, false);
19} 22}
20 23
21#if defined(OLED_90ROTATION) 24static void render_icon(void)
22
23// TODO: Need to define this function / extern only for helix based split common keyboards
24extern uint8_t is_master;
25bool is_keyboard_master(void)
26{ 25{
27 return is_master; 26#ifdef OLED_90ROTATION
27 static const char PROGMEM font_icon[] = {
28 0x9b,0x9c,0x9d,0x9e,0x9f,
29 0xbb,0xbc,0xbd,0xbe,0xbf,
30 0xdb,0xdc,0xdd,0xde,0xdf,0
31 };
32#else
33 static const char PROGMEM font_icon[] = {
34 // Use \r (0x0d) to jump to the next line without clearing the rest of the current line
35 0x9b,0x9c,0x9d,0x9e,0x9f,0x0d,
36 0xbb,0xbc,0xbd,0xbe,0xbf,0x0d,
37 0xdb,0xdc,0xdd,0xde,0xdf,0
38 };
39#endif
40 oled_write_P(font_icon, false);
28} 41}
29 42
30static void render_layer(uint8_t layer) 43static void render_layer(void)
31{ 44{
45 uint8_t layer = layer_state ? biton(layer_state) : biton32(default_layer_state);
46#ifdef OLED_90ROTATION
47 oled_write_P(PSTR("Layer"), false);
48#else
49 oled_write_P(PSTR("Layer: "), false);
50#endif
51
32 switch (layer) 52 switch (layer)
33 { 53 {
34 case _QWERTY: 54 case _QWERTY:
35 oled_write_P(PSTR("DFLT "), false); 55 oled_write_P(PSTR("BASE "), false);
36 break; 56 break;
37#ifndef GAMELAYER_DISABLE 57#ifndef GAMELAYER_DISABLE
38 case _GAME: 58 case _GAME:
@@ -53,125 +73,110 @@ static void render_layer(uint8_t layer)
53 } 73 }
54} 74}
55 75
56static void render_status(void) 76static void render_keyboard_leds(void)
57{ 77{
58 // Render to mode icon 78 // Host Keyboard LED Status
59 static const char PROGMEM mode_logo[2][4] = { 79 uint8_t led_state = host_keyboard_leds();
60 {0x97,0x98,0x0a,0}, 80#ifdef OLED_90ROTATION
61 {0xb7,0xb8,0x0a,0} }; 81 oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUMLK") : PSTR(" "), false);
62 82 oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false);
63 oled_write_P(mode_logo[0], false); 83 oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false);
64 oled_write_P(mode_logo[1], false); 84#else
85 oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUM ") : PSTR(" "), false);
86 oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPS ") : PSTR(" "), false);
87 oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRL") : PSTR(" "), false);
88#endif
89}
65 90
66 oled_write_P(PSTR("Layer"), false); 91#ifdef RGB_OLED_MENU
67 uint8_t layer = biton(layer_state); 92extern uint8_t rgb_encoder_state;
68 if (layer != _QWERTY) 93#endif
69 render_layer(layer);
70 else
71 render_layer(biton32(default_layer_state));
72 94
73 // Host Keyboard LED Status 95#if defined(OLED_90ROTATION)
74 uint8_t led_usb_state = host_keyboard_leds();
75 oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("-----NUMLK") : PSTR("----- "), false);
76 oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false);
77 oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false);
78 96
97#ifdef RGB_ENABLE
98static void render_rgb_state(void)
99{
100 // TODO: need to do a bit more handling here for horizontal rendering
79#if defined(RGB_MATRIX_ENABLE) 101#if defined(RGB_MATRIX_ENABLE)
80 oled_set_cursor(0, oled_max_lines() - 7); 102 static char buffer[31] = {0};
81 oled_write_P(PSTR("-----"), false); 103 snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d e%3d ", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, rgb_matrix_config.speed, rgb_matrix_config.mode, rgb_matrix_get_flags());
104#elif defined(RGBLIGHT_ENABLE)
82 static char buffer[26] = {0}; 105 static char buffer[26] = {0};
83 snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d\n", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, rgb_matrix_config.speed, rgb_matrix_config.mode); 106 snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d ", rgblight_config.hue, rgblight_config.sat, rgblight_config.val, rgblight_config.speed, rgblight_config.mode);
107#endif
108
109#ifdef RGB_OLED_MENU
110 buffer[4 + rgb_encoder_state * 5] = '<';
111#endif
84 oled_write(buffer, false); 112 oled_write(buffer, false);
85#elif defined(RGBLIGHT_ENABLE) 113}
86 oled_set_cursor(0, oled_max_lines() - 7); 114#endif
115
116static void render_status(void)
117{
118 render_icon();
119 render_layer();
120
121 // Host Keyboard LED Status
87 oled_write_P(PSTR("-----"), false); 122 oled_write_P(PSTR("-----"), false);
88 static char buffer[31] = {0}; 123 render_keyboard_leds();
89 snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val, rgblight_config.speed, rgblight_config.mode); 124
90 oled_write(buffer, false); 125 oled_write_P(PSTR("-----"), false);
126#ifdef RGB_ENABLE
127 render_rgb_state();
91#endif 128#endif
92} 129}
93 130
94oled_rotation_t oled_init_user(oled_rotation_t rotation) { 131oled_rotation_t oled_init_user(oled_rotation_t rotation) {
132#if KEYBOARD_helix_rev2
95 if (is_keyboard_master()) 133 if (is_keyboard_master())
96 return OLED_ROTATION_270; 134 return OLED_ROTATION_270;
97 return OLED_ROTATION_180; 135 return rotation;
136#else
137 if (is_keyboard_master())
138 return OLED_ROTATION_90;
139 return rotation;
140#endif
98} 141}
99 142
100#else // OLED_90ROTATION 143#else // OLED_90ROTATION
101 144
102static void render_layer(uint8_t layer) 145#ifdef RGB_ENABLE
146static void render_rgb_state(void)
103{ 147{
104 switch (layer) 148 // TODO: need to do a bit more handling here for horizontal rendering
105 { 149#if defined(RGB_MATRIX_ENABLE)
106 case _QWERTY: 150 static char buffer[37] = {0};
107 oled_write_P(PSTR("Default\n"), false); 151 snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d e%3d ", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, rgb_matrix_config.speed, rgb_matrix_config.mode, rgb_matrix_get_flags());
108 break; 152#elif defined(RGBLIGHT_ENABLE)
109#ifndef GAMELAYER_DISABLE 153 static char buffer[32] = {0};
110 case _GAME: 154 snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d ", rgblight_config.hue, rgblight_config.sat, rgblight_config.val, rgblight_config.speed, rgblight_config.mode);
111 oled_write_P(PSTR("Game\n"), false);
112 break;
113#endif 155#endif
114 case _LOWER: 156
115 oled_write_P(PSTR("Lower\n"), false); 157#ifdef RGB_OLED_MENU
116 break; 158 buffer[4 + rgb_encoder_state * 5] = '<';
117 case _RAISE:
118 oled_write_P(PSTR("Raise\n"), false);
119 break;
120#ifdef TRILAYER_ENABLED
121 case _ADJUST:
122 oled_write_P(PSTR("Adjust\n"), false);
123 break;
124#endif 159#endif
125 } 160 oled_write(buffer, false);
126} 161}
162#endif
127 163
128static void render_status(void) 164static void render_status(void)
129{ 165{
130 // Render to mode icon 166 render_icon();
131 static const char PROGMEM mode_logo[2][3] = {
132 {0x97,0x98,0},
133 {0xb7,0xb8,0}
134 };
135 167
136 oled_write_P(mode_logo[0], false); 168 // Host Layer Status
169 oled_set_cursor(6, 0);
170 render_layer();
137 171
138#if defined(RGB_MATRIX_ENABLE) 172 // Host Keyboard LED Status
139 static char buffer[20] = {0}; 173 oled_set_cursor(6, 1);
140 snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v); 174 render_keyboard_leds();
141 oled_write(buffer, false);
142#elif defined(RGBLIGHT_ENABLE)
143 static char buffer[20] = {0};
144 snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
145 oled_write(buffer, false);
146#else
147 oled_write_P(PSTR("\n"));
148#endif
149
150 oled_write_P(mode_logo[1], false);
151 175
152#if defined(RGB_MATRIX_ENABLE) 176#ifdef RGB_ENABLE
153 snprintf(buffer, sizeof(buffer), " s%3d m%3d\n", rgb_matrix_config.speed, rgb_matrix_config.mode); 177 oled_set_cursor(6, 2);
154 oled_write(buffer, false); 178 render_rgb_state();
155#elif defined(RGBLIGHT_ENABLE)
156 snprintf(buffer, sizeof(buffer), " s%3d m%3d\n", rgblight_config.speed, rgblight_config.mode);
157 oled_write(buffer, false);
158#else
159 oled_write_P(PSTR("\n"));
160#endif 179#endif
161
162 // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
163 oled_write_P(PSTR("Layer: "), false);
164 uint8_t layer = biton(layer_state);
165 if (layer != _QWERTY)
166 render_layer(layer);
167 else
168 render_layer(biton32(default_layer_state));
169
170 // Host Keyboard LED Status
171 uint8_t led_usb_state = host_keyboard_leds();
172 oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
173 oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
174 oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false);
175} 180}
176 181
177#endif // OLED_90ROTATION 182#endif // OLED_90ROTATION
@@ -186,5 +191,3 @@ void oled_task_user(void)
186 oled_scroll_left(); 191 oled_scroll_left();
187 } 192 }
188} 193}
189
190#endif
diff --git a/users/xulkal/custom_rgb.c b/users/xulkal/custom_rgb.c
new file mode 100644
index 000000000..11bfad1d7
--- /dev/null
+++ b/users/xulkal/custom_rgb.c
@@ -0,0 +1,64 @@
1#include "custom_rgb.h"
2
3#ifdef RGB_MATRIX_ENABLE
4void rgb_matrix_increase_flags(void)
5{
6 switch (rgb_matrix_get_flags()) {
7 case LED_FLAG_ALL: {
8 rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER);
9 rgb_matrix_set_color_all(0, 0, 0);
10 }
11 break;
12 case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: {
13 rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
14 rgb_matrix_set_color_all(0, 0, 0);
15 }
16 break;
17 case LED_FLAG_UNDERGLOW: {
18 rgb_matrix_set_flags(LED_FLAG_NONE);
19 rgb_matrix_disable_noeeprom();
20 }
21 break;
22 default: {
23 rgb_matrix_set_flags(LED_FLAG_ALL);
24 rgb_matrix_enable_noeeprom();
25 }
26 break;
27 }
28}
29
30void rgb_matrix_decrease_flags(void)
31{
32 switch (rgb_matrix_get_flags()) {
33 case LED_FLAG_ALL: {
34 rgb_matrix_set_flags(LED_FLAG_NONE);
35 rgb_matrix_disable_noeeprom();
36 }
37 break;
38 case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: {
39 rgb_matrix_set_flags(LED_FLAG_ALL);
40 rgb_matrix_set_color_all(0, 0, 0);
41 }
42 break;
43 case LED_FLAG_UNDERGLOW: {
44 rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER);
45 rgb_matrix_set_color_all(0, 0, 0);
46 }
47 break;
48 default: {
49 rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
50 rgb_matrix_enable_noeeprom();
51 }
52 break;
53 }
54}
55#endif
56
57void rgb_reset(void) {
58#if defined(RGB_MATRIX_ENABLE)
59 eeconfig_update_rgb_matrix_default();
60#elif defined(RGBLIGHT_ENABLE)
61 eeconfig_update_rgblight_default();
62 rgblight_enable();
63#endif
64}
diff --git a/users/xulkal/custom_rgb.h b/users/xulkal/custom_rgb.h
new file mode 100644
index 000000000..f19dd223c
--- /dev/null
+++ b/users/xulkal/custom_rgb.h
@@ -0,0 +1,14 @@
1#pragma once
2
3#if defined(RGB_MATRIX_ENABLE)
4#include "rgb_matrix.h"
5#elif defined(RGBLIGHT_ENABLE)
6#include "rgblight.h"
7#endif
8
9#ifdef RGB_MATRIX_ENABLE
10void rgb_matrix_increase_flags(void);
11void rgb_matrix_decrease_flags(void);
12#endif
13
14void rgb_reset(void);
diff --git a/users/xulkal/custom_tap_dance.c b/users/xulkal/custom_tap_dance.c
index 7123f1be6..e0f90ea11 100644
--- a/users/xulkal/custom_tap_dance.c
+++ b/users/xulkal/custom_tap_dance.c
@@ -8,8 +8,7 @@
8qk_tap_dance_action_t tap_dance_actions[] = { 8qk_tap_dance_action_t tap_dance_actions[] = {
9 [COMM_QUOT] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_QUOT), 9 [COMM_QUOT] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_QUOT),
10 [BACKSPACE] = ACTION_TAP_DANCE_DOUBLE (KC_BSPACE, LCTL(KC_BSPACE)), 10 [BACKSPACE] = ACTION_TAP_DANCE_DOUBLE (KC_BSPACE, LCTL(KC_BSPACE)),
11 [DELETE] = ACTION_TAP_DANCE_DOUBLE (KC_DELETE, LCTL(KC_DELETE)), 11 [DELETE] = ACTION_TAP_DANCE_DOUBLE (KC_DELETE, LCTL(KC_DELETE))
12 [DOT] = ACTION_TAP_DANCE_DOUBLE (KC_DOT, KC_GRAVE)
13}; 12};
14 13
15#else 14#else
@@ -20,18 +19,17 @@ static uint16_t td_timer;
20const uint16_t PROGMEM td_keymaps[TD_MAX - TD_MIN][2] = { 19const uint16_t PROGMEM td_keymaps[TD_MAX - TD_MIN][2] = {
21 [TD_COMM - TD_MIN] = { KC_COMM, KC_QUOT }, 20 [TD_COMM - TD_MIN] = { KC_COMM, KC_QUOT },
22 [TD_BSPC - TD_MIN] = { KC_BSPACE, LCTL(KC_BSPACE) }, 21 [TD_BSPC - TD_MIN] = { KC_BSPACE, LCTL(KC_BSPACE) },
23 [TD_DEL - TD_MIN] = { KC_DELETE, LCTL(KC_DELETE) }, 22 [TD_DEL - TD_MIN] = { KC_DELETE, LCTL(KC_DELETE) }
24 [TD_DOT - TD_MIN] = { KC_DOT, KC_GRAVE }
25}; 23};
26 24
27void run_tap_dance_double(uint8_t i) 25static void run_custom_tap_dance(uint8_t i)
28{ 26{
29 tap_code16(pgm_read_word(&td_keymaps[td_keycode - TD_MIN][i])); 27 tap_code16(pgm_read_word(&td_keymaps[td_keycode - TD_MIN][i]));
30 td_keycode = KC_TRANSPARENT; 28 td_keycode = KC_TRANSPARENT;
31 td_timer = timer_read() + TAPPING_TERM; 29 td_timer = timer_read() + TAPPING_TERM;
32} 30}
33 31
34bool process_tap_dance_double(uint16_t keycode, keyrecord_t *record) 32bool process_custom_tap_dance(uint16_t keycode, keyrecord_t *record)
35{ 33{
36 if (TD_MIN <= keycode && keycode < TD_MAX) 34 if (TD_MIN <= keycode && keycode < TD_MAX)
37 { 35 {
@@ -43,20 +41,20 @@ bool process_tap_dance_double(uint16_t keycode, keyrecord_t *record)
43 td_timer = timer_read() + TAPPING_TERM; 41 td_timer = timer_read() + TAPPING_TERM;
44 } 42 }
45 else 43 else
46 run_tap_dance_double(1); 44 run_custom_tap_dance(1);
47 } 45 }
48 return false; 46 return false;
49 } 47 }
50 48
51 if (td_keycode != KC_TRANSPARENT) 49 if (td_keycode != KC_TRANSPARENT)
52 run_tap_dance_double(0); 50 run_custom_tap_dance(0);
53 return true; 51 return true;
54} 52}
55 53
56void matrix_scan_user(void) 54void matrix_scan_user(void)
57{ 55{
58 if (td_keycode != KC_TRANSPARENT && timer_expired(td_timer)) 56 if (td_keycode != KC_TRANSPARENT && timer_expired(td_timer))
59 run_tap_dance_double(0); 57 run_custom_tap_dance(0);
60} 58}
61 59
62#endif 60#endif
diff --git a/users/xulkal/custom_tap_dance.h b/users/xulkal/custom_tap_dance.h
index 33398808d..c4da9318c 100644
--- a/users/xulkal/custom_tap_dance.h
+++ b/users/xulkal/custom_tap_dance.h
@@ -9,18 +9,15 @@
9enum { 9enum {
10 COMM_QUOT = 0, 10 COMM_QUOT = 0,
11 BACKSPACE, 11 BACKSPACE,
12 DELETE, 12 DELETE
13 DOT
14}; 13};
15 14
16#define TD_COMM TD(COMM_QUOT) 15#define TD_COMM TD(COMM_QUOT)
17#define TD_BSPC TD(BACKSPACE) 16#define TD_BSPC TD(BACKSPACE)
18#define TD_DEL TD(DELETE) 17#define TD_DEL TD(DELETE)
19#define TD_DOT TD(DOT)
20 18
21#else 19#else
22 20
23void run_tap_dance_double(uint8_t i); 21bool process_custom_tap_dance(uint16_t keycode, keyrecord_t *record);
24bool process_tap_dance_double(uint16_t keycode, keyrecord_t *record);
25 22
26#endif 23#endif
diff --git a/users/xulkal/layouts.h b/users/xulkal/layouts.h
index 65dad8c63..89bdfb60d 100644
--- a/users/xulkal/layouts.h
+++ b/users/xulkal/layouts.h
@@ -23,7 +23,7 @@
23#define _________________QWERTY_R1_________________ KC_6, KC_7, KC_8, KC_9, KC_0, TD_BSPC 23#define _________________QWERTY_R1_________________ KC_6, KC_7, KC_8, KC_9, KC_0, TD_BSPC
24#define _________________QWERTY_R2_________________ KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS 24#define _________________QWERTY_R2_________________ KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS
25#define _________________QWERTY_R3_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT 25#define _________________QWERTY_R3_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT
26#define _________________QWERTY_R4_________________ KC_N, KC_M, TD_COMM, TD_DOT, KC_SLASH, KC_RSPC 26#define _________________QWERTY_R4_________________ KC_N, KC_M, TD_COMM, KC_DOT, KC_SLASH, KC_RSPC
27#define _________________QWERTY_R5_________________ KC_SPC, KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT, KC_RCPC 27#define _________________QWERTY_R5_________________ KC_SPC, KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT, KC_RCPC
28 28
29 29
@@ -86,7 +86,7 @@
86#define __________________LOWER_L4_________________ _______, _______, _______, _______, _______, _______ 86#define __________________LOWER_L4_________________ _______, _______, _______, _______, _______, _______
87#define __________________LOWER_L5_________________ _______, _______, _______, _______, _______, _______ 87#define __________________LOWER_L5_________________ _______, _______, _______, _______, _______, _______
88 88
89#define __________________LOWER_R1_________________ _______, _______, _______, _______, _______, KC_DEL 89#define __________________LOWER_R1_________________ _______, _______, _______, KC_SLCK, KC_NLCK, KC_DEL
90#define __________________LOWER_R2_________________ _______, _______, KC_KP_7, KC_KP_8, KC_KP_9, _______ 90#define __________________LOWER_R2_________________ _______, _______, KC_KP_7, KC_KP_8, KC_KP_9, _______
91#define __________________LOWER_R3_________________ _______, _______, KC_KP_4, KC_KP_5, KC_KP_6, _______ 91#define __________________LOWER_R3_________________ _______, _______, KC_KP_4, KC_KP_5, KC_KP_6, _______
92#define __________________LOWER_R4_________________ _______, _______, KC_KP_1, KC_KP_2, KC_KP_3, _______ 92#define __________________LOWER_R4_________________ _______, _______, KC_KP_1, KC_KP_2, KC_KP_3, _______
diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c
index 2c5d2a4e7..245d4955f 100644
--- a/users/xulkal/process_records.c
+++ b/users/xulkal/process_records.c
@@ -2,6 +2,10 @@
2#include "custom_keycodes.h" 2#include "custom_keycodes.h"
3#include "timer_utils.h" 3#include "timer_utils.h"
4 4
5#ifdef RGB_ENABLE
6#include "custom_rgb.h"
7#endif
8
5#ifdef TRILAYER_ENABLED 9#ifdef TRILAYER_ENABLED
6uint32_t layer_state_set_user(uint32_t state) 10uint32_t layer_state_set_user(uint32_t state)
7{ 11{
@@ -14,25 +18,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record)
14 static uint16_t reset_timer; 18 static uint16_t reset_timer;
15 19
16#ifndef TAP_DANCE_ENABLE 20#ifndef TAP_DANCE_ENABLE
17 if (!process_tap_dance_double(keycode, record)) 21 if (!process_custom_tap_dance(keycode, record))
18 return false; 22 return false;
19#endif 23#endif
20 24
21 switch (keycode) 25 switch (keycode)
22 { 26 {
23 case RGBRST: 27 case RGBRST:
24 { 28#ifdef RGB_ENABLE
25#if defined(RGBLIGHT_ENABLE) 29 if (record->event.pressed)
26 if (record->event.pressed) 30 rgb_reset();
27 {
28 eeconfig_update_rgblight_default();
29 rgblight_enable();
30 }
31#elif defined(RGB_MATRIX_ENABLE)
32 if (record->event.pressed)
33 eeconfig_update_rgb_matrix_default();
34#endif 31#endif
35 }
36 return false; 32 return false;
37 case RESET: 33 case RESET:
38 { 34 {
@@ -42,9 +38,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record)
42 reset_keyboard(); 38 reset_keyboard();
43 } 39 }
44 return false; 40 return false;
41#ifdef RGB_MATRIX_TOG_LAYERS
42 case RGB_TOG:
43 if (record->event.pressed) {
44 rgb_matrix_decrease_flags();
45 }
46 return false;
47#endif
45 } 48 }
46 49
47 return process_record_keymap(keycode, record); 50 return process_record_encoder(keycode, record) && process_record_keymap(keycode, record);
48} 51}
49 52
50__attribute__ ((weak)) 53__attribute__ ((weak))
@@ -52,3 +55,9 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record)
52{ 55{
53 return true; 56 return true;
54} 57}
58
59__attribute__ ((weak))
60bool process_record_encoder(uint16_t keycode, keyrecord_t *record)
61{
62 return true;
63}
diff --git a/users/xulkal/process_records.h b/users/xulkal/process_records.h
index 701ef7e74..c219394f8 100644
--- a/users/xulkal/process_records.h
+++ b/users/xulkal/process_records.h
@@ -15,3 +15,4 @@ enum layer_number {
15}; 15};
16 16
17bool process_record_keymap(uint16_t keycode, keyrecord_t *record); 17bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
18bool process_record_encoder(uint16_t keycode, keyrecord_t *record);
diff --git a/users/xulkal/rules.mk b/users/xulkal/rules.mk
index ab0231d7d..c3834ff5f 100644
--- a/users/xulkal/rules.mk
+++ b/users/xulkal/rules.mk
@@ -1,8 +1,6 @@
1SRC += xulkal.c \ 1SRC += xulkal.c \
2 process_records.c \ 2 process_records.c \
3 custom_tap_dance.c \ 3 custom_tap_dance.c \
4 custom_encoder.c \
5 custom_oled.c \
6 timer_utils.c 4 timer_utils.c
7 5
8# Some usual defaults 6# Some usual defaults
@@ -15,3 +13,21 @@ ifneq ($(strip $(DISABLE_LTO)), yes)
15 OPT_DEFS += -DNO_ACTION_MACRO 13 OPT_DEFS += -DNO_ACTION_MACRO
16 OPT_DEFS += -DNO_ACTION_FUNCTION 14 OPT_DEFS += -DNO_ACTION_FUNCTION
17endif 15endif
16
17ifeq ($(strip $(ENCODER_ENABLE)), yes)
18 SRC += custom_encoder.c
19endif
20
21ifneq ($(strip $(RGB_MATRIX_ENABLE)), no)
22 OPT_DEFS += -DRGB_ENABLE
23 SRC += custom_rgb.c
24endif
25
26ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
27 OPT_DEFS += -DRGB_ENABLE
28 SRC += custom_rgb.c
29endif
30
31ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
32 SRC += custom_oled.c
33endif