mirror of
https://github.com/qmk/qmk_userspace.git
synced 2025-06-18 11:37:55 -04:00
Add user horrortroll in userspace (#19769)
This commit is contained in:
parent
4e84904c30
commit
dca2a565e8
2 changed files with 3 additions and 134 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2021 Gopolar
|
||||
/* Copyright 2023 Gopolar
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -19,11 +19,6 @@
|
|||
// OLED animation
|
||||
#include "lib/wave.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <lib/lib8tion/lib8tion.h>
|
||||
|
||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||
|
@ -31,22 +26,6 @@
|
|||
|
||||
// enum layer_names { };
|
||||
|
||||
enum user_rgb_mode {
|
||||
RGB_MODE_ALL,
|
||||
RGB_MODE_KEYLIGHT,
|
||||
RGB_MODE_UNDERGLOW,
|
||||
RGB_MODE_NONE,
|
||||
};
|
||||
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
struct {
|
||||
uint8_t rgb_mode :8;
|
||||
};
|
||||
} user_config_t;
|
||||
|
||||
user_config_t user_config;
|
||||
|
||||
// enum layer_keycodes { };
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
@ -170,94 +149,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
),
|
||||
};
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
user_config.raw = eeconfig_read_user();
|
||||
switch (user_config.rgb_mode) {
|
||||
case RGB_MODE_ALL:
|
||||
rgb_matrix_set_flags(LED_FLAG_ALL);
|
||||
rgb_matrix_enable_noeeprom();
|
||||
break;
|
||||
case RGB_MODE_KEYLIGHT:
|
||||
rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR);
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
break;
|
||||
case RGB_MODE_UNDERGLOW:
|
||||
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
break;
|
||||
case RGB_MODE_NONE:
|
||||
rgb_matrix_set_flags(LED_FLAG_NONE);
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case RGB_TOG:
|
||||
if (record->event.pressed) {
|
||||
switch (rgb_matrix_get_flags()) {
|
||||
case LED_FLAG_ALL: {
|
||||
rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR);
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
user_config.rgb_mode = RGB_MODE_KEYLIGHT;
|
||||
}
|
||||
break;
|
||||
case (LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR): {
|
||||
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
user_config.rgb_mode = RGB_MODE_UNDERGLOW;
|
||||
}
|
||||
break;
|
||||
case (LED_FLAG_UNDERGLOW): {
|
||||
rgb_matrix_set_flags(LED_FLAG_NONE);
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
user_config.rgb_mode = RGB_MODE_NONE;
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
rgb_matrix_set_flags(LED_FLAG_ALL);
|
||||
rgb_matrix_enable_noeeprom();
|
||||
user_config.rgb_mode = RGB_MODE_ALL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
eeconfig_update_user(user_config.raw);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rgb_matrix_indicators_user(void) {
|
||||
HSV hsv = rgb_matrix_config.hsv;
|
||||
uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1));
|
||||
hsv.h = time;
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
|
||||
if ((rgb_matrix_get_flags() & LED_FLAG_KEYLIGHT)) {
|
||||
if (host_keyboard_led_state().caps_lock) {
|
||||
rgb_matrix_set_color(25, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
if (host_keyboard_led_state().scroll_lock) {
|
||||
rgb_matrix_set_color(73, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
} else {
|
||||
if (host_keyboard_led_state().caps_lock) {
|
||||
rgb_matrix_set_color(25, rgb.r, rgb.g, rgb.b);
|
||||
} else {
|
||||
rgb_matrix_set_color(25, 0, 0, 0);
|
||||
}
|
||||
if (host_keyboard_led_state().scroll_lock) {
|
||||
rgb_matrix_set_color(73, rgb.r, rgb.g, rgb.b);
|
||||
} else {
|
||||
rgb_matrix_set_color(73, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef OLED_ENABLE
|
||||
static void render_layer_info(void) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright 2022 Phage Studio
|
||||
* Copyright 2022 HorrorTroll <https://github.com/HorrorTroll>
|
||||
/* Copyright 2023 Phage Studio
|
||||
* Copyright 2023 HorrorTroll <https://github.com/HorrorTroll>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -151,25 +151,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
),
|
||||
};
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case RGB_TOG:
|
||||
if (record->event.pressed) {
|
||||
switch (rgb_matrix_get_flags()) {
|
||||
case LED_FLAG_ALL: {
|
||||
rgb_matrix_set_flags(LED_FLAG_NONE);
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
rgb_matrix_set_flags(LED_FLAG_ALL);
|
||||
rgb_matrix_enable_noeeprom();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue