summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-11-26 16:45:24 -0800
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2018-11-26 16:45:24 -0800
commitecd21b44a8efd5c7241ebf48c65fc7b30134865f (patch)
tree6fd84ca4bc241d9dbbe8ea3b81a7c8341b80ecc3 /users
parentedb6c98fd23ab102069037f3dbfbd46c6067e86a (diff)
Update to drashna userspace and keymaps (#4459)
* Fix reversed bool check in layer_state_set

* Add Quefrency 65 for a friend

* Add Ergodox EZ Glow keymap

* Add RGB Matrix Code

* Further changes to rgb matrix ErgoDox EZ

* Update bjohnson keymaps

* Fix CRKBD display

* Overhaul to corne keyboard

* Narrow scope for keylogger

* Minor layout tweaks to Corne Keyboard

* additional CRKBD tweaks

* Minor tweaks to CRKBD

* Add all characters for keylogger

* Ergodox EZ Glow overhaul

* Fix Ergodox EZ Glow layer colors

* Increase Tapping Term for Corne Keyboard

* Fix unicode-ish

* Revert some changes

* Add layer specific lighting effects

* Some minor tweaks to ergodox glow config

* revert changes to ergodox files

* Update Glow readme

* Add more tapping term defines

* Fix changes

* Fix ergodox keymap

* Hopefully fix sleeping

* Disable layer indications if rgb matrix is disabled

* Add support for sleeping and rgb layer change toggle to ergodox ez glow

* Make RGB Layer Indication Great Again

* Make Unicode Great Again

* Remove placeholder define

Co-Authored-By: drashna <drashna@live.com>

* Remove placeholder define

Co-Authored-By: drashna <drashna@live.com>

* Remove old EEPROM Reset keycode
Diffstat (limited to 'users')
-rw-r--r--users/drashna/config.h4
-rw-r--r--users/drashna/drashna.c22
-rw-r--r--users/drashna/drashna.h8
-rw-r--r--users/drashna/rgb_stuff.c86
-rw-r--r--users/drashna/rgb_stuff.h2
-rw-r--r--users/drashna/rules.mk17
-rw-r--r--users/drashna/send_unicode.c54
-rw-r--r--users/drashna/template.c7
-rw-r--r--users/drashna/template.h4
9 files changed, 154 insertions, 50 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h
index 7e6a7d1c81..06cae86ab9 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -57,8 +57,10 @@
 #ifdef TAPPING_TERM
 #undef TAPPING_TERM
 #endif // TAPPING_TERM
-#ifdef KEYBOARD_ergodox_ez
+#if defined(KEYBOARD_ergodox_ez)
   #define TAPPING_TERM 185
+#elif defined(KEYBOARD_crkbd)
+  #define TAPPING_TERM 200
 #else
   #define TAPPING_TERM 175
 #endif
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 4111d29314..8f10a530e2 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -173,12 +173,15 @@ void matrix_init_user(void) {
     get_unicode_input_mode();
   #endif //UNICODE_ENABLE
   matrix_init_keymap();
-}
-
-void startup_user (void) {
   #ifdef RGBLIGHT_ENABLE
     matrix_init_rgb();
   #endif //RGBLIGHT_ENABLE
+}
+
+void startup_user (void) {
+  // #ifdef RGBLIGHT_ENABLE
+  //   matrix_init_rgb();
+  // #endif //RGBLIGHT_ENABLE
   startup_keymap();
 }
 
@@ -294,11 +297,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
     }
     break;
 
-  case EPRM: // Resets EEPROM
-    if (record->event.pressed) {
-      eeconfig_init();
-    }
-    break;
   case VRSN: // Prints firmware version
     if (record->event.pressed) {
       send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), MACRO_TIMER);
@@ -392,7 +390,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 #endif
   }
   return process_record_keymap(keycode, record) &&
-#ifdef RGBLIGHT_ENABLE
+#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
     process_record_user_rgb(keycode, record) &&
 #endif // RGBLIGHT_ENABLE
     process_record_secrets(keycode, record);
@@ -413,7 +411,11 @@ uint32_t layer_state_set_user(uint32_t state) {
 
 
 uint32_t default_layer_state_set_user(uint32_t state) {
-  return default_layer_state_set_keymap(state);
+  state = default_layer_state_set_keymap(state);
+#ifdef RGBLIGHT_ENABLE
+  state = default_layer_state_set_rgb(state);
+#endif // RGBLIGHT_ENABLE
+  return state;
 }
 
 
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index 573cb26fd0..06e726714c 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -73,6 +73,8 @@ typedef union {
   };
 } userspace_config_t;
 
+extern userspace_config_t userspace_config;
+
 #if defined(KEYMAP_SAFE_RANGE)
   #define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE
 #else
@@ -80,8 +82,7 @@ typedef union {
 #endif
 
 enum userspace_custom_keycodes {
-  EPRM = PLACEHOLDER_SAFE_RANGE, // Resets EEPROM do defaults (as in eeconfig_init)
-  VRSN,              // Prints QMK Firmware and board info
+  VRSN = PLACEHOLDER_SAFE_RANGE,              // Prints QMK Firmware and board info
   KC_QWERTY,         // Sets default layer to QWERTY
   KC_COLEMAK,        // Sets default layer to COLEMAK
   KC_DVORAK,         // Sets default layer to DVORAK
@@ -159,6 +160,9 @@ enum userspace_custom_keycodes {
 #define OS_RCTL OSM(MOD_RCTL)
 #define OS_LALT OSM(MOD_LALT)
 #define OS_RALT OSM(MOD_RALT)
+#define OS_MEH  OSM(MOD_MEH)
+#define OS_HYPR OSM(MOD_HYPR)
+
 #define ALT_APP ALT_T(KC_APP)
 
 #define MG_NKRO MAGIC_TOGGLE_NKRO
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index b6de4d39e5..d238c20651 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -2,8 +2,11 @@
 #include "rgb_stuff.h"
 #include "eeprom.h"
 
+#if defined(RGBLIGHT_ENABLE)
 extern rgblight_config_t rgblight_config;
-extern userspace_config_t userspace_config;
+#elif defined(RGB_MATRIX_ENABLE)
+extern rgb_config_t rgb_matrix_config;
+#endif
 
 #ifdef RGBLIGHT_ENABLE
 void rgblight_sethsv_default_helper(uint8_t index) {
@@ -209,7 +212,7 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
       return true; break;
 #endif // RGBLIGHT_TWINKLE
   case KC_RGB_T:  // This allows me to use underglow as layer indication, or as normal
-#ifdef RGBLIGHT_ENABLE
+#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
     if (record->event.pressed) {
       userspace_config.rgb_layer_change ^= 1;
       xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
@@ -237,24 +240,25 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
 
 
 
-void matrix_init_rgb(void) {
+ void matrix_init_rgb(void) {
 
-  if (userspace_config.rgb_layer_change) {
-    rgblight_init();
-    rgblight_enable_noeeprom();
-    switch (biton32(eeconfig_read_default_layer())) {
-      case _COLEMAK:
-        rgblight_sethsv_noeeprom_magenta(); break;
-      case _DVORAK:
-        rgblight_sethsv_noeeprom_springgreen(); break;
-      case _WORKMAN:
-        rgblight_sethsv_noeeprom_goldenrod(); break;
-      default:
-        rgblight_sethsv_noeeprom_cyan(); break;
-    }
-    rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT);
-  }
-}
+// #ifdef RGBLIGHT_ENABLE
+//   if (userspace_config.rgb_layer_change) {
+//     rgblight_enable_noeeprom();
+//     switch (biton32(eeconfig_read_default_layer())) {
+//       case _COLEMAK:
+//         rgblight_sethsv_noeeprom_magenta(); break;
+//       case _DVORAK:
+//         rgblight_sethsv_noeeprom_springgreen(); break;
+//       case _WORKMAN:
+//         rgblight_sethsv_noeeprom_goldenrod(); break;
+//       default:
+//         rgblight_sethsv_noeeprom_cyan(); break;
+//     }
+//     rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT);
+//   }
+// #endif
+ }
 
 void matrix_scan_rgb(void) {
 #ifdef RGBLIGHT_TWINKLE
@@ -270,7 +274,6 @@ void matrix_scan_rgb(void) {
 
 uint32_t layer_state_set_rgb(uint32_t state) {
 #ifdef RGBLIGHT_ENABLE
-  static bool has_ran;
   if (userspace_config.rgb_layer_change) {
     switch (biton32(state)) {
     case _MACROS:
@@ -312,12 +315,7 @@ uint32_t layer_state_set_rgb(uint32_t state) {
         default:
           rgblight_sethsv_noeeprom_cyan(); break;
       }
-      if (has_ran) {
-        biton32(state) == _MODS ? rgblight_mode(RGBLIGHT_MODE_BREATHING) : rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it
-      } else {
-        biton32(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it
-        has_ran = true;
-      }
+      biton32(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it
       break;
     }
 //    layer_state_set_indicator(); // Runs every scan, so need to call this here .... since I can't get it working "right" anyhow
@@ -326,3 +324,39 @@ uint32_t layer_state_set_rgb(uint32_t state) {
 
   return state;
 }
+
+uint32_t default_layer_state_set_rgb(uint32_t state) {
+#ifdef RGBLIGHT_ENABLE
+  if (userspace_config.rgb_layer_change) {
+    rgblight_config_t temp_rgblight_config = rgblight_config;
+    switch (biton32(state)) {
+      case _COLEMAK:
+        temp_rgblight_config.hue = 300;
+        temp_rgblight_config.val = 255;
+        temp_rgblight_config.sat = 255;
+        temp_rgblight_config.mode = 1;
+        break;
+      case _DVORAK:
+        temp_rgblight_config.hue = 150;
+        temp_rgblight_config.val = 255;
+        temp_rgblight_config.sat = 255;
+        temp_rgblight_config.mode = 1;
+      case _WORKMAN:
+        temp_rgblight_config.hue = 43;
+        temp_rgblight_config.val = 218;
+        temp_rgblight_config.sat = 218;
+        temp_rgblight_config.mode = 1;
+      default:
+        temp_rgblight_config.hue = 180;
+        temp_rgblight_config.val = 255;
+        temp_rgblight_config.sat = 255;
+        temp_rgblight_config.mode = 1;
+    }
+    if (temp_rgblight_config.raw != eeconfig_read_rgblight()) {
+      xprintf("rgblight set default layer hsv [EEPROM]: %u,%u,%u,%u\n", temp_rgblight_config.hue, temp_rgblight_config.sat, temp_rgblight_config.val, temp_rgblight_config.mode);
+      eeconfig_update_rgblight(temp_rgblight_config.raw);
+    }
+  }
+#endif // RGBLIGHT_ENABLE
+  return state;
+}
diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h
index 50c75c8c3c..3db068a31d 100644
--- a/users/drashna/rgb_stuff.h
+++ b/users/drashna/rgb_stuff.h
@@ -12,4 +12,4 @@ void scan_rgblight_fadeout(void);
 void matrix_init_rgb(void);
 void matrix_scan_rgb(void);
 uint32_t layer_state_set_rgb(uint32_t state);
-
+uint32_t default_layer_state_set_rgb(uint32_t state);
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index 964c96c522..49b1ddae97 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -27,6 +27,11 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
   endif
 endif
 
+ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
+  SRC += rgb_stuff.c
+endif
+
+
 ifeq ($(strip $(MACROS_ENABLED)), yes)
     OPT_DEFS += -DMACROS_ENABLED
 endif
@@ -37,3 +42,15 @@ ifdef CONSOLE_ENABLE
   endif
 endif
 
+
+ifeq ($(strip $(UCIS_ENABLE)), yes)
+  SRC += send_unicode.c
+endif
+
+ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
+  SRC += send_unicode.c
+endif
+
+ifeq ($(strip $(UNICODE_ENABLE)), yes)
+  SRC += send_unicode.c
+endif
diff --git a/users/drashna/send_unicode.c b/users/drashna/send_unicode.c
index cacfe1dc85..ff35368da7 100644
--- a/users/drashna/send_unicode.c
+++ b/users/drashna/send_unicode.c
@@ -56,3 +56,57 @@ void send_unicode_hex_string(const char* str) {
 
 
 // If you need a good converter: https://r12a.github.io/app-conversion/
+uint8_t saved_mods;
+
+void unicode_input_start (void) {
+  // save current mods
+  saved_mods = get_mods(); // Save current mods
+  clear_mods(); // Unregister mods to start from a clean state
+
+  switch(get_unicode_input_mode()) {
+  case UC_OSX:
+    register_code(KC_LALT);
+    break;
+  case UC_OSX_RALT:
+    register_code(KC_RALT);
+    break;
+  case UC_LNX:
+    register_code(KC_LCTL);
+    register_code(KC_LSFT);
+    register_code(KC_U);
+    unregister_code(KC_U);
+    unregister_code(KC_LSFT);
+    unregister_code(KC_LCTL);
+    break;
+  case UC_WIN:
+    register_code(KC_LALT);
+    register_code(KC_PPLS);
+    unregister_code(KC_PPLS);
+    break;
+  case UC_WINC:
+    register_code(KC_RALT);
+    unregister_code(KC_RALT);
+    register_code(KC_U);
+    unregister_code(KC_U);
+    break;
+  }
+  wait_ms(UNICODE_TYPE_DELAY);
+}
+
+void unicode_input_finish (void) {
+  switch(get_unicode_input_mode()) {
+    case UC_OSX:
+    case UC_WIN:
+      unregister_code(KC_LALT);
+      break;
+    case UC_OSX_RALT:
+      unregister_code(KC_RALT);
+      break;
+    case UC_LNX:
+      register_code(KC_SPC);
+      unregister_code(KC_SPC);
+      break;
+  }
+
+  set_mods(saved_mods); // Reregister previously set mods
+}
diff --git a/users/drashna/template.c b/users/drashna/template.c
index e6b50c961b..0e188f3a5e 100644
--- a/users/drashna/template.c
+++ b/users/drashna/template.c
@@ -50,12 +50,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
     return false;
     break;
 
-  case EPRM:
-    if (record->event.pressed) {
-      eeconfig_init();
-    }
-    return false;
-    break;
   case VRSN:
     if (record->event.pressed) {
       SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
@@ -128,4 +122,3 @@ void shutdown_keymap(void) {}
 void shutdown_user (void) {
   shutdown_keymap();
 }
-
diff --git a/users/drashna/template.h b/users/drashna/template.h
index 5b3a93de5f..dd1c487604 100644
--- a/users/drashna/template.h
+++ b/users/drashna/template.h
@@ -9,9 +9,7 @@
 #define BASE 0
 
 enum custom_keycodes {
-  PLACEHOLDER = SAFE_RANGE, // can always be here
-  EPRM,
-  VRSN,
+  VRSN = SAFE_RANGE, // can always be here
   KC_MAKE,
   KC_RESET,
   NEWPLACEHOLDER  //use "NEWPLACEHOLDER for keymap specific codes