summaryrefslogtreecommitdiffstats
path: root/users
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-10-01 18:00:14 -0700
committerJack Humbert <jack.humb@gmail.com>2018-10-01 21:00:14 -0400
commit1512a6bfd48fb75619a1f77394d41bdca7ea28b1 (patch)
tree54aea79710b4101b9fce20d4ff43d60eda24242b /users
parentf5ae3760c6be7e927fba74aca4a0cf21a44113af (diff)
Keymap: Update to drashna keymaps and userspace (#3992)
* Enabled unicode support and send_unicode function * Unicode cleanup * More unicode tweaking * Update EEPROM stuff * Account for keyboard macros * Switch Equal to Plus on Ergodox * more tweaks * Minor Unicode tweaks * Correct matrix printing for keylogger * Fix unicode functions * Fix unicode mode set since it actually uses EEPROM * Re-add DISABLE_LEADER * Ergodox is easier to hit the tapping term, fix that * Fix stupid type on unicode mode check * Preliminary CRKBD/HeliDox support * Fixes to Helidox * Cleanup userspace from old merge stuff * Remove CCCV sounds * Make Mode NOEEPROM Again
Diffstat (limited to 'users')
-rw-r--r--users/drashna/config.h10
-rw-r--r--users/drashna/drashna.c75
-rw-r--r--users/drashna/drashna.h28
-rw-r--r--users/drashna/rgb_stuff.c5
-rw-r--r--users/drashna/rules.mk7
-rw-r--r--users/drashna/send_unicode.c58
-rw-r--r--users/drashna/send_unicode.h (renamed from users/drashna/drashna_unicode.h)10
7 files changed, 138 insertions, 55 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h
index 92efcc5c74..3ddec93b13 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -55,7 +55,11 @@
#ifdef TAPPING_TERM
#undef TAPPING_TERM
#endif // TAPPING_TERM
-#define TAPPING_TERM 175
+#ifdef KEYBOARD_ergodox_ez
+ #define TAPPING_TERM 185
+#else
+ #define TAPPING_TERM 175
+#endif
// Disable action_get_macro and fn_actions, since we don't use these
@@ -63,4 +67,8 @@
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION
+#define DISABLE_LEADER
+
#define MACRO_TIMER 5
+
+
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 9489fb4567..aad9fab611 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -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
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index de8c3ba947..49e3fc870b 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -19,9 +19,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h"
#include "version.h"
#include "eeprom.h"
+#include "send_unicode.h"
+
#ifdef RGB_MATRIX_ENABLE
#include "rgb_matrix.h"
#endif
+
+
// Define layer names
enum userspace_layers {
_QWERTY = 0,
@@ -59,19 +63,26 @@ inline void tap(uint16_t keycode){ register_code(keycode); unregister_code(keyco
bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed);
bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
-#define EECONFIG_USERSPACE (uint8_t *)19
+#define EECONFIG_USERSPACE (uint32_t *)19
typedef union {
- uint8_t raw;
+ uint32_t raw;
struct {
bool rgb_layer_change :1;
bool is_overwatch :1;
bool nuke_switch :1;
+ uint8_t unicode_mod :4;
};
} userspace_config_t;
+#if defined(KEYMAP_SAFE_RANGE)
+ #define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE
+#else
+ #define PLACEHOLDER_SAFE_RANGE SAFE_RANGE
+#endif
+
enum userspace_custom_keycodes {
- EPRM = SAFE_RANGE, // Resets EEPROM do defaults (as in eeconfig_init)
+ EPRM = PLACEHOLDER_SAFE_RANGE, // Resets EEPROM do defaults (as in eeconfig_init)
VRSN, // Prints QMK Firmware and board info
KC_QWERTY, // Sets default layer to QWERTY
KC_COLEMAK, // Sets default layer to COLEMAK
@@ -99,13 +110,14 @@ enum userspace_custom_keycodes {
KC_SECRET_5, // test5
KC_CCCV, // Hold to copy, tap to paste
KC_NUKE, // NUCLEAR LAUNCH DETECTED!!!
-
-#ifdef UNICODE_ENABLE
- UC_FLIP, // Table flip (not working?)
-#endif //UNICODE_ENABLE
+ UC_FLIP, // (ಠ痊ಠ)┻━┻
+ UC_TABL, // ┬─┬ノ( º _ ºノ)
+ UC_SHRG, // ¯\_(ツ)_/¯
+ UC_DISA, // ಠ_ಠ
NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes
};
+
#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
#define ADJUST MO(_ADJUST)
@@ -153,6 +165,8 @@ enum userspace_custom_keycodes {
#define MG_NKRO MAGIC_TOGGLE_NKRO
+#define UC_IRNY UC(0x2E2E)
+#define UC_CLUE UC(0x203D)
#ifdef TAP_DANCE_ENABLE
enum {
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index 03c55b1323..4a1a8de692 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -230,7 +230,7 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
userspace_config.rgb_layer_change ^= 1;
xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
- eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);
+ eeprom_update_dword(EECONFIG_USERSPACE, userspace_config.raw);
if (userspace_config.rgb_layer_change) {
layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
}
@@ -243,7 +243,7 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
if (userspace_config.rgb_layer_change) {
userspace_config.rgb_layer_change = false;
xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
- eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);
+ eeprom_update_dword(EECONFIG_USERSPACE, userspace_config.raw);
}
}
return true; break;
@@ -273,6 +273,7 @@ void matrix_init_rgb(void) {
default:
rgblight_sethsv_noeeprom_cyan(); break;
}
+ rgblight_mode_noeeprom(1);
}
}
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index e299f24a1e..3d6213eff2 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -1,4 +1,3 @@
-
SRC += drashna.c
ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
@@ -9,7 +8,7 @@ ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
SRC += tap_dances.c
endif
-EXTRAFLAGS += -flto
+EXTRAFLAGS += -flto
ifeq ($(strip $(NO_SECRETS)), yes)
OPT_DEFS += -DNO_SECRETS
@@ -37,3 +36,7 @@ ifdef CONSOLE_ENABLE
OPT_DEFS += -DKEYLOGGER_ENABLE
endif
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
new file mode 100644
index 0000000000..cacfe1dc85
--- /dev/null
+++ b/users/drashna/send_unicode.c
@@ -0,0 +1,58 @@
+// Written by konstantin: vomindoraan
+#include "send_unicode.h"
+#include <ctype.h>
+#include <string.h>
+
+__attribute__((weak))
+void send_unicode_hex_string(const char* str) {
+ if (!str) { return; } // Safety net
+
+ while (*str) {
+ // Find the next code point (token) in the string
+ for (; *str == ' '; str++);
+ size_t n = strcspn(str, " "); // Length of the current token
+ char code_point[n+1];
+ strncpy(code_point, str, n);
+ code_point[n] = '\0'; // Make sure it's null-terminated
+
+ // Normalize the code point: make all hex digits lowercase
+ for (char *p = code_point; *p; p++) {
+ *p = tolower((unsigned char)*p);
+ }
+
+ // Send the code point as a Unicode input string
+ unicode_input_start();
+ send_string(code_point);
+ unicode_input_finish();
+
+ str += n; // Move to the first ' ' (or '\0') after the current token
+ }
+}
+
+// (ノಠ痊ಠ)ノ彡┻━┻
+// send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
+
+//Old code
+// (╯°□°)╯ ︵ ┻━┻
+ #if 0
+ 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
+ #endif
+
+
+// If you need a good converter: https://r12a.github.io/app-conversion/
diff --git a/users/drashna/drashna_unicode.h b/users/drashna/send_unicode.h
index 3d1bc03f9b..818b6e571b 100644
--- a/users/drashna/drashna_unicode.h
+++ b/users/drashna/send_unicode.h
@@ -1,10 +1,11 @@
-#ifndef UNICODE_USERSPACE_H
-#define UNICODE_USERSPACE_H
+#pragma once
+#include "quantum.h"
+void send_unicode_hex_string(const char* str);
/* use X(n) to call the */
-
+#ifdef UNICODEMAP_ENABLE
enum unicode_name {
THINK, // thinking face 🤔
GRIN, // grinning face 😊
@@ -67,5 +68,4 @@ const uint32_t PROGMEM unicode_map[] = {
[IRONY] = 0x02E2E,
[DEGREE] = 0x000B0
};
-
- #endif
+#endif // UNICODEMAP_ENABLE