aboutsummaryrefslogtreecommitdiffstats
path: root/users/xulkal
diff options
context:
space:
mode:
Diffstat (limited to 'users/xulkal')
-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
11 files changed, 310 insertions, 137 deletions
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 @@
#include "custom_encoder.h"
+#include "custom_keycodes.h"
+
+#ifdef RGB_OLED_MENU
+#include "custom_rgb.h"
+
+// I'm lazy and like constants over calculations, also using it as a compile time check
+#if defined(RGB_MATRIX_ENABLE)
+ #define RGB_FUNCTION_COUNT 6
+#elif defined(RGBLIGHT_ENABLE)
+ #define RGB_FUNCTION_COUNT 5
+#endif
+
+typedef void (*rgb_f)(void);
+
+const rgb_f rgb_functions[RGB_FUNCTION_COUNT][2] = {
+#if defined(RGB_MATRIX_ENABLE)
+ { rgb_matrix_increase_hue, rgb_matrix_decrease_hue },
+ { rgb_matrix_increase_sat, rgb_matrix_decrease_sat },
+ { rgb_matrix_increase_val, rgb_matrix_decrease_val },
+ { rgb_matrix_increase_speed, rgb_matrix_decrease_speed },
+ { rgb_matrix_step, rgb_matrix_step_reverse },
+ { rgb_matrix_increase_flags, rgb_matrix_decrease_flags }
+#elif defined(RGBLIGHT_ENABLE)
+ { rgblight_increase_hue, rgblight_decrease_hue },
+ { rgblight_increase_sat, rgblight_decrease_sat },
+ { rgblight_increase_val, rgblight_decrease_val },
+ { rgblight_increase_speed, rgblight_decrease_speed },
+ { rgblight_step, rgblight_step_reverse }
+#endif
+};
+
+// Start at the end for mode
+uint8_t rgb_encoder_state = 4;
+
+bool process_record_encoder(uint16_t keycode, keyrecord_t *record)
+{
+ switch (keycode)
+ {
+ case RGB_ENC:
+ if (record->event.pressed) {
+ if (get_mods() & MOD_MASK_SHIFT) {
+ rgb_encoder_state = (rgb_encoder_state - 1);
+ if (rgb_encoder_state >= RGB_FUNCTION_COUNT)
+ rgb_encoder_state = RGB_FUNCTION_COUNT - 1;
+ } else {
+ rgb_encoder_state = (rgb_encoder_state + 1) % RGB_FUNCTION_COUNT;
+ }
+ }
+ return false;
+ }
+ return true;
+}
+#endif // RGB_OLED_MENU
-#ifdef ENCODER_ENABLE
const uint16_t PROGMEM encoders[][2] = {
{ KC_PGUP, KC_PGDN },
- { KC_DOWN, KC_UP }
+ { KC_VOLU, KC_VOLD }
};
void encoder_update_user(uint8_t index, bool clockwise)
{
- tap_code16(pgm_read_word(&encoders[index][clockwise]));
+ if (!is_keyboard_master())
+ return;
+
+#ifdef RGB_OLED_MENU
+ if (index == RGB_OLED_MENU)
+ (*rgb_functions[rgb_encoder_state][clockwise])();
+ else
+#endif // RGB_OLED_MENU
+ tap_code16(pgm_read_word(&encoders[index][clockwise]));
}
-#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 {
TD_DOT,
TD_MAX,
#endif
+#ifdef ENCODER_ENABLE
+ RGB_ENC,
+#endif
KEYMAP_SAFE_RANGE
};
@@ -26,3 +29,12 @@ enum custom_keycodes {
#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
+
+
+#ifdef ENCODER_ENABLE
+#define KC_ENC1 RGB_ENC
+#define KC_ENC2 KC_MPLY
+#else
+#define KC_ENC1 RGB_RMOD
+#define KC_ENC2 RGB_MOD
+#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 @@
#include <stdio.h>
-#ifdef OLED_DRIVER_ENABLE
-
#ifdef RGBLIGHT_ENABLE
rgblight_config_t rgblight_config;
#endif
+#if KEYBOARD_helix_rev2
+extern uint8_t is_master;
+bool is_keyboard_master(void) { return is_master; }
+#endif
+
static void render_logo(void)
{
static const char PROGMEM font_logo[] = {
@@ -18,21 +21,38 @@ static void render_logo(void)
oled_write_P(font_logo, false);
}
-#if defined(OLED_90ROTATION)
-
-// TODO: Need to define this function / extern only for helix based split common keyboards
-extern uint8_t is_master;
-bool is_keyboard_master(void)
+static void render_icon(void)
{
- return is_master;
+#ifdef OLED_90ROTATION
+ static const char PROGMEM font_icon[] = {
+ 0x9b,0x9c,0x9d,0x9e,0x9f,
+ 0xbb,0xbc,0xbd,0xbe,0xbf,
+ 0xdb,0xdc,0xdd,0xde,0xdf,0
+ };
+#else
+ static const char PROGMEM font_icon[] = {
+ // Use \r (0x0d) to jump to the next line without clearing the rest of the current line
+ 0x9b,0x9c,0x9d,0x9e,0x9f,0x0d,
+ 0xbb,0xbc,0xbd,0xbe,0xbf,0x0d,
+ 0xdb,0xdc,0xdd,0xde,0xdf,0
+ };
+#endif
+ oled_write_P(font_icon, false);
}
-static void render_layer(uint8_t layer)
+static void render_layer(void)
{
+ uint8_t layer = layer_state ? biton(layer_state) : biton32(default_layer_state);
+#ifdef OLED_90ROTATION
+ oled_write_P(PSTR("Layer"), false);
+#else
+ oled_write_P(PSTR("Layer: "), false);
+#endif
+
switch (layer)
{
case _QWERTY:
- oled_write_P(PSTR("DFLT "), false);
+ oled_write_P(PSTR("BASE "), false);
break;
#ifndef GAMELAYER_DISABLE
case _GAME:
@@ -53,125 +73,110 @@ static void render_layer(uint8_t layer)
}
}
-static void render_status(void)
+static void render_keyboard_leds(void)
{
- // Render to mode icon
- static const char PROGMEM mode_logo[2][4] = {
- {0x97,0x98,0x0a,0},
- {0xb7,0xb8,0x0a,0} };
-
- oled_write_P(mode_logo[0], false);
- oled_write_P(mode_logo[1], false);
+ // Host Keyboard LED Status
+ uint8_t led_state = host_keyboard_leds();
+#ifdef OLED_90ROTATION
+ oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUMLK") : PSTR(" "), false);
+ oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false);
+ oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false);
+#else
+ oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUM ") : PSTR(" "), false);
+ oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPS ") : PSTR(" "), false);
+ oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRL") : PSTR(" "), false);
+#endif
+}
- oled_write_P(PSTR("Layer"), false);
- uint8_t layer = biton(layer_state);
- if (layer != _QWERTY)
- render_layer(layer);
- else
- render_layer(biton32(default_layer_state));
+#ifdef RGB_OLED_MENU
+extern uint8_t rgb_encoder_state;
+#endif
- // Host Keyboard LED Status
- uint8_t led_usb_state = host_keyboard_leds();
- oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("-----NUMLK") : PSTR("----- "), false);
- oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false);
- oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false);
+#if defined(OLED_90ROTATION)
+#ifdef RGB_ENABLE
+static void render_rgb_state(void)
+{
+ // TODO: need to do a bit more handling here for horizontal rendering
#if defined(RGB_MATRIX_ENABLE)
- oled_set_cursor(0, oled_max_lines() - 7);
- oled_write_P(PSTR("-----"), false);
+ static char buffer[31] = {0};
+ 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());
+#elif defined(RGBLIGHT_ENABLE)
static char buffer[26] = {0};
- 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);
+ 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);
+#endif
+
+#ifdef RGB_OLED_MENU
+ buffer[4 + rgb_encoder_state * 5] = '<';
+#endif
oled_write(buffer, false);
-#elif defined(RGBLIGHT_ENABLE)
- oled_set_cursor(0, oled_max_lines() - 7);
+}
+#endif
+
+static void render_status(void)
+{
+ render_icon();
+ render_layer();
+
+ // Host Keyboard LED Status
oled_write_P(PSTR("-----"), false);
- static char buffer[31] = {0};
- 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);
- oled_write(buffer, false);
+ render_keyboard_leds();
+
+ oled_write_P(PSTR("-----"), false);
+#ifdef RGB_ENABLE
+ render_rgb_state();
#endif
}
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
+#if KEYBOARD_helix_rev2
if (is_keyboard_master())
return OLED_ROTATION_270;
- return OLED_ROTATION_180;
+ return rotation;
+#else
+ if (is_keyboard_master())
+ return OLED_ROTATION_90;
+ return rotation;
+#endif
}
#else // OLED_90ROTATION
-static void render_layer(uint8_t layer)
+#ifdef RGB_ENABLE
+static void render_rgb_state(void)
{
- switch (layer)
- {
- case _QWERTY:
- oled_write_P(PSTR("Default\n"), false);
- break;
-#ifndef GAMELAYER_DISABLE
- case _GAME:
- oled_write_P(PSTR("Game\n"), false);
- break;
+ // TODO: need to do a bit more handling here for horizontal rendering
+#if defined(RGB_MATRIX_ENABLE)
+ static char buffer[37] = {0};
+ 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());
+#elif defined(RGBLIGHT_ENABLE)
+ static char buffer[32] = {0};
+ 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);
#endif
- case _LOWER:
- oled_write_P(PSTR("Lower\n"), false);
- break;
- case _RAISE:
- oled_write_P(PSTR("Raise\n"), false);
- break;
-#ifdef TRILAYER_ENABLED
- case _ADJUST:
- oled_write_P(PSTR("Adjust\n"), false);
- break;
+
+#ifdef RGB_OLED_MENU
+ buffer[4 + rgb_encoder_state * 5] = '<';
#endif
- }
+ oled_write(buffer, false);
}
+#endif
static void render_status(void)
{
- // Render to mode icon
- static const char PROGMEM mode_logo[2][3] = {
- {0x97,0x98,0},
- {0xb7,0xb8,0}
- };
+ render_icon();
- oled_write_P(mode_logo[0], false);
+ // Host Layer Status
+ oled_set_cursor(6, 0);
+ render_layer();
-#if defined(RGB_MATRIX_ENABLE)
- static char buffer[20] = {0};
- 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);
- oled_write(buffer, false);
-#elif defined(RGBLIGHT_ENABLE)
- static char buffer[20] = {0};
- snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
- oled_write(buffer, false);
-#else
- oled_write_P(PSTR("\n"));
-#endif
-
- oled_write_P(mode_logo[1], false);
+ // Host Keyboard LED Status
+ oled_set_cursor(6, 1);
+ render_keyboard_leds();
-#if defined(RGB_MATRIX_ENABLE)
- snprintf(buffer, sizeof(buffer), " s%3d m%3d\n", rgb_matrix_config.speed, rgb_matrix_config.mode);
- oled_write(buffer, false);
-#elif defined(RGBLIGHT_ENABLE)
- snprintf(buffer, sizeof(buffer), " s%3d m%3d\n", rgblight_config.speed, rgblight_config.mode);
- oled_write(buffer, false);
-#else
- oled_write_P(PSTR("\n"));
+#ifdef RGB_ENABLE
+ oled_set_cursor(6, 2);
+ render_rgb_state();
#endif
-
- // 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
- oled_write_P(PSTR("Layer: "), false);
- uint8_t layer = biton(layer_state);
- if (layer != _QWERTY)
- render_layer(layer);
- else
- render_layer(biton32(default_layer_state));
-
- // Host Keyboard LED Status
- uint8_t led_usb_state = host_keyboard_leds();
- oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
- oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
- oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false);
}
#endif // OLED_90ROTATION
@@ -186,5 +191,3 @@ void oled_task_user(void)
oled_scroll_left();
}
}
-
-#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 @@
+#include "custom_rgb.h"
+
+#ifdef RGB_MATRIX_ENABLE
+void rgb_matrix_increase_flags(void)
+{
+ switch (rgb_matrix_get_flags()) {
+ case LED_FLAG_ALL: {
+ rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER);
+ rgb_matrix_set_color_all(0, 0, 0);
+ }
+ break;
+ case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: {
+ rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
+ rgb_matrix_set_color_all(0, 0, 0);
+ }
+ break;
+ case LED_FLAG_UNDERGLOW: {
+ rgb_matrix_set_flags(LED_FLAG_NONE);
+ rgb_matrix_disable_noeeprom();
+ }
+ break;
+ default: {
+ rgb_matrix_set_flags(LED_FLAG_ALL);
+ rgb_matrix_enable_noeeprom();
+ }
+ break;
+ }
+}
+
+void rgb_matrix_decrease_flags(void)
+{
+ switch (rgb_matrix_get_flags()) {
+ case LED_FLAG_ALL: {
+ rgb_matrix_set_flags(LED_FLAG_NONE);
+ rgb_matrix_disable_noeeprom();
+ }
+ break;
+ case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: {
+ rgb_matrix_set_flags(LED_FLAG_ALL);
+ rgb_matrix_set_color_all(0, 0, 0);
+ }
+ break;
+ case LED_FLAG_UNDERGLOW: {
+ rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER);
+ rgb_matrix_set_color_all(0, 0, 0);
+ }
+ break;
+ default: {
+ rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
+ rgb_matrix_enable_noeeprom();
+ }
+ break;
+ }
+}
+#endif
+
+void rgb_reset(void) {
+#if defined(RGB_MATRIX_ENABLE)
+ eeconfig_update_rgb_matrix_default();
+#elif defined(RGBLIGHT_ENABLE)
+ eeconfig_update_rgblight_default();
+ rgblight_enable();
+#endif
+}
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 @@
+#pragma once
+
+#if defined(RGB_MATRIX_ENABLE)
+#include "rgb_matrix.h"
+#elif defined(RGBLIGHT_ENABLE)
+#include "rgblight.h"
+#endif
+
+#ifdef RGB_MATRIX_ENABLE
+void rgb_matrix_increase_flags(void);
+void rgb_matrix_decrease_flags(void);
+#endif
+
+void 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 @@
qk_tap_dance_action_t tap_dance_actions[] = {
[COMM_QUOT] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_QUOT),
[BACKSPACE] = ACTION_TAP_DANCE_DOUBLE (KC_BSPACE, LCTL(KC_BSPACE)),
- [DELETE] = ACTION_TAP_DANCE_DOUBLE (KC_DELETE, LCTL(KC_DELETE)),
- [DOT] = ACTION_TAP_DANCE_DOUBLE (KC_DOT, KC_GRAVE)
+ [DELETE] = ACTION_TAP_DANCE_DOUBLE (KC_DELETE, LCTL(KC_DELETE))
};
#else
@@ -20,18 +19,17 @@ static uint16_t td_timer;
const uint16_t PROGMEM td_keymaps[TD_MAX - TD_MIN][2] = {
[TD_COMM - TD_MIN] = { KC_COMM, KC_QUOT },
[TD_BSPC - TD_MIN] = { KC_BSPACE, LCTL(KC_BSPACE) },
- [TD_DEL - TD_MIN] = { KC_DELETE, LCTL(KC_DELETE) },
- [TD_DOT - TD_MIN] = { KC_DOT, KC_GRAVE }
+ [TD_DEL - TD_MIN] = { KC_DELETE, LCTL(KC_DELETE) }
};
-void run_tap_dance_double(uint8_t i)
+static void run_custom_tap_dance(uint8_t i)
{
tap_code16(pgm_read_word(&td_keymaps[td_keycode - TD_MIN][i]));
td_keycode = KC_TRANSPARENT;
td_timer = timer_read() + TAPPING_TERM;
}
-bool process_tap_dance_double(uint16_t keycode, keyrecord_t *record)
+bool process_custom_tap_dance(uint16_t keycode, keyrecord_t *record)
{
if (TD_MIN <= keycode && keycode < TD_MAX)
{
@@ -43,20 +41,20 @@ bool process_tap_dance_double(uint16_t keycode, keyrecord_t *record)
td_timer = timer_read() + TAPPING_TERM;
}
else
- run_tap_dance_double(1);
+ run_custom_tap_dance(1);
}
return false;
}
if (td_keycode != KC_TRANSPARENT)
- run_tap_dance_double(0);
+ run_custom_tap_dance(0);
return true;
}
void matrix_scan_user(void)
{
if (td_keycode != KC_TRANSPARENT && timer_expired(td_timer))
- run_tap_dance_double(0);
+ run_custom_tap_dance(0);
}
#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 @@
enum {
COMM_QUOT = 0,
BACKSPACE,
- DELETE,
- DOT
+ DELETE
};
#define TD_COMM TD(COMM_QUOT)
#define TD_BSPC TD(BACKSPACE)
#define TD_DEL TD(DELETE)
-#define TD_DOT TD(DOT)
#else
-void run_tap_dance_double(uint8_t i);
-bool process_tap_dance_double(uint16_t keycode, keyrecord_t *record);
+bool process_custom_tap_dance(uint16_t keycode, keyrecord_t *record);
#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 @@
#define _________________QWERTY_R1_________________ KC_6, KC_7, KC_8, KC_9, KC_0, TD_BSPC
#define _________________QWERTY_R2_________________ KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS
#define _________________QWERTY_R3_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT
-#define _________________QWERTY_R4_________________ KC_N, KC_M, TD_COMM, TD_DOT, KC_SLASH, KC_RSPC
+#define _________________QWERTY_R4_________________ KC_N, KC_M, TD_COMM, KC_DOT, KC_SLASH, KC_RSPC
#define _________________QWERTY_R5_________________ KC_SPC, KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT, KC_RCPC
@@ -86,7 +86,7 @@
#define __________________LOWER_L4_________________ _______, _______, _______, _______, _______, _______
#define __________________LOWER_L5_________________ _______, _______, _______, _______, _______, _______
-#define __________________LOWER_R1_________________ _______, _______, _______, _______, _______, KC_DEL
+#define __________________LOWER_R1_________________ _______, _______, _______, KC_SLCK, KC_NLCK, KC_DEL
#define __________________LOWER_R2_________________ _______, _______, KC_KP_7, KC_KP_8, KC_KP_9, _______
#define __________________LOWER_R3_________________ _______, _______, KC_KP_4, KC_KP_5, KC_KP_6, _______
#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 @@
#include "custom_keycodes.h"
#include "timer_utils.h"
+#ifdef RGB_ENABLE
+#include "custom_rgb.h"
+#endif
+
#ifdef TRILAYER_ENABLED
uint32_t layer_state_set_user(uint32_t state)
{
@@ -14,25 +18,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record)
static uint16_t reset_timer;
#ifndef TAP_DANCE_ENABLE
- if (!process_tap_dance_double(keycode, record))
+ if (!process_custom_tap_dance(keycode, record))
return false;
#endif
switch (keycode)
{
case RGBRST:
- {
-#if defined(RGBLIGHT_ENABLE)
- if (record->event.pressed)
- {
- eeconfig_update_rgblight_default();
- rgblight_enable();
- }
-#elif defined(RGB_MATRIX_ENABLE)
- if (record->event.pressed)
- eeconfig_update_rgb_matrix_default();
+#ifdef RGB_ENABLE
+ if (record->event.pressed)
+ rgb_reset();
#endif
- }
return false;
case RESET:
{
@@ -42,9 +38,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record)
reset_keyboard();
}
return false;
+#ifdef RGB_MATRIX_TOG_LAYERS
+ case RGB_TOG:
+ if (record->event.pressed) {
+ rgb_matrix_decrease_flags();
+ }
+ return false;
+#endif
}
- return process_record_keymap(keycode, record);
+ return process_record_encoder(keycode, record) && process_record_keymap(keycode, record);
}
__attribute__ ((weak))
@@ -52,3 +55,9 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record)
{
return true;
}
+
+__attribute__ ((weak))
+bool process_record_encoder(uint16_t keycode, keyrecord_t *record)
+{
+ return true;
+}
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 {
};
bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
+bool 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 @@
SRC += xulkal.c \
process_records.c \
custom_tap_dance.c \
- custom_encoder.c \
- custom_oled.c \
timer_utils.c
# Some usual defaults
@@ -15,3 +13,21 @@ ifneq ($(strip $(DISABLE_LTO)), yes)
OPT_DEFS += -DNO_ACTION_MACRO
OPT_DEFS += -DNO_ACTION_FUNCTION
endif
+
+ifeq ($(strip $(ENCODER_ENABLE)), yes)
+ SRC += custom_encoder.c
+endif
+
+ifneq ($(strip $(RGB_MATRIX_ENABLE)), no)
+ OPT_DEFS += -DRGB_ENABLE
+ SRC += custom_rgb.c
+endif
+
+ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
+ OPT_DEFS += -DRGB_ENABLE
+ SRC += custom_rgb.c
+endif
+
+ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
+ SRC += custom_oled.c
+endif