1 /* Copyright 2017 @TurboMech /u/TurboMech <discord> @A9entOran9e#6134
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //**!! Currently after reboot the set rgb mode does not persist after reboot. Need to find a way to "save" the rgb mode. Color remains after reboot though.
19 #include "turbomech.h"
21 #include "action_layer.h"
24 //#include "process_unicode.h"
26 extern keymap_config_t keymap_config;
27 extern rgblight_config_t rgblight_config;
28 bool RGB_INIT = false;
29 bool TOG_STATUS = false;
30 bool caps_is_active = false;
33 void matirx_scan_kb (void) {
36 RGB_current_mode = rgblight_config.mode;
39 rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
43 void persistent_default_layer_set(uint16_t default_layer) {
44 eeconfig_update_default_layer(default_layer);
45 default_layer_set(default_layer);
47 /*void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
48 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
49 rgblight_mode(RGB_current_mode);
56 __attribute__ ((weak))
57 bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
61 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
64 if (record->event.pressed) {
65 register_code(KC_CAPS);
66 caps_is_active = !caps_is_active;
70 else if (!caps_is_active) {
71 unregister_code(KC_CAPS);
72 rgblight_mode(RGB_current_mode);
79 //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
80 if (record->event.pressed) {
81 rgblight_mode(RGB_current_mode);
83 RGB_current_mode = rgblight_config.mode;
90 if (record->event.pressed) {
93 rgblight_setrgb(255, 255, 255);
100 /*case _FLIP: //(╯°□°)╯︵ ┻━┻
101 if (record->event.pressed) {
102 register_code(KC_LPRN);
103 unregister_code(KC_LPRN);
104 register_code(X(0x00B0));
105 unregister_code(X(0x00B0));
108 PROCESS_UNICODE(UC(0x00B0));
109 SEND_TAP(UC(0x25A1));
110 SEND_TAP(UC(0x00B0));
112 SEND_TAP(UC(0x256F));
113 SEND_TAP(UC(0xFE35));
114 SEND_TAP(UC(0x253B));
115 SEND_TAP(UC(0x2501));
116 SEND_TAP(UC(0x253B));
124 return process_record_keymap(keycode, record);