From 59bef40aab37f8dd4db61e601f2a0e9b5991e993 Mon Sep 17 00:00:00 2001
From: Zach Nielsen
Date: Thu, 10 Nov 2016 12:14:54 -0800
Subject: Keep unicode's input_mode through a power cycle
---
quantum/process_keycode/process_unicode.c | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'quantum/process_keycode')
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c
index cd3a610b4d..f42f255389 100644
--- a/quantum/process_keycode/process_unicode.c
+++ b/quantum/process_keycode/process_unicode.c
@@ -1,6 +1,7 @@
#include "process_unicode.h"
static uint8_t input_mode;
+static uint8_t first_flag = 0;
__attribute__((weak))
uint16_t hex_to_keycode(uint8_t hex)
@@ -17,6 +18,7 @@ uint16_t hex_to_keycode(uint8_t hex)
void set_unicode_input_mode(uint8_t os_target)
{
input_mode = os_target;
+ eeprom_update_byte(EECONFIG_UNICODEMODE, os_target);
}
uint8_t get_unicode_input_mode(void) {
@@ -75,6 +77,10 @@ void register_hex(uint16_t hex) {
bool process_unicode(uint16_t keycode, keyrecord_t *record) {
if (keycode > QK_UNICODE && record->event.pressed) {
+ if (first_flag == 0) {
+ set_unicode_input_mode(eeprom_read_byte(EECONFIG_UNICODEMODE));
+ first_flag = 1;
+ }
uint16_t unicode = keycode & 0x7FFF;
unicode_input_start();
register_hex(unicode);
--
cgit v1.2.3
From 7e54332890f4c376314f942574c6183c87a6e9c8 Mon Sep 17 00:00:00 2001
From: nielsenz
Date: Thu, 30 Mar 2017 19:15:43 -0700
Subject: Pulling and pushing troubles
---
quantum/process_keycode/process_unicode.c | 75 ------------------------
quantum/process_keycode/process_unicode_common.c | 15 +++++
2 files changed, 15 insertions(+), 75 deletions(-)
(limited to 'quantum/process_keycode')
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c
index cecfaeee9b..1f16b9bdb2 100644
--- a/quantum/process_keycode/process_unicode.c
+++ b/quantum/process_keycode/process_unicode.c
@@ -16,81 +16,6 @@
#include "process_unicode.h"
#include "action_util.h"
-static uint8_t input_mode;
-static uint8_t first_flag = 0;
-
-__attribute__((weak))
-uint16_t hex_to_keycode(uint8_t hex)
-{
- if (hex == 0x0) {
- return KC_0;
- } else if (hex < 0xA) {
- return KC_1 + (hex - 0x1);
- } else {
- return KC_A + (hex - 0xA);
- }
-}
-
-void set_unicode_input_mode(uint8_t os_target)
-{
- input_mode = os_target;
- eeprom_update_byte(EECONFIG_UNICODEMODE, os_target);
-}
-
-uint8_t get_unicode_input_mode(void) {
- return input_mode;
-}
-
-__attribute__((weak))
-void unicode_input_start (void) {
- switch(input_mode) {
- case UC_OSX:
- register_code(KC_LALT);
- 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);
- }
- wait_ms(UNICODE_TYPE_DELAY);
-}
-
-__attribute__((weak))
-void unicode_input_finish (void) {
- switch(input_mode) {
- case UC_OSX:
- case UC_WIN:
- unregister_code(KC_LALT);
- break;
- case UC_LNX:
- register_code(KC_SPC);
- unregister_code(KC_SPC);
- break;
- }
-}
-
-void register_hex(uint16_t hex) {
- for(int i = 3; i >= 0; i--) {
- uint8_t digit = ((hex >> (i*4)) & 0xF);
- register_code(hex_to_keycode(digit));
- unregister_code(hex_to_keycode(digit));
- }
-}
-
bool process_unicode(uint16_t keycode, keyrecord_t *record) {
if (keycode > QK_UNICODE && record->event.pressed) {
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c
index 6012b4f07e..b4d4231dbd 100644
--- a/quantum/process_keycode/process_unicode_common.c
+++ b/quantum/process_keycode/process_unicode_common.c
@@ -16,11 +16,14 @@
#include "process_unicode_common.h"
+static uint8_t input_mode;
+static uint8_t first_flag = 0;
uint8_t mods;
void set_unicode_input_mode(uint8_t os_target)
{
input_mode = os_target;
+ eeprom_update_byte(EECONFIG_UNICODEMODE, os_target);
}
uint8_t get_unicode_input_mode(void) {
@@ -92,6 +95,18 @@ void unicode_input_finish (void) {
if (mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI);
}
+__attribute__((weak))
+uint16_t hex_to_keycode(uint8_t hex)
+{
+ if (hex == 0x0) {
+ return KC_0;
+ } else if (hex < 0xA) {
+ return KC_1 + (hex - 0x1);
+ } else {
+ return KC_A + (hex - 0xA);
+ }
+}
+
void register_hex(uint16_t hex) {
for(int i = 3; i >= 0; i--) {
uint8_t digit = ((hex >> (i*4)) & 0xF);
--
cgit v1.2.3
From d1e66e2e0715c680a8da3216525b54fd8f2b671f Mon Sep 17 00:00:00 2001
From: nielsenz
Date: Thu, 30 Mar 2017 20:10:34 -0700
Subject: Worked around some new Makefile issues.
---
keyboards/planck/keymaps/zach/Makefile | 2 +-
keyboards/planck/keymaps/zach/config.h | 2 +-
.../planck/keymaps/zach/zach_common_functions.c | 50 +++++++++++-----------
keyboards/preonic/keymaps/zach/Makefile | 4 +-
keyboards/preonic/keymaps/zach/config.h | 2 +-
.../preonic/keymaps/zach/zach_common_functions.c | 50 +++++++++++-----------
quantum/process_keycode/process_tap_dance.c | 2 +
quantum/process_keycode/process_unicode.c | 1 +
quantum/process_keycode/process_unicode_common.c | 1 -
9 files changed, 58 insertions(+), 56 deletions(-)
(limited to 'quantum/process_keycode')
diff --git a/keyboards/planck/keymaps/zach/Makefile b/keyboards/planck/keymaps/zach/Makefile
index 977f1a9013..9d86fc81fc 100644
--- a/keyboards/planck/keymaps/zach/Makefile
+++ b/keyboards/planck/keymaps/zach/Makefile
@@ -17,7 +17,7 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
#VARIABLE_TRACE = no # Debug changes to variable values
-UNICODE_ENABLE = yes # Unicode
+UNICODE_ENABLE = no # Unicode (can't be used with unicodemap)
UNICODEMAP_ENABLE = yes # Enable extended unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
diff --git a/keyboards/planck/keymaps/zach/config.h b/keyboards/planck/keymaps/zach/config.h
index 7deb9ebfe8..d309c94935 100644
--- a/keyboards/planck/keymaps/zach/config.h
+++ b/keyboards/planck/keymaps/zach/config.h
@@ -77,7 +77,7 @@ along with this program. If not, see .
/* disable action features */
//#define NO_ACTION_LAYER
#define NO_ACTION_TAPPING
-#define NO_ACTION_ONESHOT
+//#define NO_ACTION_ONESHOT
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION
#define PREVENT_STUCK_MODIFIERS
diff --git a/keyboards/planck/keymaps/zach/zach_common_functions.c b/keyboards/planck/keymaps/zach/zach_common_functions.c
index b77f2b2418..2c47b22896 100644
--- a/keyboards/planck/keymaps/zach/zach_common_functions.c
+++ b/keyboards/planck/keymaps/zach/zach_common_functions.c
@@ -141,31 +141,31 @@ qk_tap_dance_action_t tap_dance_actions[] = {
};
#endif
-#ifdef UNICODE_ENABLE
+//#ifdef UNICODE_ENABLE
// Unicode shortcuts
-#define IBANG UC(0x203D)
-#define RAROW UC(0x2192)
-#define LAROW UC(0x2190)
-#define DEGREE UC(0x00B0)
-#define OMEGA UC(0x03A9)
-#define WOMEGA UC(0x03C9)
-#define MICRO UC(0x00B5)
-#define PLUMIN UC(0x00B1)
-#define SUPA2 UC(0x00B2)
-#define ROMAN1 UC(0x2160)
-#define ROMAN2 UC(0x2161)
-#define ROMAN3 UC(0x2162)
-#define ROMAN4 UC(0x2163)
-#define ROMAN5 UC(0x2164)
-#define ROMAN6 UC(0x2165)
-#define ROMAN7 UC(0x2166)
-#define roman1 UC(0x2170)
-#define roman2 UC(0x2171)
-#define roman3 UC(0x2172)
-#define roman4 UC(0x2173)
-#define roman5 UC(0x2174)
-#define roman6 UC(0x2175)
-#define roman7 UC(0x2176)
+#define IBANG X(0x203D)
+#define RAROW X(0x2192)
+#define LAROW X(0x2190)
+#define DEGREE X(0x00B0)
+#define OMEGA X(0x03A9)
+#define WOMEGA X(0x03C9)
+#define MICRO X(0x00B5)
+#define PLUMIN X(0x00B1)
+#define SUPA2 X(0x00B2)
+#define ROMAN1 X(0x2160)
+#define ROMAN2 X(0x2161)
+#define ROMAN3 X(0x2162)
+#define ROMAN4 X(0x2163)
+#define ROMAN5 X(0x2164)
+#define ROMAN6 X(0x2165)
+#define ROMAN7 X(0x2166)
+#define roman1 X(0x2170)
+#define roman2 X(0x2171)
+#define roman3 X(0x2172)
+#define roman4 X(0x2173)
+#define roman5 X(0x2174)
+#define roman6 X(0x2175)
+#define roman7 X(0x2176)
#ifdef UNICODEMAP_ENABLE // For Unicode characters larger than 0x8000. Send with X()
enum Ext_Unicode{
@@ -192,7 +192,7 @@ const uint32_t PROGMEM unicode_map[] = {
#define TMBL X(TUMBLER)
#endif
-#endif
+//#endif
static uint16_t key_timer;
static uint8_t caps_status = 0;
diff --git a/keyboards/preonic/keymaps/zach/Makefile b/keyboards/preonic/keymaps/zach/Makefile
index f0a84abac4..eebf413495 100644
--- a/keyboards/preonic/keymaps/zach/Makefile
+++ b/keyboards/preonic/keymaps/zach/Makefile
@@ -17,8 +17,8 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = yes # Audio output on port C6
#VARIABLE_TRACE = no # Debug changes to variable values
-UNICODE_ENABLE = yes # Unicode
-UNICODEMAP_ENABLE = no # Enable extended unicode
+UNICODE_ENABLE = no # Unicode
+UNICODEMAP_ENABLE = yes # Enable extended unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
diff --git a/keyboards/preonic/keymaps/zach/config.h b/keyboards/preonic/keymaps/zach/config.h
index 59959524fa..bb8913c7af 100644
--- a/keyboards/preonic/keymaps/zach/config.h
+++ b/keyboards/preonic/keymaps/zach/config.h
@@ -84,7 +84,7 @@ along with this program. If not, see .
/* disable action features */
//#define NO_ACTION_LAYER
#define NO_ACTION_TAPPING
-#define NO_ACTION_ONESHOT
+//#define NO_ACTION_ONESHOT
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION
#define PREVENT_STUCK_MODIFIERS
diff --git a/keyboards/preonic/keymaps/zach/zach_common_functions.c b/keyboards/preonic/keymaps/zach/zach_common_functions.c
index b77f2b2418..2c47b22896 100644
--- a/keyboards/preonic/keymaps/zach/zach_common_functions.c
+++ b/keyboards/preonic/keymaps/zach/zach_common_functions.c
@@ -141,31 +141,31 @@ qk_tap_dance_action_t tap_dance_actions[] = {
};
#endif
-#ifdef UNICODE_ENABLE
+//#ifdef UNICODE_ENABLE
// Unicode shortcuts
-#define IBANG UC(0x203D)
-#define RAROW UC(0x2192)
-#define LAROW UC(0x2190)
-#define DEGREE UC(0x00B0)
-#define OMEGA UC(0x03A9)
-#define WOMEGA UC(0x03C9)
-#define MICRO UC(0x00B5)
-#define PLUMIN UC(0x00B1)
-#define SUPA2 UC(0x00B2)
-#define ROMAN1 UC(0x2160)
-#define ROMAN2 UC(0x2161)
-#define ROMAN3 UC(0x2162)
-#define ROMAN4 UC(0x2163)
-#define ROMAN5 UC(0x2164)
-#define ROMAN6 UC(0x2165)
-#define ROMAN7 UC(0x2166)
-#define roman1 UC(0x2170)
-#define roman2 UC(0x2171)
-#define roman3 UC(0x2172)
-#define roman4 UC(0x2173)
-#define roman5 UC(0x2174)
-#define roman6 UC(0x2175)
-#define roman7 UC(0x2176)
+#define IBANG X(0x203D)
+#define RAROW X(0x2192)
+#define LAROW X(0x2190)
+#define DEGREE X(0x00B0)
+#define OMEGA X(0x03A9)
+#define WOMEGA X(0x03C9)
+#define MICRO X(0x00B5)
+#define PLUMIN X(0x00B1)
+#define SUPA2 X(0x00B2)
+#define ROMAN1 X(0x2160)
+#define ROMAN2 X(0x2161)
+#define ROMAN3 X(0x2162)
+#define ROMAN4 X(0x2163)
+#define ROMAN5 X(0x2164)
+#define ROMAN6 X(0x2165)
+#define ROMAN7 X(0x2166)
+#define roman1 X(0x2170)
+#define roman2 X(0x2171)
+#define roman3 X(0x2172)
+#define roman4 X(0x2173)
+#define roman5 X(0x2174)
+#define roman6 X(0x2175)
+#define roman7 X(0x2176)
#ifdef UNICODEMAP_ENABLE // For Unicode characters larger than 0x8000. Send with X()
enum Ext_Unicode{
@@ -192,7 +192,7 @@ const uint32_t PROGMEM unicode_map[] = {
#define TMBL X(TUMBLER)
#endif
-#endif
+//#endif
static uint16_t key_timer;
static uint8_t caps_status = 0;
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c
index 68c8425bb4..b807ec3c30 100644
--- a/quantum/process_keycode/process_tap_dance.c
+++ b/quantum/process_keycode/process_tap_dance.c
@@ -16,6 +16,8 @@
#include "quantum.h"
#include "action_tapping.h"
+uint8_t get_oneshot_mods(void);
+
static uint16_t last_td;
static int8_t highest_td = -1;
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c
index 1f16b9bdb2..678a15234d 100644
--- a/quantum/process_keycode/process_unicode.c
+++ b/quantum/process_keycode/process_unicode.c
@@ -16,6 +16,7 @@
#include "process_unicode.h"
#include "action_util.h"
+static uint8_t first_flag = 0;
bool process_unicode(uint16_t keycode, keyrecord_t *record) {
if (keycode > QK_UNICODE && record->event.pressed) {
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c
index b4d4231dbd..1dbdec3e71 100644
--- a/quantum/process_keycode/process_unicode_common.c
+++ b/quantum/process_keycode/process_unicode_common.c
@@ -17,7 +17,6 @@
#include "process_unicode_common.h"
static uint8_t input_mode;
-static uint8_t first_flag = 0;
uint8_t mods;
void set_unicode_input_mode(uint8_t os_target)
--
cgit v1.2.3