summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorWilliam Chang <william@factual.com>2019-05-09 21:16:06 -0700
committerWilliam Chang <william@factual.com>2019-05-09 21:16:06 -0700
commit4b2d3288d013b1a71ea25402224c4a8225a099e9 (patch)
treeb7f5dded777a950e63c4dd967260744336bfaa6b /quantum
parent57a6ea11df685d84a1ea07953e88f224ce2b24f7 (diff)
parentbce391a663d2848bff8ffffca0e4bad771bd3890 (diff)
resolved conflicts
Diffstat (limited to 'quantum')
-rw-r--r--quantum/color.c9
-rw-r--r--quantum/keymap_extras/sendstring_uk.h4
-rw-r--r--quantum/led_tables.c48
-rw-r--r--quantum/mcu_selection.mk1
-rw-r--r--quantum/process_keycode/process_space_cadet.c151
-rw-r--r--quantum/process_keycode/process_space_cadet.h21
-rw-r--r--quantum/process_keycode/process_unicode.c6
-rw-r--r--quantum/process_keycode/process_unicode.h2
-rw-r--r--quantum/process_keycode/process_unicode_common.c38
-rw-r--r--quantum/process_keycode/process_unicode_common.h13
-rw-r--r--quantum/process_keycode/process_unicodemap.c36
-rw-r--r--quantum/process_keycode/process_unicodemap.h4
-rw-r--r--quantum/quantum.c392
-rw-r--r--quantum/quantum.h8
-rw-r--r--quantum/quantum_keycodes.h19
-rw-r--r--quantum/rgb_matrix.c165
-rw-r--r--quantum/rgb_matrix.h40
-rw-r--r--quantum/rgb_matrix_animations/alpha_mods_anim.h5
-rw-r--r--quantum/rgb_matrix_animations/breathing_anim.h1
-rw-r--r--quantum/rgb_matrix_animations/cycle_all_anim.h6
-rw-r--r--quantum/rgb_matrix_animations/cycle_left_right_anim.h6
-rw-r--r--quantum/rgb_matrix_animations/cycle_up_down_anim.h6
-rw-r--r--quantum/rgb_matrix_animations/digital_rain_anim.h33
-rw-r--r--quantum/rgb_matrix_animations/dual_beacon_anim.h6
-rw-r--r--quantum/rgb_matrix_animations/gradient_up_down_anim.h6
-rw-r--r--quantum/rgb_matrix_animations/jellybean_raindrops_anim.h9
-rw-r--r--quantum/rgb_matrix_animations/rainbow_beacon_anim.h6
-rw-r--r--quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h6
-rw-r--r--quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h6
-rw-r--r--quantum/rgb_matrix_animations/raindrops_anim.h8
-rw-r--r--quantum/rgb_matrix_animations/solid_color_anim.h2
-rw-r--r--quantum/rgb_matrix_animations/solid_reactive_anim.h5
-rw-r--r--quantum/rgb_matrix_animations/solid_reactive_cross.h50
-rw-r--r--quantum/rgb_matrix_animations/solid_reactive_nexus.h48
-rw-r--r--quantum/rgb_matrix_animations/solid_reactive_simple_anim.h5
-rw-r--r--quantum/rgb_matrix_animations/solid_reactive_wide.h42
-rw-r--r--quantum/rgb_matrix_animations/solid_splash_anim.h8
-rw-r--r--quantum/rgb_matrix_animations/splash_anim.h8
-rw-r--r--quantum/rgb_matrix_animations/typing_heatmap_anim.h75
-rw-r--r--quantum/rgb_matrix_drivers.c4
-rw-r--r--quantum/rgb_matrix_types.h32
-rw-r--r--quantum/rgblight.c218
-rw-r--r--quantum/rgblight.h31
-rw-r--r--quantum/rgblight_breathe_table.h116
-rw-r--r--quantum/rgblight_list.h240
-rw-r--r--quantum/split_common/matrix.c2
-rw-r--r--quantum/split_common/transport.c5
-rw-r--r--quantum/stm32/proton_c.mk1
-rw-r--r--quantum/template/avr/config.h6
-rw-r--r--quantum/template/ps2avrgb/readme.md2
-rw-r--r--quantum/template/ps2avrgb/rules.mk4
-rw-r--r--quantum/template/ps2avrgb/usbconfig.h5
52 files changed, 1331 insertions, 639 deletions
diff --git a/quantum/color.c b/quantum/color.c
index c49877592e..466e6edacb 100644
--- a/quantum/color.c
+++ b/quantum/color.c
@@ -22,8 +22,8 @@
RGB hsv_to_rgb( HSV hsv )
{
RGB rgb;
- uint8_t region, p, q, t;
- uint16_t h, s, v, remainder;
+ uint8_t region, remainder, p, q, t;
+ uint16_t h, s, v;
if ( hsv.s == 0 )
{
@@ -37,8 +37,8 @@ RGB hsv_to_rgb( HSV hsv )
s = hsv.s;
v = hsv.v;
- region = h / 43;
- remainder = (h - (region * 43)) * 6;
+ region = h * 6 / 255;
+ remainder = (h * 2 - region * 85) * 3;
p = (v * (255 - s)) >> 8;
q = (v * (255 - ((s * remainder) >> 8))) >> 8;
@@ -46,6 +46,7 @@ RGB hsv_to_rgb( HSV hsv )
switch ( region )
{
+ case 6:
case 0:
rgb.r = v;
rgb.g = t;
diff --git a/quantum/keymap_extras/sendstring_uk.h b/quantum/keymap_extras/sendstring_uk.h
index 3c71f97640..2824e5d444 100644
--- a/quantum/keymap_extras/sendstring_uk.h
+++ b/quantum/keymap_extras/sendstring_uk.h
@@ -25,7 +25,7 @@ const bool ascii_to_shift_lut[0x80] PROGMEM = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0,
+ 0, 1, 1, 0, 1, 1, 1, 0,
1, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 1, 0, 1, 1,
@@ -45,7 +45,7 @@ const uint8_t ascii_to_keycode_lut[0x80] PROGMEM = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, KC_ESC, 0, 0, 0, 0,
- KC_SPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_7, KC_QUOT,
+ KC_SPC, KC_1, KC_2, KC_NUHS, KC_4, KC_5, KC_7, KC_QUOT,
KC_9, KC_0, KC_8, KC_EQL, KC_COMM, KC_MINS, KC_DOT, KC_SLSH,
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7,
KC_8, KC_9, KC_SCLN, KC_SCLN, KC_COMM, KC_EQL, KC_DOT, KC_SLSH,
diff --git a/quantum/led_tables.c b/quantum/led_tables.c
index b99f262097..0eeb5c44b6 100644
--- a/quantum/led_tables.c
+++ b/quantum/led_tables.c
@@ -19,38 +19,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef USE_CIE1931_CURVE
// Lightness curve using the CIE 1931 lightness formula
//Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm
-const uint8_t CIE1931_CURVE[] PROGMEM = {
- 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
- 3, 4, 4, 4, 4, 4, 4, 5, 5, 5,
- 5, 5, 6, 6, 6, 6, 6, 7, 7, 7,
- 7, 8, 8, 8, 8, 9, 9, 9, 10, 10,
- 10, 10, 11, 11, 11, 12, 12, 12, 13, 13,
- 13, 14, 14, 15, 15, 15, 16, 16, 17, 17,
- 17, 18, 18, 19, 19, 20, 20, 21, 21, 22,
- 22, 23, 23, 24, 24, 25, 25, 26, 26, 27,
- 28, 28, 29, 29, 30, 31, 31, 32, 32, 33,
- 34, 34, 35, 36, 37, 37, 38, 39, 39, 40,
- 41, 42, 43, 43, 44, 45, 46, 47, 47, 48,
- 49, 50, 51, 52, 53, 54, 54, 55, 56, 57,
- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- 68, 70, 71, 72, 73, 74, 75, 76, 77, 79,
- 80, 81, 82, 83, 85, 86, 87, 88, 90, 91,
- 92, 94, 95, 96, 98, 99, 100, 102, 103, 105,
- 106, 108, 109, 110, 112, 113, 115, 116, 118, 120,
- 121, 123, 124, 126, 128, 129, 131, 132, 134, 136,
- 138, 139, 141, 143, 145, 146, 148, 150, 152, 154,
- 155, 157, 159, 161, 163, 165, 167, 169, 171, 173,
- 175, 177, 179, 181, 183, 185, 187, 189, 191, 193,
- 196, 198, 200, 202, 204, 207, 209, 211, 214, 216,
- 218, 220, 223, 225, 228, 230, 232, 235, 237, 240,
- 242, 245, 247, 250, 252, 255,
- };
+const uint8_t CIE1931_CURVE[256] PROGMEM = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
+ 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6,
+ 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11,
+ 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16,
+ 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24,
+ 25, 25, 26, 26, 27, 28, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34,
+ 35, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 43, 44, 44, 45, 46,
+ 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78,
+ 79, 80, 82, 83, 84, 85, 87, 88, 89, 90, 92, 93, 94, 96, 97, 99,
+100, 101, 103, 104, 106, 107, 108, 110, 111, 113, 114, 116, 118, 119, 121, 122,
+124, 125, 127, 129, 130, 132, 134, 135, 137, 139, 141, 142, 144, 146, 148, 149,
+151, 153, 155, 157, 159, 161, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180,
+182, 185, 187, 189, 191, 193, 195, 197, 200, 202, 204, 206, 208, 211, 213, 215,
+218, 220, 222, 225, 227, 230, 232, 234, 237, 239, 242, 244, 247, 249, 252, 255
+};
#endif
#ifdef USE_LED_BREATHING_TABLE
-const uint8_t LED_BREATHING_TABLE[] PROGMEM = {
+const uint8_t LED_BREATHING_TABLE[256] PROGMEM = {
0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9,
10, 11, 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35,
37, 40, 42, 44, 47, 49, 52, 54, 57, 59, 62, 65, 67, 70, 73, 76,
diff --git a/quantum/mcu_selection.mk b/quantum/mcu_selection.mk
index 209b578ea5..fa6dc8b53c 100644
--- a/quantum/mcu_selection.mk
+++ b/quantum/mcu_selection.mk
@@ -34,6 +34,7 @@ ifneq ($(findstring STM32F303, $(MCU)),)
# Options to pass to dfu-util when flashing
DFU_ARGS ?= -d 0483:df11 -a 0 -s 0x08000000:leave
+ DFU_SUFFIX_ARGS = -p DF11 -v 0483
endif
ifneq (,$(filter $(MCU),atmega32u4 at90usb1286))
diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c
new file mode 100644
index 0000000000..ac39df8089
--- /dev/null
+++ b/quantum/process_keycode/process_space_cadet.c
@@ -0,0 +1,151 @@
+/* Copyright 2019 Jack Humbert
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "process_space_cadet.h"
+
+#ifndef TAPPING_TERM
+ #define TAPPING_TERM 200
+#endif
+
+// ********** OBSOLETE DEFINES, STOP USING! (pls?) **********
+// Shift / paren setup
+#ifndef LSPO_KEY
+ #define LSPO_KEY KC_9
+#endif
+#ifndef RSPC_KEY
+ #define RSPC_KEY KC_0
+#endif
+
+// Shift / Enter setup
+#ifndef SFTENT_KEY
+ #define SFTENT_KEY KC_ENT
+#endif
+
+#ifdef DISABLE_SPACE_CADET_MODIFIER
+ #ifndef LSPO_MOD
+ #define LSPO_MOD KC_TRNS
+ #endif
+ #ifndef RSPC_MOD
+ #define RSPC_MOD KC_TRNS
+ #endif
+#else
+ #ifndef LSPO_MOD
+ #define LSPO_MOD KC_LSFT
+ #endif
+ #ifndef RSPC_MOD
+ #define RSPC_MOD KC_RSFT
+ #endif
+#endif
+// **********************************************************
+
+// Shift / paren setup
+#ifndef LSPO_KEYS
+ #define LSPO_KEYS KC_LSFT, LSPO_MOD, LSPO_KEY
+#endif
+#ifndef RSPC_KEYS
+ #define RSPC_KEYS KC_RSFT, RSPC_MOD, RSPC_KEY
+#endif
+
+// Control / paren setup
+#ifndef LCPO_KEYS
+ #define LCPO_KEYS KC_LCTL, KC_LCTL, KC_9
+#endif
+#ifndef RCPC_KEYS
+ #define RCPC_KEYS KC_RCTL, KC_RCTL, KC_0
+#endif
+
+// Alt / paren setup
+#ifndef LAPO_KEYS
+ #define LAPO_KEYS KC_LALT, KC_LALT, KC_9
+#endif
+#ifndef RAPC_KEYS
+ #define RAPC_KEYS KC_RALT, KC_RALT, KC_0
+#endif
+
+// Shift / Enter setup
+#ifndef SFTENT_KEYS
+ #define SFTENT_KEYS KC_RSFT, KC_TRNS, SFTENT_KEY
+#endif
+
+static uint8_t sc_last = 0;
+static uint16_t sc_timer = 0;
+
+void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) {
+ if (record->event.pressed) {
+ sc_last = holdMod;
+ sc_timer = timer_read ();
+ if (IS_MOD(holdMod)) {
+ register_mods(MOD_BIT(holdMod));
+ }
+ }
+ else {
+ if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) {
+ if (holdMod != tapMod) {
+ if (IS_MOD(holdMod)) {
+ unregister_mods(MOD_BIT(holdMod));
+ }
+ if (IS_MOD(tapMod)) {
+ register_mods(MOD_BIT(tapMod));
+ }
+ }
+ tap_code(keycode);
+ if (IS_MOD(tapMod)) {
+ unregister_mods(MOD_BIT(tapMod));
+ }
+ } else {
+ if (IS_MOD(holdMod)) {
+ unregister_mods(MOD_BIT(holdMod));
+ }
+ }
+ }
+}
+
+bool process_space_cadet(uint16_t keycode, keyrecord_t *record) {
+ switch(keycode) {
+ case KC_LSPO: {
+ perform_space_cadet(record, LSPO_KEYS);
+ return false;
+ }
+ case KC_RSPC: {
+ perform_space_cadet(record, RSPC_KEYS);
+ return false;
+ }
+ case KC_LCPO: {
+ perform_space_cadet(record, LCPO_KEYS);
+ return false;
+ }
+ case KC_RCPC: {
+ perform_space_cadet(record, RCPC_KEYS);
+ return false;
+ }
+ case KC_LAPO: {
+ perform_space_cadet(record, LAPO_KEYS);
+ return false;
+ }
+ case KC_RAPC: {
+ perform_space_cadet(record, RAPC_KEYS);
+ return false;
+ }
+ case KC_SFTENT: {
+ perform_space_cadet(record, SFTENT_KEYS);
+ return false;
+ }
+ default: {
+ sc_last = 0;
+ break;
+ }
+ }
+ return true;
+}
diff --git a/quantum/process_keycode/process_space_cadet.h b/quantum/process_keycode/process_space_cadet.h
new file mode 100644
index 0000000000..c823143504
--- /dev/null
+++ b/quantum/process_keycode/process_space_cadet.h
@@ -0,0 +1,21 @@
+/* Copyright 2019 Jack Humbert
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#include "quantum.h"
+
+void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, uint8_t keycode);
+bool process_space_cadet(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c
index 19beb84520..2c914013ac 100644
--- a/quantum/process_keycode/process_unicode.c
+++ b/quantum/process_keycode/process_unicode.c
@@ -13,15 +13,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "process_unicode.h"
#include "action_util.h"
#include "eeprom.h"
bool process_unicode(uint16_t keycode, keyrecord_t *record) {
- if (keycode > QK_UNICODE && record->event.pressed) {
- uint16_t unicode = keycode & 0x7FFF;
+ if (keycode >= QK_UNICODE && keycode <= QK_UNICODE_MAX && record->event.pressed) {
unicode_input_start();
- register_hex(unicode);
+ register_hex(keycode & 0x7FFF);
unicode_input_finish();
}
return true;
diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h
index 0913e99107..22765ad560 100644
--- a/quantum/process_keycode/process_unicode.h
+++ b/quantum/process_keycode/process_unicode.h
@@ -13,9 +13,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#pragma once
-#include "quantum.h"
#include "process_unicode_common.h"
bool process_unicode(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c
index d0a9cf2324..21ac2291db 100644
--- a/quantum/process_keycode/process_unicode_common.c
+++ b/quantum/process_keycode/process_unicode_common.c
@@ -20,6 +20,8 @@
#include <string.h>
unicode_config_t unicode_config;
+uint8_t unicode_saved_mods;
+
#if UNICODE_SELECTED_MODES != -1
static uint8_t selected[] = { UNICODE_SELECTED_MODES };
static uint8_t selected_count = sizeof selected / sizeof *selected;
@@ -75,30 +77,24 @@ void persist_unicode_input_mode(void) {
eeprom_update_byte(EECONFIG_UNICODEMODE, unicode_config.input_mode);
}
-static uint8_t saved_mods;
-
__attribute__((weak))
void unicode_input_start(void) {
- saved_mods = get_mods(); // Save current mods
+ unicode_saved_mods = get_mods(); // Save current mods
clear_mods(); // Unregister mods to start from a clean state
switch (unicode_config.input_mode) {
case UC_OSX:
- register_code(UNICODE_OSX_KEY);
+ register_code(UNICODE_KEY_OSX);
break;
case UC_LNX:
- register_code(KC_LCTL);
- register_code(KC_LSFT);
- tap_code(KC_U); // TODO: Replace with tap_code16(LCTL(LSFT(KC_U))); and test
- unregister_code(KC_LSFT);
- unregister_code(KC_LCTL);
+ tap_code16(UNICODE_KEY_LNX);
break;
case UC_WIN:
register_code(KC_LALT);
tap_code(KC_PPLS);
break;
case UC_WINC:
- tap_code(UNICODE_WINC_KEY);
+ tap_code(UNICODE_KEY_WINC);
tap_code(KC_U);
break;
}
@@ -110,7 +106,7 @@ __attribute__((weak))
void unicode_input_finish(void) {
switch (unicode_config.input_mode) {
case UC_OSX:
- unregister_code(UNICODE_OSX_KEY);
+ unregister_code(UNICODE_KEY_OSX);
break;
case UC_LNX:
tap_code(KC_SPC);
@@ -123,7 +119,25 @@ void unicode_input_finish(void) {
break;
}
- set_mods(saved_mods); // Reregister previously set mods
+ set_mods(unicode_saved_mods); // Reregister previously set mods
+}
+
+__attribute__((weak))
+void unicode_input_cancel(void) {
+ switch (unicode_config.input_mode) {
+ case UC_OSX:
+ unregister_code(UNICODE_KEY_OSX);
+ break;
+ case UC_LNX:
+ case UC_WINC:
+ tap_code(KC_ESC);
+ break;
+ case UC_WIN:
+ unregister_code(KC_LALT);
+ break;
+ }
+
+ set_mods(unicode_saved_mods); // Reregister previously set mods
}
__attribute__((weak))
diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h
index e608ab76be..7340800e56 100644
--- a/quantum/process_keycode/process_unicode_common.h
+++ b/quantum/process_keycode/process_unicode_common.h
@@ -23,11 +23,14 @@
#endif
// Keycodes used for starting Unicode input on different platforms
-#ifndef UNICODE_OSX_KEY
- #define UNICODE_OSX_KEY KC_LALT
+#ifndef UNICODE_KEY_OSX
+ #define UNICODE_KEY_OSX KC_LALT
#endif
-#ifndef UNICODE_WINC_KEY
- #define UNICODE_WINC_KEY KC_RALT
+#ifndef UNICODE_KEY_LNX
+ #define UNICODE_KEY_LNX LCTL(LSFT(KC_U))
+#endif
+#ifndef UNICODE_KEY_WINC
+ #define UNICODE_KEY_WINC KC_RALT
#endif
// Comma-delimited, ordered list of input modes selected for use (e.g. in cycle)
@@ -63,6 +66,7 @@ typedef union {
} unicode_config_t;
extern unicode_config_t unicode_config;
+extern uint8_t unicode_saved_mods;
void unicode_input_mode_init(void);
uint8_t get_unicode_input_mode(void);
@@ -72,6 +76,7 @@ void persist_unicode_input_mode(void);
void unicode_input_start(void);
void unicode_input_finish(void);
+void unicode_input_cancel(void);
void register_hex(uint16_t hex);
void send_unicode_hex_string(const char *str);
diff --git a/quantum/process_keycode/process_unicodemap.c b/quantum/process_keycode/process_unicodemap.c
index 3274027613..b887879860 100644
--- a/quantum/process_keycode/process_unicodemap.c
+++ b/quantum/process_keycode/process_unicodemap.c
@@ -15,7 +15,6 @@
*/
#include "process_unicodemap.h"
-#include "process_unicode_common.h"
void register_hex32(uint32_t hex) {
bool onzerostart = true;
@@ -38,28 +37,39 @@ void register_hex32(uint32_t hex) {
}
__attribute__((weak))
-void unicodemap_input_error() {}
+uint16_t unicodemap_index(uint16_t keycode) {
+ if (keycode >= QK_UNICODEMAP_PAIR) {
+ // Keycode is a pair: extract index based on Shift / Caps Lock state
+ uint16_t index = keycode - QK_UNICODEMAP_PAIR;
+
+ bool shift = unicode_saved_mods & MOD_MASK_SHIFT, caps = IS_HOST_LED_ON(USB_LED_CAPS_LOCK);
+ if (shift ^ caps) { index >>= 7; }
+
+ return index & 0x7F;
+ } else {
+ // Keycode is a regular index
+ return keycode - QK_UNICODEMAP;
+ }
+}
bool process_unicodemap(uint16_t keycode, keyrecord_t *record) {
- if ((keycode & QK_UNICODEMAP) == QK_UNICODEMAP && record->event.pressed) {
- uint16_t index = keycode - QK_UNICODEMAP;
- uint32_t code = pgm_read_dword(unicode_map + index);
+ if (keycode >= QK_UNICODEMAP && keycode <= QK_UNICODEMAP_PAIR_MAX && record->event.pressed) {
+ unicode_input_start();
+
+ uint32_t code = pgm_read_dword(unicode_map + unicodemap_index(keycode));
uint8_t input_mode = get_unicode_input_mode();
- if (code > 0xFFFF && code <= 0x10FFFF && input_mode == UC_OSX) {
- // Convert to UTF-16 surrogate pair
+ if (code > 0x10FFFF || (code > 0xFFFF && input_mode == UC_WIN)) {
+ // Character is out of range supported by the platform
+ unicode_input_cancel();
+ } else if (code > 0xFFFF && input_mode == UC_OSX) {
+ // Convert to UTF-16 surrogate pair on Mac
code -= 0x10000;
uint32_t lo = code & 0x3FF, hi = (code & 0xFFC00) >> 10;
-
- unicode_input_start();
register_hex32(hi + 0xD800);
register_hex32(lo + 0xDC00);
unicode_input_finish();
- } else if ((code > 0x10FFFF && input_mode == UC_OSX) || (code > 0xFFFFF && input_mode == UC_LNX)) {
- // Character is out of range supported by the OS
- unicodemap_input_error();
} else {
- unicode_input_start();
register_hex32(code);
unicode_input_finish();
}
diff --git a/quantum/process_keycode/process_unicodemap.h b/quantum/process_keycode/process_unicodemap.h
index fe4f979155..51709c5dc8 100644
--- a/quantum/process_keycode/process_unicodemap.h
+++ b/quantum/process_keycode/process_unicodemap.h
@@ -16,10 +16,10 @@
#pragma once
-#include "quantum.h"
#include "process_unicode_common.h"
extern const uint32_t PROGMEM unicode_map[];
-void unicodemap_input_error(void);
+void register_hex32(uint32_t hex);
+uint16_t unicodemap_index(uint16_t keycode);
bool process_unicodemap(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 9aa498dadb..d4fa7f2efc 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -24,10 +24,6 @@
#include "outputselect.h"
#endif
-#ifndef TAPPING_TERM
-#define TAPPING_TERM 200
-#endif
-
#ifndef BREATHING_PERIOD
#define BREATHING_PERIOD 6
#endif
@@ -196,30 +192,6 @@ void reset_keyboard(void) {
bootloader_jump();
}
-// Shift / paren setup
-
-#ifndef LSPO_KEY
- #define LSPO_KEY KC_9
-#endif
-#ifndef RSPC_KEY
- #define RSPC_KEY KC_0
-#endif
-
-#ifndef LSPO_MOD
- #define LSPO_MOD KC_LSFT
-#endif
-#ifndef RSPC_MOD
- #define RSPC_MOD KC_RSFT
-#endif
-
-// Shift / Enter setup
-#ifndef SFTENT_KEY
- #define SFTENT_KEY KC_ENT
-#endif
-
-static bool shift_interrupted[2] = {0, 0};
-static uint16_t scs_timer[2] = {0, 0};
-
/* true if the last press of GRAVE_ESC was shifted (i.e. GUI or SHIFT were pressed), false otherwise.
* Used to ensure that the correct keycode is released if the key is released.
*/
@@ -275,12 +247,6 @@ bool process_record_quantum(keyrecord_t *record) {
preprocess_tap_dance(keycode, record);
#endif
- #if defined(OLED_DRIVER_ENABLE) && !defined(OLED_DISABLE_TIMEOUT)
- // Wake up oled if user is using those fabulous keys!
- if (record->event.pressed)
- oled_on();
- #endif
-
if (!(
#if defined(KEY_LOCK_ENABLE)
// Must run first to be able to mask key_up events.
@@ -329,6 +295,9 @@ bool process_record_quantum(keyrecord_t *record) {
#ifdef TERMINAL_ENABLE
process_terminal(keycode, record) &&
#endif
+ #ifdef SPACE_CADET_ENABLE
+ process_space_cadet(keycode, record) &&
+ #endif
true)) {
return false;
}
@@ -685,92 +654,6 @@ bool process_record_quantum(keyrecord_t *record) {
return false;
}
break;
- case KC_LSPO: {
- if (record->event.pressed) {
- shift_interrupted[0] = false;
-