]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - users/drashna/drashna.c
Keymap: Update to drashna keymaps and userspace (#3992)
[qmk_firmware.git] / users / drashna / drashna.c
index 9489fb456776db2fe6b7a959c71c52991dae09e7..aad9fab611bcdd2bcddd8ace59816a4bf87f93cc 100644 (file)
@@ -21,6 +21,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 userspace_config_t userspace_config;
 
+uint16_t copy_paste_timer;
 //  Helper Functions
 
 
@@ -131,7 +132,7 @@ void led_set_keymap(uint8_t usb_led) {}
 // Call user matrix init, set default RGB colors and then
 // call the keymap's init function
 void matrix_init_user(void) {
-  userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE);
+  userspace_config.raw = eeprom_read_dword(EECONFIG_USERSPACE);
 
 
 #ifdef BOOTLOADER_CATERINA
@@ -143,7 +144,9 @@ void matrix_init_user(void) {
 #endif
 
 #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
-       set_unicode_input_mode(UC_WINC);
+  if (eeprom_read_byte(EECONFIG_UNICODEMODE) != UC_WIN) {
+    set_unicode_input_mode(UC_WIN);
+  }
 #endif //UNICODE_ENABLE
   matrix_init_keymap();
 }
@@ -173,17 +176,12 @@ void shutdown_user (void) {
   shutdown_keymap();
 }
 
-void suspend_power_down_user(void)
-{
+void suspend_power_down_user(void) {
     suspend_power_down_keymap();
 }
 
-void suspend_wakeup_init_user(void)
-{
+void suspend_wakeup_init_user(void) {
   suspend_wakeup_init_keymap();
-  #ifdef KEYBOARD_ergodox_ez
-  wait_ms(10);
-  #endif
 }
 
 
@@ -216,7 +214,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 
   // If console is enabled, it will print the matrix position and status of each key pressed
 #ifdef KEYLOGGER_ENABLE
-  xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed);
+  #if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_iris_rev2)
+    xprintf("KL: col: %u, row: %u, pressed: %u\n", record->event.key.row, record->event.key.col, record->event.pressed);
+  #else
+    xprintf("KL: col: %u, row: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed);
+  #endif
 #endif //KEYLOGGER_ENABLE
 
   switch (keycode) {
@@ -249,7 +251,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
   case KC_MAKE:  // Compiles the firmware, and adds the flash command based on keyboard bootloader
     if (!record->event.pressed) {
       send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP
-#if  (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
+#if defined(__ARM__)
+                   ":dfu-util"
+#elif defined(BOOTLOADER_DFU)
                    ":dfu"
 #elif defined(BOOTLOADER_HALFKAY)
                    ":teensy"
@@ -291,7 +295,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 // to save on firmware space, since it's limited.
 #ifdef MACROS_ENABLED
   case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros
-    if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); }
+    if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeprom_update_dword(EECONFIG_USERSPACE, userspace_config.raw); }
 #ifdef RGBLIGHT_ENABLE
     userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18);
 #endif //RGBLIGHT_ENABLE
@@ -342,45 +346,40 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
         register_code(KC_LCTL);
         tap(KC_C);
         unregister_code(KC_LCTL);
-#ifdef AUDIO_ENABLE
-        PLAY_SONG(tone_copy);
-#endif
       } else {                                // Tap, paste
         register_code(KC_LCTL);
         tap(KC_V);
         unregister_code(KC_LCTL);
-#ifdef AUDIO_ENABLE
-        PLAY_SONG(tone_paste);
-#endif
       }
     }
     return false;
     break;
 #ifdef UNICODE_ENABLE
-  case UC_FLIP: // (╯°□°)╯ ︵ ┻━┻
+  case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻
     if (record->event.pressed) {
-      register_code(KC_RSFT);
-      tap(KC_9);
-      unregister_code(KC_RSFT);
-      process_unicode((0x256F | QK_UNICODE), record); // Arm
-      process_unicode((0x00B0 | QK_UNICODE), record); // Eye
-      process_unicode((0x25A1 | QK_UNICODE), record); // Mouth
-      process_unicode((0x00B0 | QK_UNICODE), record); // Eye
-      register_code(KC_RSFT);
-      tap(KC_0);
-      unregister_code(KC_RSFT);
-      process_unicode((0x256F | QK_UNICODE), record); // Arm
-      tap(KC_SPC);
-      process_unicode((0x0361 | QK_UNICODE), record); // Flippy
-      tap(KC_SPC);
-      process_unicode((0x253B | QK_UNICODE), record); // Table
-      process_unicode((0x2501 | QK_UNICODE), record); // Table
-      process_unicode((0x253B | QK_UNICODE), record); // Table
+      send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
     }
     return false;
     break;
-#endif // UNICODE_ENABLE
-
+  case UC_TABL: // ┬─┬ノ( º _ ºノ)
+    if (record->event.pressed) {
+      send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 30CE 0029");
+    }
+    return false;
+    break;
+  case UC_SHRG: // ¯\_(ツ)_/¯
+    if (record->event.pressed) {
+      send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF");
+    }
+    return false;
+    break;
+  case UC_DISA: // ಠ_ಠ
+    if (record->event.pressed) {
+      send_unicode_hex_string("0CA0 005F 0CA0");
+    }
+    return false;
+    break;
+#endif
   }
   return process_record_keymap(keycode, record) &&
 #ifdef RGBLIGHT_ENABLE