From d3008110096db2ac098db9b5cb47ad77582c01d9 Mon Sep 17 00:00:00 2001 From: HorrorTroll Date: Mon, 3 Apr 2023 05:24:04 +0700 Subject: Add user horrortroll in userspace (#19769) --- keyboards/gopolar/gg86/keymaps/default/keymap.c | 111 +----------------------- 1 file changed, 1 insertion(+), 110 deletions(-) (limited to 'keyboards/gopolar/gg86/keymaps/default/keymap.c') diff --git a/keyboards/gopolar/gg86/keymaps/default/keymap.c b/keyboards/gopolar/gg86/keymaps/default/keymap.c index 1d043a95d8..e192d46a80 100644 --- a/keyboards/gopolar/gg86/keymaps/default/keymap.c +++ b/keyboards/gopolar/gg86/keymaps/default/keymap.c @@ -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 -#include - -#include - // 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)) { -- cgit v1.2.3