diff options
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/action.c | 10 | ||||
-rw-r--r-- | quantum/action_tapping.c | 166 | ||||
-rw-r--r-- | quantum/action_tapping.h | 13 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_uk.h | 96 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_us.h | 75 | ||||
-rw-r--r-- | quantum/main.c | 6 | ||||
-rw-r--r-- | quantum/matrix.c | 10 | ||||
-rw-r--r-- | quantum/os_detection.c | 129 | ||||
-rw-r--r-- | quantum/os_detection.h | 38 | ||||
-rw-r--r-- | quantum/os_detection/tests/os_detection.cpp | 164 | ||||
-rw-r--r-- | quantum/os_detection/tests/rules.mk | 5 | ||||
-rw-r--r-- | quantum/os_detection/tests/testlist.mk | 1 | ||||
-rw-r--r-- | quantum/painter/lvgl/qp_lvgl.c | 144 | ||||
-rw-r--r-- | quantum/painter/lvgl/qp_lvgl.h | 25 | ||||
-rw-r--r-- | quantum/painter/lvgl/rules.mk | 24 | ||||
-rw-r--r-- | quantum/painter/qp.h | 7 | ||||
-rw-r--r-- | quantum/painter/qp_draw_image.c | 12 | ||||
-rw-r--r-- | quantum/painter/rules.mk | 6 | ||||
-rw-r--r-- | quantum/process_keycode/process_auto_shift.c | 41 | ||||
-rw-r--r-- | quantum/process_keycode/process_ucis.c | 52 | ||||
-rw-r--r-- | quantum/process_keycode/process_ucis.h | 16 | ||||
-rw-r--r-- | quantum/rgblight/rgblight.h | 17 |
22 files changed, 781 insertions, 276 deletions
diff --git a/quantum/action.c b/quantum/action.c index abf9834d2f..ea6a24ea5c 100644 --- a/quantum/action.c +++ b/quantum/action.c @@ -55,8 +55,8 @@ int retro_tapping_counter = 0; # include "process_auto_shift.h" #endif -#ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY -__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { +#ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY +__attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) { return false; } #endif @@ -484,10 +484,10 @@ void process_action(keyrecord_t *record, action_t action) { default: if (event.pressed) { if (tap_count > 0) { -# if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY) +# if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY) if ( -# ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY - !get_ignore_mod_tap_interrupt(get_event_keycode(record->event, false), record) && +# ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY + get_hold_on_other_key_press(get_event_keycode(record->event, false), record) && # endif record->tap.interrupted) { dprint("mods_tap: tap: cancel: add_mods\n"); diff --git a/quantum/action_tapping.c b/quantum/action_tapping.c index df3317ac05..ca0f31f12e 100644 --- a/quantum/action_tapping.c +++ b/quantum/action_tapping.c @@ -15,6 +15,14 @@ #ifndef NO_ACTION_TAPPING +# if defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY) +# error "IGNORE_MOD_TAP_INTERRUPT_PER_KEY has been removed; the code needs to be ported to use HOLD_ON_OTHER_KEY_PRESS_PER_KEY instead." +# elif !defined(IGNORE_MOD_TAP_INTERRUPT) +# if !defined(PERMISSIVE_HOLD) && !defined(PERMISSIVE_HOLD_PER_KEY) && !defined(HOLD_ON_OTHER_KEY_PRESS) && !defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY) +# pragma message "The default behavior of mod-taps will change to mimic IGNORE_MOD_TAP_INTERRUPT in the future.\nIf you wish to keep the old default behavior of mod-taps, please use HOLD_ON_OTHER_KEY_PRESS." +# endif +# endif + # define IS_TAPPING() !IS_NOEVENT(tapping_key.event) # define IS_TAPPING_PRESSED() (IS_TAPPING() && tapping_key.event.pressed) # define IS_TAPPING_RELEASED() (IS_TAPPING() && !tapping_key.event.pressed) @@ -25,6 +33,7 @@ # define IS_TAPPING_RECORD(r) (IS_TAPPING() && KEYEQ(tapping_key.event.key, (r->event.key)) && tapping_key.keycode == r->keycode) # endif # define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < GET_TAPPING_TERM(get_record_keycode(&tapping_key, false), &tapping_key)) +# define WITHIN_QUICK_TAP_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < GET_QUICK_TAP_TERM(get_record_keycode(&tapping_key, false), &tapping_key)) # ifdef DYNAMIC_TAPPING_TERM_ENABLE uint16_t g_tapping_term = TAPPING_TERM; @@ -40,9 +49,9 @@ __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *r } # endif -# ifdef TAPPING_FORCE_HOLD_PER_KEY -__attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { - return false; +# ifdef QUICK_TAP_TERM_PER_KEY +__attribute__((weak)) uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) { + return QUICK_TAP_TERM; } # endif @@ -117,6 +126,56 @@ void action_tapping_process(keyrecord_t record) { } } +/* Some conditionally defined helper macros to keep process_tapping more + * readable. The conditional definition of tapping_keycode and all the + * conditional uses of it are hidden inside macros named TAP_... + */ +# if (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) || defined(PERMISSIVE_HOLD_PER_KEY) || defined(QUICK_TAP_TERM_PER_KEY) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY) +# define TAP_DEFINE_KEYCODE uint16_t tapping_keycode = get_record_keycode(&tapping_key, false) +# else +# define TAP_DEFINE_KEYCODE +# endif + +# if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) +# ifdef RETRO_TAPPING_PER_KEY +# define TAP_GET_RETRO_TAPPING get_retro_tapping(tapping_keycode, &tapping_key) +# else +# define TAP_GET_RETRO_TAPPING true +# endif +# define MAYBE_RETRO_SHIFTING(ev) (TAP_GET_RETRO_TAPPING && (RETRO_SHIFT + 0) != 0 && TIMER_DIFF_16((ev).time, tapping_key.event.time) < (RETRO_SHIFT + 0)) +# define TAP_IS_LT IS_LT(tapping_keycode) +# define TAP_IS_MT IS_MT(tapping_keycode) +# define TAP_IS_RETRO IS_RETRO(tapping_keycode) +# else +# define TAP_GET_RETRO_TAPPING false +# define MAYBE_RETRO_SHIFTING(ev) false +# define TAP_IS_LT false +# define TAP_IS_MT false +# define TAP_IS_RETRO false +# endif + +# ifdef PERMISSIVE_HOLD_PER_KEY +# define TAP_GET_PERMISSIVE_HOLD get_permissive_hold(tapping_keycode, &tapping_key) +# elif defined(PERMISSIVE_HOLD) +# define TAP_GET_PERMISSIVE_HOLD true +# else +# define TAP_GET_PERMISSIVE_HOLD false +# endif + +# ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY +# define TAP_GET_HOLD_ON_OTHER_KEY_PRESS get_hold_on_other_key_press(tapping_keycode, &tapping_key) +# elif defined(HOLD_ON_OTHER_KEY_PRESS) +# define TAP_GET_HOLD_ON_OTHER_KEY_PRESS true +# else +# define TAP_GET_HOLD_ON_OTHER_KEY_PRESS false +# endif + +# if defined(IGNORE_MOD_TAP_INTERRUPT) +# define TAP_GET_IGNORE_MOD_TAP_INTERRUPT true +# else +# define TAP_GET_IGNORE_MOD_TAP_INTERRUPT false +# endif + /** \brief Tapping * * Rule: Tap key is typed(pressed and released) within TAPPING_TERM. @@ -125,24 +184,11 @@ void action_tapping_process(keyrecord_t record) { /* return true when key event is processed or consumed. */ bool process_tapping(keyrecord_t *keyp) { keyevent_t event = keyp->event; -# if (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) || defined(PERMISSIVE_HOLD_PER_KEY) || defined(TAPPING_FORCE_HOLD_PER_KEY) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY) - uint16_t tapping_keycode = get_record_keycode(&tapping_key, false); -# endif + TAP_DEFINE_KEYCODE; // if tapping if (IS_TAPPING_PRESSED()) { - // clang-format off - if (WITHIN_TAPPING_TERM(event) -# if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) - || ( -# ifdef RETRO_TAPPING_PER_KEY - get_retro_tapping(tapping_keycode, &tapping_key) && -# endif - (RETRO_SHIFT + 0) != 0 && TIMER_DIFF_16(event.time, tapping_key.event.time) < (RETRO_SHIFT + 0) - ) -# endif - ) { - // clang-format on + if (WITHIN_TAPPING_TERM(event) || MAYBE_RETRO_SHIFTING(event)) { if (tapping_key.tap.count == 0) { if (IS_TAPPING_RECORD(keyp) && !event.pressed) { # if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) @@ -164,57 +210,31 @@ bool process_tapping(keyrecord_t *keyp) { * useful for long TAPPING_TERM but may prevent fast typing. */ // clang-format off -# if defined(PERMISSIVE_HOLD) || defined(PERMISSIVE_HOLD_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) else if ( ( - IS_RELEASED(event) && waiting_buffer_typed(event) -# ifdef PERMISSIVE_HOLD_PER_KEY - && get_permissive_hold(tapping_keycode, &tapping_key) -# elif defined(PERMISSIVE_HOLD) - && true -# endif + IS_RELEASED(event) && waiting_buffer_typed(event) && + TAP_GET_PERMISSIVE_HOLD ) // Causes nested taps to not wait past TAPPING_TERM/RETRO_SHIFT // unnecessarily and fixes them for Layer Taps. -# if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) - || ( -# ifdef RETRO_TAPPING_PER_KEY - get_retro_tapping(tapping_keycode, &tapping_key) && -# endif + || (TAP_GET_RETRO_TAPPING && ( // Rolled over the two keys. - ( - ( - false -# if defined(HOLD_ON_OTHER_KEY_PRESS) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY) - || ( - IS_LT(tapping_keycode) -# ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY - && get_hold_on_other_key_press(tapping_keycode, &tapping_key) -# endif - ) -# endif -# if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY) - || ( - IS_MT(tapping_keycode) -# ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY - && !get_ignore_mod_tap_interrupt(tapping_keycode, &tapping_key) -# endif - ) -# endif - ) && tapping_key.tap.interrupted == true + (tapping_key.tap.interrupted == true && ( + (TAP_IS_LT && TAP_GET_HOLD_ON_OTHER_KEY_PRESS) || + (TAP_IS_MT && TAP_GET_HOLD_ON_OTHER_KEY_PRESS) + ) ) // Makes Retro Shift ignore [IGNORE_MOD_TAP_INTERRUPT's // effects on nested taps for MTs and the default // behavior of LTs] below TAPPING_TERM or RETRO_SHIFT. || ( - IS_RETRO(tapping_keycode) + TAP_IS_RETRO && (event.key.col != tapping_key.event.key.col || event.key.row != tapping_key.event.key.row) && IS_RELEASED(event) && waiting_buffer_typed(event) ) ) ) -# endif ) { // clang-format on debug("Tapping: End. No tap. Interfered by typing key\n"); @@ -224,13 +244,12 @@ bool process_tapping(keyrecord_t *keyp) { // enqueue return false; } -# endif /* Process release event of a key pressed before tapping starts * Without this unexpected repeating will occur with having fast repeating setting * https://github.com/tmk/tmk_keyboard/issues/60 */ else if (IS_RELEASED(event) && !waiting_buffer_typed(event)) { - // Modifier should be retained till end of this tapping. + // Modifier/Layer should be retained till end of this tapping. action_t action = layer_switch_get_action(event.key); switch (action.kind.id) { case ACT_LMODS: @@ -243,6 +262,16 @@ bool process_tapping(keyrecord_t *keyp) { if (action.key.mods && keyp->tap.count == 0) return false; if (IS_MOD(action.key.code)) return false; break; + case ACT_LAYER_TAP: + case ACT_LAYER_TAP_EXT: + switch (action.layer_tap.code) { + case 0 ...(OP_TAP_TOGGLE - 1): + case OP_ON_OFF: + case OP_OFF_ON: + case OP_SET_CLEAR: + return false; + } + break; } // Release of key should be process immediately. debug("Tapping: release event of a key pressed before tapping\n"); @@ -252,11 +281,7 @@ bool process_tapping(keyrecord_t *keyp) { // set interrupted flag when other key preesed during tapping if (event.pressed) { tapping_key.tap.interrupted = true; -# if defined(HOLD_ON_OTHER_KEY_PRESS) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY) -# if defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY) - if (get_hold_on_other_key_press(tapping_keycode, &tapping_key)) -# endif - { + if (TAP_GET_HOLD_ON_OTHER_KEY_PRESS) { debug("Tapping: End. No tap. Interfered by pressed key\n"); process_record(&tapping_key); tapping_key = (keyrecord_t){}; @@ -264,7 +289,6 @@ bool process_tapping(keyrecord_t *keyp) { // enqueue return false; } -# endif } // enqueue return false; @@ -357,27 +381,10 @@ bool process_tapping(keyrecord_t *keyp) { } } } else if (IS_TAPPING_RELEASED()) { - // clang-format off - if (WITHIN_TAPPING_TERM(event) -# if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) - || ( -# ifdef RETRO_TAPPING_PER_KEY - get_retro_tapping(tapping_keycode, &tapping_key) && -# endif - (RETRO_SHIFT + 0) != 0 && TIMER_DIFF_16(event.time, tapping_key.event.time) < (RETRO_SHIFT + 0) - ) -# endif - ) { - // clang-format on + if (WITHIN_TAPPING_TERM(event) || MAYBE_RETRO_SHIFTING(event)) { if (event.pressed) { if (IS_TAPPING_RECORD(keyp)) { -//# ifndef TAPPING_FORCE_HOLD -# if !defined(TAPPING_FORCE_HOLD) || defined(TAPPING_FORCE_HOLD_PER_KEY) - if ( -# ifdef TAPPING_FORCE_HOLD_PER_KEY - !get_tapping_force_hold(tapping_keycode, &tapping_key) && -# endif - !tapping_key.tap.interrupted && tapping_key.tap.count > 0) { + if (WITHIN_QUICK_TAP_TERM(event) && !tapping_key.tap.interrupted && tapping_key.tap.count > 0) { // sequential tap. keyp->tap = tapping_key.tap; if (keyp->tap.count < 15) keyp->tap.count += 1; @@ -389,7 +396,6 @@ bool process_tapping(keyrecord_t *keyp) { debug_tapping_key(); return true; } -# endif // FIX: start new tap again tapping_key = *keyp; return true; diff --git a/quantum/action_tapping.h b/quantum/action_tapping.h index bcccc7ac45..c078488c04 100644 --- a/quantum/action_tapping.h +++ b/quantum/action_tapping.h @@ -22,6 +22,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define TAPPING_TERM 200 #endif +/* period of quick tap(ms) */ +#if !defined(QUICK_TAP_TERM) || QUICK_TAP_TERM > TAPPING_TERM +# define QUICK_TAP_TERM TAPPING_TERM +#endif + /* tap count needed for toggling a feature */ #ifndef TAPPING_TOGGLE # define TAPPING_TOGGLE 5 @@ -36,9 +41,9 @@ void action_tapping_process(keyrecord_t record); #endif uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record); +uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record); bool get_permissive_hold(uint16_t keycode, keyrecord_t *record); bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record); -bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record); bool get_retro_tapping(uint16_t keycode, keyrecord_t *record); bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record); @@ -53,3 +58,9 @@ extern uint16_t g_tapping_term; #else # define GET_TAPPING_TERM(keycode, record) (TAPPING_TERM) #endif + +#ifdef QUICK_TAP_TERM_PER_KEY +# define GET_QUICK_TAP_TERM(keycode, record) get_quick_tap_term(keycode, record) +#else +# define GET_QUICK_TAP_TERM(keycode, record) (QUICK_TAP_TERM) +#endif diff --git a/quantum/keymap_extras/keymap_uk.h b/quantum/keymap_extras/keymap_uk.h index 03fe8149f0..a6c42eafbf 100644 --- a/quantum/keymap_extras/keymap_uk.h +++ b/quantum/keymap_extras/keymap_uk.h @@ -1,39 +1,33 @@ -/* Copyright 2015-2016 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/>. - */ +// Copyright 2022 QMK +// SPDX-License-Identifier: GPL-2.0-or-later -#pragma once +/******************************************************************************* + 88888888888 888 d8b .d888 d8b 888 d8b + 888 888 Y8P d88P" Y8P 888 Y8P + 888 888 888 888 + 888 88888b. 888 .d8888b 888888 888 888 .d88b. 888 .d8888b + 888 888 "88b 888 88K 888 888 888 d8P Y8b 888 88K + 888 888 888 888 "Y8888b. 888 888 888 88888888 888 "Y8888b. + 888 888 888 888 X88 888 888 888 Y8b. 888 X88 + 888 888 888 888 88888P' 888 888 888 "Y8888 888 88888P' + 888 888 + 888 888 + 888 888 + .d88b. .d88b. 88888b. .d88b. 888d888 8888b. 888888 .d88b. .d88888 + d88P"88b d8P Y8b 888 "88b d8P Y8b 888P" "88b 888 d8P Y8b d88" 888 + 888 888 88888888 888 888 88888888 888 .d888888 888 88888888 888 888 + Y88b 888 Y8b. 888 888 Y8b. 888 888 888 Y88b. Y8b. Y88b 888 + "Y88888 "Y8888 888 888 "Y8888 888 "Y888888 "Y888 "Y8888 "Y88888 + 888 + Y8b d88P + "Y88P" +*******************************************************************************/ +#pragma once #include "keymap.h" - // clang-format off -/* - * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ - * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ # │ │ - * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ - * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ - * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ - */ -// Row 1 +// Aliases #define UK_GRV KC_GRV // ` #define UK_1 KC_1 // 1 #define UK_2 KC_2 // 2 @@ -47,7 +41,6 @@ #define UK_0 KC_0 // 0 #define UK_MINS KC_MINS // - #define UK_EQL KC_EQL // = -// Row 2 #define UK_Q KC_Q // Q #define UK_W KC_W // W #define UK_E KC_E // E @@ -60,7 +53,6 @@ #define UK_P KC_P // P #define UK_LBRC KC_LBRC // [ #define UK_RBRC KC_RBRC // ] -// Row 3 #define UK_A KC_A // A #define UK_S KC_S // S #define UK_D KC_D // D @@ -73,7 +65,6 @@ #define UK_SCLN KC_SCLN // ; #define UK_QUOT KC_QUOT // ' #define UK_HASH KC_NUHS // # -// Row 4 #define UK_BSLS KC_NUBS // (backslash) #define UK_Z KC_Z // Z #define UK_X KC_X // X @@ -85,21 +76,6 @@ #define UK_COMM KC_COMM // , #define UK_DOT KC_DOT // . #define UK_SLSH KC_SLSH // / - -/* Shifted symbols - * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¬ │ ! │ " │ £ │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ - * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ : │ @ │ ~ │ │ - * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ | │ │ │ │ │ │ │ │ < │ > │ ? │ │ - * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ - * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ - */ -// Row 1 #define UK_NOT S(UK_GRV) // ¬ #define UK_EXLM S(UK_1) // ! #define UK_DQUO S(UK_2) // " @@ -113,39 +89,21 @@ #define UK_RPRN S(UK_0) // ) #define UK_UNDS S(UK_MINS) // _ #define UK_PLUS S(UK_EQL) // + -// Row 2 #define UK_LCBR S(UK_LBRC) // { #define UK_RCBR S(UK_RBRC) // } -// Row 3 #define UK_COLN S(UK_SCLN) // : #define UK_AT S(UK_QUOT) // @ #define UK_TILD S(UK_HASH) // ~ -// Row 4 #define UK_PIPE S(UK_BSLS) // | #define UK_LABK S(UK_COMM) // < #define UK_RABK S(UK_DOT) // > #define UK_QUES S(UK_SLSH) // ? - -/* AltGr symbols - * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¦ │ │ │ │ € │ │ │ │ │ │ │ │ │ │ - * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ É │ │ │ │ Ú │ Í │ Ó │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Á │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ - * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ - */ -// Row 1 #define UK_BRKP ALGR(UK_GRV) // ¦ #define UK_EURO ALGR(UK_4) // € -// Row 2 #define UK_EACU ALGR(KC_E) // É #define UK_UACU ALGR(KC_U) // Ú #define UK_IACU ALGR(KC_I) // Í #define UK_OACU ALGR(KC_O) // Ó -// Row 3 #define UK_AACU ALGR(KC_A) // Á + + diff --git a/quantum/keymap_extras/keymap_us.h b/quantum/keymap_extras/keymap_us.h index b18c701679..c5c5285848 100644 --- a/quantum/keymap_extras/keymap_us.h +++ b/quantum/keymap_extras/keymap_us.h @@ -1,52 +1,55 @@ // Copyright 2022 QMK // SPDX-License-Identifier: GPL-2.0-or-later -#pragma once +/******************************************************************************* + 88888888888 888 d8b .d888 d8b 888 d8b + 888 888 Y8P d88P" Y8P 888 Y8P + 888 888 888 888 + 888 88888b. 888 .d8888b 888888 888 888 .d88b. 888 .d8888b + 888 888 "88b 888 88K 888 888 888 d8P Y8b 888 88K + 888 888 888 888 "Y8888b. 888 888 888 88888888 888 "Y8888b. + 888 888 888 888 X88 888 888 888 Y8b. 888 X88 + 888 888 888 888 88888P' 888 888 888 "Y8888 888 88888P' + 888 888 + 888 888 + 888 888 + .d88b. .d88b. 88888b. .d88b. 888d888 8888b. 888888 .d88b. .d88888 + d88P"88b d8P Y8b 888 "88b d8P Y8b 888P" "88b 888 d8P Y8b d88" 888 + 888 888 88888888 888 888 88888888 888 .d888888 888 88888888 888 888 + Y88b 888 Y8b. 888 888 Y8b. 888 888 888 Y88b. Y8b. Y88b 888 + "Y88888 "Y8888 888 888 "Y8888 888 "Y888888 "Y888 "Y8888 "Y88888 + 888 + Y8b d88P + "Y88P" +*******************************************************************************/ +#pragma once #include "keymap.h" - // clang-format off -/* Shifted symbols - * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ - * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ | │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ : │ " │ │ - * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ - * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ - * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ - */ -// Row 1 +// Aliases #define KC_TILD S(KC_GRAVE) // ~ -#define KC_EXLM S(KC_1) // ! -#define KC_AT S(KC_2) // @ -#define KC_HASH S(KC_3) // # -#define KC_DLR S(KC_4) // $ -#define KC_PERC S(KC_5) // % -#define KC_CIRC S(KC_6) // ^ -#define KC_AMPR S(KC_7) // & -#define KC_ASTR S(KC_8) // * -#define KC_LPRN S(KC_9) // ( -#define KC_RPRN S(KC_0) // ) +#define KC_EXLM S(KC_1) // ! +#define KC_AT S(KC_2) // @ +#define KC_HASH S(KC_3) // # +#define KC_DLR S(KC_4) // $ +#define KC_PERC S(KC_5) // % +#define KC_CIRC S(KC_6) // ^ +#define KC_AMPR S(KC_7) // & +#define KC_ASTR S(KC_8) // * +#define KC_LPRN S(KC_9) // ( +#define KC_RPRN S(KC_0) // ) #define KC_UNDS S(KC_MINUS) // _ #define KC_PLUS S(KC_EQUAL) // + -// Row 2 -#define KC_LCBR S(KC_LEFT_BRACKET) // { +#define KC_LCBR S(KC_LEFT_BRACKET) // { #define KC_RCBR S(KC_RIGHT_BRACKET) // } -#define KC_PIPE S(KC_BACKSLASH) // | -// Row 3 +#define KC_PIPE S(KC_BACKSLASH) // | #define KC_COLN S(KC_SEMICOLON) // : -#define KC_DQUO S(KC_QUOTE) // " -// Row 4 +#define KC_DQUO S(KC_QUOTE) // " #define KC_LABK S(KC_COMMA) // < -#define KC_RABK S(KC_DOT) // > +#define KC_RABK S(KC_DOT) // > #define KC_QUES S(KC_SLASH) // ? -// alias stuff #define KC_TILDE KC_TILD #define KC_EXCLAIM KC_EXLM #define KC_DOLLAR KC_DLR @@ -57,16 +60,14 @@ #define KC_LEFT_PAREN KC_LPRN #define KC_RIGHT_PAREN KC_RPRN #define KC_UNDERSCORE KC_UNDS - #define KC_LEFT_CURLY_BRACE KC_LCBR #define KC_RIGHT_CURLY_BRACE KC_RCBR - #define KC_COLON KC_COLN #define KC_DOUBLE_QUOTE KC_DQUO #define KC_DQT KC_DQUO - #define KC_LEFT_ANGLE_BRACKET KC_LABK #define KC_LT KC_LABK #define KC_RIGHT_ANGLE_BRACKET KC_RABK #define KC_GT KC_RABK #define KC_QUESTION KC_QUES + diff --git a/quantum/main.c b/quantum/main.c index 2d5911b708..3b101c522c 100644 --- a/quantum/main.c +++ b/quantum/main.c @@ -60,9 +60,9 @@ int main(void) { protocol_task(); #ifdef QUANTUM_PAINTER_ENABLE - // Run Quantum Painter animations - void qp_internal_animation_tick(void); - qp_internal_animation_tick(); + // Run Quantum Painter task + void qp_internal_task(void); + qp_internal_task(); #endif #ifdef DEFERRED_EXEC_ENABLE diff --git a/quantum/matrix.c b/quantum/matrix.c index db683104ed..0de65c6cdd 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c @@ -46,6 +46,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define SPLIT_MUTABLE_COL const #endif +#ifndef MATRIX_INPUT_PRESSED_STATE +# define MATRIX_INPUT_PRESSED_STATE 0 +#endif + #ifdef DIRECT_PINS static SPLIT_MUTABLE pin_t direct_pins[ROWS_PER_HAND][MATRIX_COLS] = DIRECT_PINS; #elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW) @@ -93,7 +97,7 @@ static inline void setPinInputHigh_atomic(pin_t pin) { static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return (readPin(pin) == MATRIX_INPUT_PRESSED_STATE) ? 0 : 1; } else { return 1; } @@ -121,9 +125,7 @@ __attribute__((weak)) void matrix_read_cols_on_row(matrix_row_t current_matrix[] matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++, row_shifter <<= 1) { pin_t pin = direct_pins[current_row][col_index]; - if (pin != NO_PIN) { - current_row_value |= readPin(pin) ? 0 : row_shifter; - } + current_row_value |= readMatrixPin(pin) ? 0 : row_shifter; } // Update the matrix diff --git a/quantum/os_detection.c b/quantum/os_detection.c new file mode 100644 index 0000000000..b1511afb14 --- /dev/null +++ b/quantum/os_detection.c @@ -0,0 +1,129 @@ +/* Copyright 2022 Ruslan Sayfutdinov (@KapJI) + * + * 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.o |