2017-09-17 07:33:28 +02:00
|
|
|
/* Copyright 2017 Jeremy Cowgar
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2023-07-11 09:07:24 +02:00
|
|
|
#include "process_auto_shift.h"
|
|
|
|
#include "quantum.h"
|
|
|
|
#include "action_util.h"
|
|
|
|
#include "timer.h"
|
|
|
|
#include "keycodes.h"
|
|
|
|
|
|
|
|
#ifndef AUTO_SHIFT_DISABLED_AT_STARTUP
|
|
|
|
# define AUTO_SHIFT_STARTUP_STATE true /* enabled */
|
|
|
|
#else
|
|
|
|
# define AUTO_SHIFT_STARTUP_STATE false /* disabled */
|
|
|
|
#endif
|
2021-11-01 23:11:55 +01:00
|
|
|
|
2021-11-25 13:12:14 +01:00
|
|
|
// Stores the last Auto Shift key's up or down time, for evaluation or keyrepeat.
|
|
|
|
static uint16_t autoshift_time = 0;
|
2023-07-11 09:07:24 +02:00
|
|
|
#if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
|
2021-11-25 13:12:14 +01:00
|
|
|
// Stores the last key's up or down time, to replace autoshift_time so that Tap Hold times are accurate.
|
|
|
|
static uint16_t retroshift_time = 0;
|
|
|
|
// Stores a possibly Retro Shift key's up or down time, as retroshift_time needs
|
|
|
|
// to be set before the Retro Shift key is evaluated if it is interrupted by an
|
|
|
|
// Auto Shifted key.
|
|
|
|
static uint16_t last_retroshift_time;
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
static uint16_t autoshift_timeout = AUTO_SHIFT_TIMEOUT;
|
|
|
|
static uint16_t autoshift_lastkey = KC_NO;
|
|
|
|
static keyrecord_t autoshift_lastrecord;
|
|
|
|
// Keys take 8 bits if modifiers are excluded. This records the shift state
|
|
|
|
// when pressed for each key, so that can be passed to the release function
|
|
|
|
// and it knows which key needs to be released (if shifted is different base).
|
|
|
|
static uint16_t autoshift_shift_states[((1 << 8) + 15) / 16];
|
2020-11-28 21:02:18 +01:00
|
|
|
static struct {
|
2021-11-25 13:12:14 +01:00
|
|
|
// Whether Auto Shift is enabled.
|
2020-11-28 21:02:18 +01:00
|
|
|
bool enabled : 1;
|
|
|
|
// Whether the last auto-shifted key was released after the timeout. This
|
|
|
|
// is used to replicate the last key for a tap-then-hold.
|
|
|
|
bool lastshifted : 1;
|
|
|
|
// Whether an auto-shiftable key has been pressed but not processed.
|
|
|
|
bool in_progress : 1;
|
|
|
|
// Whether the auto-shifted keypress has been registered.
|
|
|
|
bool holding_shift : 1;
|
2021-11-25 13:12:14 +01:00
|
|
|
// Whether the user is holding a shift and we removed it.
|
|
|
|
bool cancelling_lshift : 1;
|
|
|
|
bool cancelling_rshift : 1;
|
|
|
|
// clang-format wants to remove the true for some reason.
|
|
|
|
// clang-format off
|
|
|
|
} autoshift_flags = {AUTO_SHIFT_STARTUP_STATE, false, false, false, false, false};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
/** \brief Called on physical press, returns whether key should be added to Auto Shift */
|
2022-02-12 19:29:31 +01:00
|
|
|
__attribute__((weak)) bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
return false;
|
|
|
|
}
|
2021-11-25 13:12:14 +01:00
|
|
|
|
2023-09-25 04:45:49 +02:00
|
|
|
/** \brief Called on physical press, returns whether key is an Auto Shift key */
|
2021-11-25 13:12:14 +01:00
|
|
|
__attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
switch (keycode) {
|
2023-07-11 09:07:24 +02:00
|
|
|
#ifndef NO_AUTO_SHIFT_ALPHA
|
2021-11-25 13:12:14 +01:00
|
|
|
case AUTO_SHIFT_ALPHA:
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
|
|
|
#ifndef NO_AUTO_SHIFT_NUMERIC
|
2021-11-25 13:12:14 +01:00
|
|
|
case AUTO_SHIFT_NUMERIC:
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
|
|
|
#ifndef NO_AUTO_SHIFT_SPECIAL
|
|
|
|
# ifndef NO_AUTO_SHIFT_TAB
|
2023-07-07 13:52:24 +02:00
|
|
|
case KC_TAB:
|
2023-07-11 09:07:24 +02:00
|
|
|
# endif
|
|
|
|
# ifndef NO_AUTO_SHIFT_SYMBOLS
|
2023-07-07 13:52:24 +02:00
|
|
|
case AUTO_SHIFT_SYMBOLS:
|
|
|
|
# endif
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
|
|
|
#ifdef AUTO_SHIFT_ENTER
|
2023-07-07 13:52:24 +02:00
|
|
|
case KC_ENT:
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return get_custom_auto_shifted_key(keycode, record);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** \brief Called to check whether defines should apply if PER_KEY is set for it */
|
2022-02-12 19:29:31 +01:00
|
|
|
__attribute__((weak)) bool get_auto_shift_repeat(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
__attribute__((weak)) bool get_auto_shift_no_auto_repeat(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
return true;
|
|
|
|
}
|
2021-11-25 13:12:14 +01:00
|
|
|
|
|
|
|
/** \brief Called when an Auto Shift key needs to be pressed */
|
|
|
|
__attribute__((weak)) void autoshift_press_user(uint16_t keycode, bool shifted, keyrecord_t *record) {
|
|
|
|
if (shifted) {
|
|
|
|
add_weak_mods(MOD_BIT(KC_LSFT));
|
|
|
|
}
|
|
|
|
register_code16((IS_RETRO(keycode)) ? keycode & 0xFF : keycode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** \brief Called when an Auto Shift key needs to be released */
|
2022-02-12 19:29:31 +01:00
|
|
|
__attribute__((weak)) void autoshift_release_user(uint16_t keycode, bool shifted, keyrecord_t *record) {
|
|
|
|
unregister_code16((IS_RETRO(keycode)) ? keycode & 0xFF : keycode);
|
|
|
|
}
|
2021-11-25 13:12:14 +01:00
|
|
|
|
|
|
|
/** \brief Sets the shift state to use when keyrepeating, required by custom shifts */
|
|
|
|
void set_autoshift_shift_state(uint16_t keycode, bool shifted) {
|
|
|
|
keycode = keycode & 0xFF;
|
|
|
|
if (shifted) {
|
|
|
|
autoshift_shift_states[keycode / 16] |= (uint16_t)1 << keycode % 16;
|
|
|
|
} else {
|
|
|
|
autoshift_shift_states[keycode / 16] &= ~((uint16_t)1 << keycode % 16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** \brief Gets the shift state to use when keyrepeating, required by custom shifts */
|
|
|
|
bool get_autoshift_shift_state(uint16_t keycode) {
|
|
|
|
keycode = keycode & 0xFF;
|
|
|
|
return (autoshift_shift_states[keycode / 16] & (uint16_t)1 << keycode % 16) != (uint16_t)0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** \brief Restores the shift key if it was cancelled by Auto Shift */
|
|
|
|
static void autoshift_flush_shift(void) {
|
|
|
|
autoshift_flags.holding_shift = false;
|
2023-07-11 09:07:24 +02:00
|
|
|
#ifdef CAPS_WORD_ENABLE
|
2022-08-13 15:48:51 +02:00
|
|
|
if (!is_caps_word_on())
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif // CAPS_WORD_ENABLE
|
2022-08-13 15:48:51 +02:00
|
|
|
{
|
|
|
|
del_weak_mods(MOD_BIT(KC_LSFT));
|
|
|
|
}
|
2021-11-25 13:12:14 +01:00
|
|
|
if (autoshift_flags.cancelling_lshift) {
|
|
|
|
autoshift_flags.cancelling_lshift = false;
|
|
|
|
add_mods(MOD_BIT(KC_LSFT));
|
|
|
|
}
|
|
|
|
if (autoshift_flags.cancelling_rshift) {
|
|
|
|
autoshift_flags.cancelling_rshift = false;
|
|
|
|
add_mods(MOD_BIT(KC_RSFT));
|
|
|
|
}
|
|
|
|
send_keyboard_report();
|
|
|
|
}
|
2020-11-28 21:02:18 +01:00
|
|
|
|
|
|
|
/** \brief Record the press of an autoshiftable key
|
|
|
|
*
|
|
|
|
* \return Whether the record should be further processed.
|
|
|
|
*/
|
|
|
|
static bool autoshift_press(uint16_t keycode, uint16_t now, keyrecord_t *record) {
|
2021-11-25 13:12:14 +01:00
|
|
|
// clang-format off
|
|
|
|
if ((get_mods()
|
2023-07-11 09:07:24 +02:00
|
|
|
#if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING)
|
2021-11-25 13:12:14 +01:00
|
|
|
| get_oneshot_mods()
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
) & (~MOD_BIT(KC_LSFT))
|
|
|
|
) {
|
|
|
|
// clang-format on
|
|
|
|
// Prevents keyrepeating unshifted value of key after using it in a key combo.
|
|
|
|
autoshift_lastkey = KC_NO;
|
2023-07-11 09:07:24 +02:00
|
|
|
#ifndef AUTO_SHIFT_MODIFIERS
|
2021-11-25 13:12:14 +01:00
|
|
|
// We can't return true here anymore because custom unshifted values are
|
|
|
|
// possible and there's no good way to tell whether the press returned
|
|
|
|
// true upon release.
|
|
|
|
set_autoshift_shift_state(keycode, false);
|
|
|
|
autoshift_press_user(keycode, false, record);
|
2023-07-11 09:07:24 +02:00
|
|
|
# if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING)
|
2021-11-25 13:12:14 +01:00
|
|
|
set_oneshot_mods(get_oneshot_mods() & (~MOD_BIT(KC_LSFT)));
|
|
|
|
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
|
2020-11-28 21:02:18 +01:00
|
|
|
# endif
|
2023-07-11 09:07:24 +02:00
|
|
|
return false;
|
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Store record to be sent to user functions if there's no release record then.
|
2023-09-25 04:45:49 +02:00
|
|
|
autoshift_lastrecord = *record;
|
|
|
|
autoshift_lastrecord.event.time = 0;
|
2021-11-25 13:12:14 +01:00
|
|
|
// clang-format off
|
2023-07-11 09:07:24 +02:00
|
|
|
#if defined(AUTO_SHIFT_REPEAT) || defined(AUTO_SHIFT_REPEAT_PER_KEY)
|
2021-11-25 13:12:14 +01:00
|
|
|
if (keycode == autoshift_lastkey &&
|
2023-07-11 09:07:24 +02:00
|
|
|
# ifdef AUTO_SHIFT_REPEAT_PER_KEY
|
2021-11-25 13:12:14 +01:00
|
|
|
get_auto_shift_repeat(autoshift_lastkey, record) &&
|
2023-07-11 09:07:24 +02:00
|
|
|
# endif
|
|
|
|
# if !defined(AUTO_SHIFT_NO_AUTO_REPEAT) || defined(AUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY)
|
2021-11-25 13:12:14 +01:00
|
|
|
(
|
|
|
|
!autoshift_flags.lastshifted
|
2023-07-11 09:07:24 +02:00
|
|
|
# ifdef AUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY
|
2021-11-25 13:12:14 +01:00
|
|
|
|| get_auto_shift_no_auto_repeat(autoshift_lastkey, record)
|
|
|
|
# endif
|
2023-07-11 09:07:24 +02:00
|
|
|
) &&
|
|
|
|
# endif
|
2022-04-16 20:24:09 +02:00
|
|
|
TIMER_DIFF_16(now, autoshift_time) < GET_TAPPING_TERM(autoshift_lastkey, record)
|
2021-11-25 13:12:14 +01:00
|
|
|
) {
|
|
|
|
// clang-format on
|
|
|
|
// Allow a tap-then-hold for keyrepeat.
|
|
|
|
if (get_mods() & MOD_BIT(KC_LSFT)) {
|
|
|
|
autoshift_flags.cancelling_lshift = true;
|
|
|
|
del_mods(MOD_BIT(KC_LSFT));
|
2020-11-28 21:02:18 +01:00
|
|
|
}
|
2021-11-25 13:12:14 +01:00
|
|
|
if (get_mods() & MOD_BIT(KC_RSFT)) {
|
|
|
|
autoshift_flags.cancelling_rshift = true;
|
|
|
|
del_mods(MOD_BIT(KC_RSFT));
|
|
|
|
}
|
|
|
|
// autoshift_shift_state doesn't need to be changed.
|
|
|
|
autoshift_press_user(autoshift_lastkey, autoshift_flags.lastshifted, record);
|
|
|
|
return false;
|
2020-11-28 21:02:18 +01:00
|
|
|
}
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2017-09-17 07:33:28 +02:00
|
|
|
|
2021-11-25 13:12:14 +01:00
|
|
|
// Use physical shift state of press event to be more like normal typing.
|
2023-07-11 09:07:24 +02:00
|
|
|
#if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING)
|
2021-11-25 13:12:14 +01:00
|
|
|
autoshift_flags.lastshifted = (get_mods() | get_oneshot_mods()) & MOD_BIT(KC_LSFT);
|
|
|
|
set_oneshot_mods(get_oneshot_mods() & (~MOD_BIT(KC_LSFT)));
|
2023-07-11 09:07:24 +02:00
|
|
|
#else
|
2021-11-25 13:12:14 +01:00
|
|
|
autoshift_flags.lastshifted = get_mods() & MOD_BIT(KC_LSFT);
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2020-11-28 21:02:18 +01:00
|
|
|
// Record the keycode so we can simulate it later.
|
|
|
|
autoshift_lastkey = keycode;
|
|
|
|
autoshift_time = now;
|
|
|
|
autoshift_flags.in_progress = true;
|
2017-09-17 07:33:28 +02:00
|
|
|
|
2023-07-11 09:07:24 +02:00
|
|
|
#if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING)
|
2020-11-28 21:02:18 +01:00
|
|
|
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2020-11-28 21:02:18 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** \brief Registers an autoshiftable key under the right conditions
|
|
|
|
*
|
2021-11-25 13:12:14 +01:00
|
|
|
* If autoshift_timeout has elapsed, register a shift and the key.
|
2020-11-28 21:02:18 +01:00
|
|
|
*
|
2021-11-25 13:12:14 +01:00
|
|
|
* If the Auto Shift key is released before the delay has elapsed, register the
|
2020-11-28 21:02:18 +01:00
|
|
|
* key without a shift.
|
2021-11-25 13:12:14 +01:00
|
|
|
*
|
|
|
|
* Called on key down with keycode=KC_NO, auto-shifted key up, and timeout.
|
2020-11-28 21:02:18 +01:00
|
|
|
*/
|
2021-11-25 13:12:14 +01:00
|
|
|
static void autoshift_end(uint16_t keycode, uint16_t now, bool matrix_trigger, keyrecord_t *record) {
|
|
|
|
if (autoshift_flags.in_progress && (keycode == autoshift_lastkey || keycode == KC_NO)) {
|
2020-11-28 21:02:18 +01:00
|
|
|
// Process the auto-shiftable key.
|
|
|
|
autoshift_flags.in_progress = false;
|
2021-11-25 13:12:14 +01:00
|
|
|
// clang-format off
|
|
|
|
autoshift_flags.lastshifted =
|
|
|
|
autoshift_flags.lastshifted
|
|
|
|
|| TIMER_DIFF_16(now, autoshift_time) >=
|
2023-07-11 09:07:24 +02:00
|
|
|
#ifdef AUTO_SHIFT_TIMEOUT_PER_KEY
|
2021-11-25 13:12:14 +01:00
|
|
|
get_autoshift_timeout(autoshift_lastkey, record)
|
2023-07-11 09:07:24 +02:00
|
|
|
#else
|
2021-11-25 13:12:14 +01:00
|
|
|
autoshift_timeout
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
;
|
|
|
|
// clang-format on
|
|
|
|
set_autoshift_shift_state(autoshift_lastkey, autoshift_flags.lastshifted);
|
|
|
|
if (get_mods() & MOD_BIT(KC_LSFT)) {
|
|
|
|
autoshift_flags.cancelling_lshift = true;
|
|
|
|
del_mods(MOD_BIT(KC_LSFT));
|
|
|
|
}
|
|
|
|
if (get_mods() & MOD_BIT(KC_RSFT)) {
|
|
|
|
autoshift_flags.cancelling_rshift = true;
|
|
|
|
del_mods(MOD_BIT(KC_RSFT));
|
2019-08-30 20:19:03 +02:00
|
|
|
}
|
2021-11-25 13:12:14 +01:00
|
|
|
autoshift_press_user(autoshift_lastkey, autoshift_flags.lastshifted, record);
|
2017-09-17 07:33:28 +02:00
|
|
|
|
2021-11-25 13:12:14 +01:00
|
|
|
// clang-format off
|
2023-07-11 09:07:24 +02:00
|
|
|
#if (defined(AUTO_SHIFT_REPEAT) || defined(AUTO_SHIFT_REPEAT_PER_KEY)) && (!defined(AUTO_SHIFT_NO_AUTO_REPEAT) || defined(AUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY))
|
2021-11-25 13:12:14 +01:00
|
|
|
if (matrix_trigger
|
2023-07-11 09:07:24 +02:00
|
|
|
# ifdef AUTO_SHIFT_REPEAT_PER_KEY
|
2021-11-25 13:12:14 +01:00
|
|
|
&& get_auto_shift_repeat(autoshift_lastkey, record)
|
2023-07-11 09:07:24 +02:00
|
|
|
# endif
|
|
|
|
# ifdef AUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY
|
2021-11-25 13:12:14 +01:00
|
|
|
&& !get_auto_shift_no_auto_repeat(autoshift_lastkey, record)
|
2023-07-11 09:07:24 +02:00
|
|
|
# endif
|
2021-11-25 13:12:14 +01:00
|
|
|
) {
|
|
|
|
// Prevents release.
|
|
|
|
return;
|
|
|
|
}
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
// clang-format on
|
2023-07-11 09:07:24 +02:00
|
|
|
#if TAP_CODE_DELAY > 0
|
2020-11-28 21:02:18 +01:00
|
|
|
wait_ms(TAP_CODE_DELAY);
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
|
|
|
|
autoshift_release_user(autoshift_lastkey, autoshift_flags.lastshifted, record);
|
|
|
|
autoshift_flush_shift();
|
2020-11-28 21:02:18 +01:00
|
|
|
} else {
|
|
|
|
// Release after keyrepeat.
|
2021-11-25 13:12:14 +01:00
|
|
|
autoshift_release_user(keycode, get_autoshift_shift_state(keycode), record);
|
2020-11-28 21:02:18 +01:00
|
|
|
if (keycode == autoshift_lastkey) {
|
|
|
|
// This will only fire when the key was the last auto-shiftable
|
2021-11-25 13:12:14 +01:00
|
|
|
// pressed. That prevents 'aaaaBBBB' then releasing a from unshifting
|
|
|
|
// later 'B's (if 'B' wasn't auto-shiftable).
|
|
|
|
autoshift_flush_shift();
|
2020-11-28 21:02:18 +01:00
|
|
|
}
|
2019-08-30 20:19:03 +02:00
|
|
|
}
|
2020-11-28 21:02:18 +01:00
|
|
|
// Roll the autoshift_time forward for detecting tap-and-hold.
|
|
|
|
autoshift_time = now;
|
2017-09-17 07:33:28 +02:00
|
|
|
}
|
|
|
|
|
2020-11-28 21:02:18 +01:00
|
|
|
/** \brief Simulates auto-shifted key releases when timeout is hit
|
|
|
|
*
|
|
|
|
* Can be called from \c matrix_scan_user so that auto-shifted keys are sent
|
|
|
|
* immediately after the timeout has expired, rather than waiting for the key
|
|
|
|
* to be released.
|
|
|
|
*/
|
|
|
|
void autoshift_matrix_scan(void) {
|
|
|
|
if (autoshift_flags.in_progress) {
|
2021-11-25 13:12:14 +01:00
|
|
|
const uint16_t now = timer_read();
|
|
|
|
if (TIMER_DIFF_16(now, autoshift_time) >=
|
2023-07-11 09:07:24 +02:00
|
|
|
#ifdef AUTO_SHIFT_TIMEOUT_PER_KEY
|
2021-11-25 13:12:14 +01:00
|
|
|
get_autoshift_timeout(autoshift_lastkey, &autoshift_lastrecord)
|
2023-07-11 09:07:24 +02:00
|
|
|
#else
|
2021-11-25 13:12:14 +01:00
|
|
|
autoshift_timeout
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
) {
|
|
|
|
autoshift_end(autoshift_lastkey, now, true, &autoshift_lastrecord);
|
2020-11-28 21:02:18 +01:00
|
|
|
}
|
|
|
|
}
|
2020-08-15 22:55:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void autoshift_toggle(void) {
|
2020-11-28 21:02:18 +01:00
|
|
|
autoshift_flags.enabled = !autoshift_flags.enabled;
|
2021-11-25 13:12:14 +01:00
|
|
|
autoshift_flush_shift();
|
2017-12-19 19:37:25 +01:00
|
|
|
}
|
|
|
|
|
2022-02-12 19:29:31 +01:00
|
|
|
void autoshift_enable(void) {
|
|
|
|
autoshift_flags.enabled = true;
|
|
|
|
}
|
2020-11-28 21:02:18 +01:00
|
|
|
|
2020-08-15 22:55:13 +02:00
|
|
|
void autoshift_disable(void) {
|
2020-11-28 21:02:18 +01:00
|
|
|
autoshift_flags.enabled = false;
|
2021-11-25 13:12:14 +01:00
|
|
|
autoshift_flush_shift();
|
2017-12-19 19:37:25 +01:00
|
|
|
}
|
|
|
|
|
2023-07-11 09:07:24 +02:00
|
|
|
#ifndef AUTO_SHIFT_NO_SETUP
|
2020-08-15 22:55:13 +02:00
|
|
|
void autoshift_timer_report(void) {
|
2023-07-11 09:07:24 +02:00
|
|
|
# ifdef SEND_STRING_ENABLE
|
2022-10-05 19:42:05 +02:00
|
|
|
const char *autoshift_timeout_str = get_u16_str(autoshift_timeout, ' ');
|
|
|
|
// Skip padding spaces
|
|
|
|
while (*autoshift_timeout_str == ' ') {
|
|
|
|
autoshift_timeout_str++;
|
|
|
|
}
|
|
|
|
send_string(autoshift_timeout_str);
|
2020-08-30 00:57:48 +02:00
|
|
|
# endif
|
2023-07-11 09:07:24 +02:00
|
|
|
}
|
|
|
|
#endif
|
2020-08-15 22:55:13 +02:00
|
|
|
|
2022-02-12 19:29:31 +01:00
|
|
|
bool get_autoshift_state(void) {
|
|
|
|
return autoshift_flags.enabled;
|
|
|
|
}
|
2017-12-19 19:06:22 +01:00
|
|
|
|
2023-01-20 17:21:17 +01:00
|
|
|
uint16_t get_generic_autoshift_timeout(void) {
|
2022-02-12 19:29:31 +01:00
|
|
|
return autoshift_timeout;
|
|
|
|
}
|
|
|
|
__attribute__((weak)) uint16_t get_autoshift_timeout(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
return autoshift_timeout;
|
|
|
|
}
|
2019-08-30 20:19:03 +02:00
|
|
|
|
2022-02-12 19:29:31 +01:00
|
|
|
void set_autoshift_timeout(uint16_t timeout) {
|
|
|
|
autoshift_timeout = timeout;
|
|
|
|
}
|
2019-11-03 18:52:01 +01:00
|
|
|
|
|
|
|
bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
|
2020-11-28 21:02:18 +01:00
|
|
|
// Note that record->event.time isn't reliable, see:
|
|
|
|
// https://github.com/qmk/qmk_firmware/pull/9826#issuecomment-733559550
|
2021-11-25 13:12:14 +01:00
|
|
|
// clang-format off
|
|
|
|
const uint16_t now =
|
2023-07-11 09:07:24 +02:00
|
|
|
#if !defined(RETRO_SHIFT) || defined(NO_ACTION_TAPPING)
|
2021-11-25 13:12:14 +01:00
|
|
|
timer_read()
|
2023-07-11 09:07:24 +02:00
|
|
|
#else
|
2021-11-25 13:12:14 +01:00
|
|
|
(record->event.pressed) ? retroshift_time : timer_read()
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
;
|
|
|
|
// clang-format on
|
2020-11-28 21:02:18 +01:00
|
|
|
|
2019-08-30 20:19:03 +02:00
|
|
|
if (record->event.pressed) {
|
2020-11-28 21:02:18 +01:00
|
|
|
if (autoshift_flags.in_progress) {
|
2021-11-25 13:12:14 +01:00
|
|
|
// Evaluate previous key if there is one.
|
|
|
|
autoshift_end(KC_NO, now, false, &autoshift_lastrecord);
|
2020-11-28 21:02:18 +01:00
|
|
|
}
|
|
|
|
|
2019-08-30 20:19:03 +02:00
|
|
|
switch (keycode) {
|
2022-10-28 14:53:15 +02:00
|
|
|
case AS_TOGG:
|
2019-08-30 20:19:03 +02:00
|
|
|
autoshift_toggle();
|
2021-11-25 13:12:14 +01:00
|
|
|
break;
|
2022-10-28 14:53:15 +02:00
|
|
|
case AS_ON:
|
2019-08-30 20:19:03 +02:00
|
|
|
autoshift_enable();
|
2021-11-25 13:12:14 +01:00
|
|
|
break;
|
2022-10-28 14:53:15 +02:00
|
|
|
case AS_OFF:
|
2019-08-30 20:19:03 +02:00
|
|
|
autoshift_disable();
|
2021-11-25 13:12:14 +01:00
|
|
|
break;
|
2019-08-30 20:19:03 +02:00
|
|
|
|
2023-07-11 09:07:24 +02:00
|
|
|
#ifndef AUTO_SHIFT_NO_SETUP
|
2022-10-28 14:53:15 +02:00
|
|
|
case AS_UP:
|
2020-08-15 22:55:13 +02:00
|
|
|
autoshift_timeout += 5;
|
2021-11-25 13:12:14 +01:00
|
|
|
break;
|
2022-10-28 14:53:15 +02:00
|
|
|
case AS_DOWN:
|
2020-08-15 22:55:13 +02:00
|
|
|
autoshift_timeout -= 5;
|
2021-11-25 13:12:14 +01:00
|
|
|
break;
|
2022-10-28 14:53:15 +02:00
|
|
|
case AS_RPT:
|
2020-08-15 22:55:13 +02:00
|
|
|
autoshift_timer_report();
|
2021-11-25 13:12:14 +01:00
|
|
|
break;
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
}
|
2022-12-13 12:20:07 +01:00
|
|
|
// If Retro Shift is disabled, possible custom actions shouldn't happen.
|
|
|
|
// clang-format off
|
2023-07-11 09:07:24 +02:00
|
|
|
#if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
|
2023-09-25 04:45:49 +02:00
|
|
|
# ifdef HOLD_ON_OTHER_KEY_PRESS
|
|
|
|
const bool is_hold_on_interrupt = (IS_QK_MOD_TAP(keycode)
|
|
|
|
# ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
|
|
|
|
&& get_hold_on_other_key_press(keycode, record)
|
|
|
|
# endif
|
|
|
|
);
|
2023-07-11 09:07:24 +02:00
|
|
|
# else
|
2023-04-03 07:32:47 +02:00
|
|
|
const bool is_hold_on_interrupt = false;
|
2023-07-11 09:07:24 +02:00
|
|
|
# endif
|
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
if (IS_RETRO(keycode)
|
2023-07-11 09:07:24 +02:00
|
|
|
#if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
|
2021-11-25 13:12:14 +01:00
|
|
|
// Not tapped or #defines mean that rolls should use hold action.
|
|
|
|
&& (
|
|
|
|
record->tap.count == 0
|
2023-07-11 09:07:24 +02:00
|
|
|
# ifdef RETRO_TAPPING_PER_KEY
|
2021-11-25 13:12:14 +01:00
|
|
|
|| !get_retro_tapping(keycode, record)
|
|
|
|
# endif
|
2023-07-11 09:07:24 +02:00
|
|
|
|| (record->tap.interrupted && is_hold_on_interrupt))
|
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
) {
|
|
|
|
// clang-format on
|
|
|
|
autoshift_lastkey = KC_NO;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (keycode == KC_LSFT) {
|
|
|
|
autoshift_flags.cancelling_lshift = false;
|
|
|
|
} else if (keycode == KC_RSFT) {
|
|
|
|
autoshift_flags.cancelling_rshift = false;
|
|
|
|
}
|
|
|
|
// Same as above (for pressed), additional checks are not needed because
|
|
|
|
// tap.count gets set to 0 in process_action
|
|
|
|
// clang-format off
|
|
|
|
else if (IS_RETRO(keycode)
|
2023-07-11 09:07:24 +02:00
|
|
|
#if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
|
2021-11-25 13:12:14 +01:00
|
|
|
&& (
|
|
|
|
record->tap.count == 0
|
2023-07-11 09:07:24 +02:00
|
|
|
# ifdef RETRO_TAPPING_PER_KEY
|
2021-11-25 13:12:14 +01:00
|
|
|
|| !get_retro_tapping(keycode, record)
|
2020-08-15 22:55:13 +02:00
|
|
|
# endif
|
2023-07-11 09:07:24 +02:00
|
|
|
)
|
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
) {
|
|
|
|
// Fixes modifiers not being applied to rolls with AUTO_SHIFT_MODIFIERS set.
|
2023-09-25 04:45:49 +02:00
|
|
|
#ifdef HOLD_ON_OTHER_KEY_PRESS
|
|
|
|
if (autoshift_flags.in_progress
|
|
|
|
# ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
|
|
|
|
&& get_hold_on_other_key_press(keycode, record)
|
|
|
|
# endif
|
|
|
|
) {
|
2021-11-25 13:12:14 +01:00
|
|
|
autoshift_end(KC_NO, now, false, &autoshift_lastrecord);
|
|
|
|
}
|
2023-07-11 09:07:24 +02:00
|
|
|
#endif
|
2021-11-25 13:12:14 +01:00
|
|
|
// clang-format on
|
|
|
|
return true;
|
2020-11-28 21:02:18 +01:00
|
|
|
}
|
|
|
|
}
|
2021-11-25 13:12:14 +01:00
|
|
|
|
|
|
|
if (!autoshift_flags.enabled) {
|
|
|
|
return true;
|
|
|
|
}
|
2021 May 29 Breaking Changes Update (#13034)
* Add Per Key functionality for AutoShift (#11536)
* LED Matrix: Reactive effect buffers & advanced indicators (#12588)
* [Keyboard] kint36: switch to sym_eager_pk debouncing (#12626)
* [Keyboard] kint2pp: reduce input latency by ≈10ms (#12625)
* LED Matrix: Split (#12633)
* [CI] Format code according to conventions (#12650)
* feat: infinite timeout for leader key (#6580)
* feat: implement leader_no_timeout logic
* docs(leader_key): infinite leader timeout docs
* Format code according to conventions (#12680)
* Update ADC driver for STM32F1xx, STM32F3xx, STM32F4xx (#12403)
* Fix default ADC_RESOLUTION for ADCv3 (and ADCv4)
Recent ChibiOS update removed ADC_CFGR1_RES_10BIT from the ADCv3 headers
(that macro should not have been there, because ADCv3 has CFGR instead of
CFGR1). Fix the default value for ADC_RESOLUTION to use ADC_CFGR_RES_10BITS
if it is defined (that name is used for ADCv3 and ADCv4).
* Update ADC docs to match the actually used resolution
ADC driver for ChibiOS actually uses the 10-bit resolution by default
(probably to match AVR); fix the documentation accordingly. Also add
both ADC_CFGR_RES_10BITS and ADC_CFGR1_RES_10BIT constants (these names
differ according to the ADC implementation in the particular MCU).
* Fix pinToMux() for B12 and B13 on STM32F3xx
Testing on STM32F303CCT6 revealed that the ADC mux values for B12 and
B13 pins were wrong.
* Add support for all possible analog pins on STM32F1xx
Added ADC mux values for pins A0...A7, B0, B1, C0...C5 on STM32F1xx
(they are the same at least for STM32F103x8 and larger F103 devices, and
also F102, F105, F107 families). Actually tested on STM32F103C8T6
(therefore pins C0...C5 were not tested).
Pins F6...F10, which are present on STM32F103x[C-G] in 144-pin packages,
cannot be supported at the moment, because those pins are connected only
to ADC3, but the ChibiOS ADC driver for STM32F1xx supports only ADC1.
* Add support for all possible analog pins on STM32F4xx
Added ADC mux values for pins A0...A7, B0, B1, C0...C5 and optionally
F3...F10 (if STM32_ADC_USE_ADC3 is enabled). These mux values are
apparently the same for all F4xx devices, except some smaller devices may
not have ADC3.
Actually tested on STM32F401CCU6, STM32F401CEU6, STM32F411CEU6 (using
various WeAct “Blackpill” boards); only pins A0...A7, B0, B1 were tested.
Pins F3...F10 are inside `#if STM32_ADC_USE_ADC3` because some devices
which don't have ADC3 also don't have the GPIOF port, therefore the code
which refers to Fx pins does not compile.
* Fix STM32F3xx ADC mux table in documentation
The ADC driver documentation had some errors in the mux table for STM32F3xx.
Fix this table to match the datasheet and the actual code (mux settings for
B12 and B13 were also tested on a real STM32F303CCT6 chip).
* Add STM32F1xx ADC pins to the documentation
* Add STM32F4xx ADC pins to the documentation
* Add initial support for tinyuf2 bootloader (when hosted on F411 blackpill) (#12600)
* Add support for jumping to tinyuf2 bootloader. Adds blackpill UF2 example.
* Update flashing.md
* Update chconf.h
* Update config.h
* Update halconf.h
* Update mcuconf.h
* eeprom driver: Refactor where eeprom driver initialisation (and EEPROM emulation initialisation) occurs to make it non-target-specific. (#12671)
* Add support for MCU = STM32F446 (#12619)
* Add support for MCU = STM32F446
* Update platforms/chibios/GENERIC_STM32_F446XE/configs/config.h
* Restore mcuconf.h to the one used by RT-STM32F446RE-NUCLEO64
* stm32f446: update mcuconf.h and board.h for 16MHz operation, with USB enabled, and other peripherals disabled.
* Format code according to conventions (#12682)
* Format code according to conventions (#12687)
* Add STM32L433 and L443 support (#12063)
* initial L433 commit
* change to XC
* fix L433
* disable all peripherals
* update system and peripheral clocks
* 433 change
* use its own board files
* revert its own board files
* l433 specific change
* fix stm32l432xx define
* remove duplicate #define
* fix bootloader jump
* move to L443xx and add i2c2, spi2, usart3 to mcuconf.h
* move to L443
* move to L443
* fix sdmmc in mcuconf.h
* include STM32L443
* add L443
* Include L443 in compatible microcontrollers
* Include L443 in compatible microcontrollers
* Update config bootloader jump description
* Update ChibiOS define reasoning
* Update quantum/mcu_selection.mk
* fix git conflict
* Updated Function96 with V2 files and removed chconf.h and halconf.h (#12613)
* Fix bad PR merge for #6580. (#12721)
* Change RGB/LED Matrix to use a simple define for USB suspend (#12697)
* [CI] Format code according to conventions (#12731)
* Fixing transport's led/rgb matrix suspend state logic (#12770)
* [CI] Format code according to conventions (#12772)
* Fix comment parsing (#12750)
* Added OLED fade out support (#12086)
* fix some references to bin/qmk that slipped in (#12832)
* Resolve a number of warnings in `qmk generate-api` (#12833)
* New command: qmk console (#12828)
* stash poc
* stash
* tidy up implementation
* Tidy up slightly for review
* Tidy up slightly for review
* Bodge environment to make tests pass
* Refactor away from asyncio due to windows issues
* Filter devices
* align vid/pid printing
* Add hidapi to the installers
* start preparing for multiple hid_listeners
* udev rules for hid_listen
* refactor to move closer to end state
* very basic implementation of the threaded model
* refactor how vid/pid/index are supplied and parsed
* windows improvements
* read the report directly when usage page isn't available
* add per-device colors, the choice to show names or numbers, and refactor
* add timestamps
* Add support for showing bootloaders
* tweak the color for bootloaders
* Align bootloader disconnect with connect color
* add support for showing all bootloaders
* fix the pyusb check
* tweaks
* fix exception
* hide a stack trace behind -v
* add --no-bootloaders option
* add documentation for qmk console
* Apply suggestions from code review
* pyformat
* clean up and flesh out KNOWN_BOOTLOADERS
* Remove pointless SERIAL_LINK_ENABLE rules (#12846)
* Make Swap Hands use PROGMEM (#12284)
This converts the array that the Swap Hands feature uses to use PROGMEM,
and to read from that array, as such. Since this array never changes at
runtime, there is no reason to keep it in memory. Especially for AVR
boards, as memory is a precious resource.
* Fix another bin/qmk reference (#12856)
* [Keymap] Turn OLED off on suspend in soundmonster keymap (#10419)
* Fixup build errors on `develop` branch. (#12723)
* LED Matrix: Effects! (#12651)
* Fix syntax error when compiling for ARM (#12866)
* Remove KEYMAP and LAYOUT_kc (#12160)
* alias KEYMAP to LAYOUT
* remove KEYMAP and LAYOUT_kc
* Add setup, clone, and env to the list of commands we allow even with broken modules (#12868)
* Rename `point_t` -> `led_point_t` (#12864)
* [Keyboard] updated a vendor name / fixed minor keymap issues (#12881)
* Add missing LED Matrix suspend code to suspend.c (#12878)
* LED Matrix: Documentation (#12685)
* Deprecate `send_unicode_hex_string()` (#12602)
* Fix spelling mistake regarding LED Matrix in split_common. (#12888)
* [Keymap] Fix QWERTY/DVORAK status output for kzar keymap (#12895)
* Use milc.subcommand.config instead of qmk.cli.config (#12915)
* Use milc.subcommand.config instead
* pyformat
* remove the config test
* Add function to allow repeated blinking of one layer (#12237)
* Implement function rgblight_blink_layer_repeat to allow repeated blinking of one layer at a time
* Update doc
* Rework rgblight blinking according to requested change
* optimize storage
* Fixup housekeeping from being invoked twice per loop. (#12933)
* matrix: wait for row signal to go HIGH for every row (#12945)
I noticed this discrepancy (last row of the matrix treated differently than the
others) when optimizing the input latency of my keyboard controller, see also
https://michael.stapelberg.ch/posts/2021-05-08-keyboard-input-latency-qmk-kinesis/
Before this commit, when tuning the delays I noticed ghost key presses when
pressing the F2 key, which is on the last row of the keyboard matrix: the
dead_grave key, which is on the first row of the keyboard matrix, would be
incorrectly detected as pressed.
After this commit, all keyboard matrix rows are interpreted correctly.
I suspect that my setup is more susceptible to this nuance than others because I
use GPIO_INPUT_PIN_DELAY=0 and hence don’t have another delay that might mask
the problem.
* ensure we do not conflict with existing keymap aliases (#12976)
* Add support for up to 4 IS31FL3733 drivers (#12342)
* Convert Encoder callbacks to be boolean functions (#12805)
* [Keyboard] Fix Terrazzo build failure (#12977)
* Do not hard set config in CPTC files (#11864)
* [Keyboard] Corne - Remove legacy revision support (#12226)
* [Keymap] Update to Drashna keymap and user code (based on develop) (#12936)
* Add Full-duplex serial driver for ARM boards (#9842)
* Document LED_MATRIX_FRAMEBUFFER_EFFECTS (#12987)
* Backlight: add defines for default level and breathing state (#12560)
* Add dire message about LUFA mass storage bootloader (#13014)
* [Keyboard] Remove redundant legacy and common headers for crkbd (#13023)
Was causing compiler errors on some systems.
* Fix keyboards/keymaps for boolean encoder callback changes (#12985)
* `backlight.c`: include `eeprom.h` (#13024)
* Add changelog for 2021-05-29 Breaking Changes merge (#12939)
* Add ChangeLog for 2021-05-29 Breaking Changes Merge: initial version
* Add recent develop changes
* Sort recent develop changes
* Remove sections for ChibiOS changes per tzarc
No ChibiOS changes this round.
* Add and sort recent develop changes
* add notes about keyboard moves/deletions
* import changelog for PR 12172
Documents the change to BOOTMAGIC_ENABLE.
* update section headings
* re-sort changelog
* add additional note regarding Bootmagic changes
* remove changelog timestamp
* update dates in main Breaking Changes docs
* fix broken section anchors in previous changelogs
* add link to backlight/eeprom patch to changelog
* highlight some more changes
* link PRs from section headers
* Restore standard readme
* run: qmk cformat --core-only
2021-05-29 23:38:50 +02:00
|
|
|
if (get_auto_shifted_key(keycode, record)) {
|
|
|
|
if (record->event.pressed) {
|
|
|
|
return autoshift_press(keycode, now, record);
|
|
|
|
} else {
|
2021-11-25 13:12:14 +01:00
|
|
|
autoshift_end(keycode, now, false, record);
|
2021 May 29 Breaking Changes Update (#13034)
* Add Per Key functionality for AutoShift (#11536)
* LED Matrix: Reactive effect buffers & advanced indicators (#12588)
* [Keyboard] kint36: switch to sym_eager_pk debouncing (#12626)
* [Keyboard] kint2pp: reduce input latency by ≈10ms (#12625)
* LED Matrix: Split (#12633)
* [CI] Format code according to conventions (#12650)
* feat: infinite timeout for leader key (#6580)
* feat: implement leader_no_timeout logic
* docs(leader_key): infinite leader timeout docs
* Format code according to conventions (#12680)
* Update ADC driver for STM32F1xx, STM32F3xx, STM32F4xx (#12403)
* Fix default ADC_RESOLUTION for ADCv3 (and ADCv4)
Recent ChibiOS update removed ADC_CFGR1_RES_10BIT from the ADCv3 headers
(that macro should not have been there, because ADCv3 has CFGR instead of
CFGR1). Fix the default value for ADC_RESOLUTION to use ADC_CFGR_RES_10BITS
if it is defined (that name is used for ADCv3 and ADCv4).
* Update ADC docs to match the actually used resolution
ADC driver for ChibiOS actually uses the 10-bit resolution by default
(probably to match AVR); fix the documentation accordingly. Also add
both ADC_CFGR_RES_10BITS and ADC_CFGR1_RES_10BIT constants (these names
differ according to the ADC implementation in the particular MCU).
* Fix pinToMux() for B12 and B13 on STM32F3xx
Testing on STM32F303CCT6 revealed that the ADC mux values for B12 and
B13 pins were wrong.
* Add support for all possible analog pins on STM32F1xx
Added ADC mux values for pins A0...A7, B0, B1, C0...C5 on STM32F1xx
(they are the same at least for STM32F103x8 and larger F103 devices, and
also F102, F105, F107 families). Actually tested on STM32F103C8T6
(therefore pins C0...C5 were not tested).
Pins F6...F10, which are present on STM32F103x[C-G] in 144-pin packages,
cannot be supported at the moment, because those pins are connected only
to ADC3, but the ChibiOS ADC driver for STM32F1xx supports only ADC1.
* Add support for all possible analog pins on STM32F4xx
Added ADC mux values for pins A0...A7, B0, B1, C0...C5 and optionally
F3...F10 (if STM32_ADC_USE_ADC3 is enabled). These mux values are
apparently the same for all F4xx devices, except some smaller devices may
not have ADC3.
Actually tested on STM32F401CCU6, STM32F401CEU6, STM32F411CEU6 (using
various WeAct “Blackpill” boards); only pins A0...A7, B0, B1 were tested.
Pins F3...F10 are inside `#if STM32_ADC_USE_ADC3` because some devices
which don't have ADC3 also don't have the GPIOF port, therefore the code
which refers to Fx pins does not compile.
* Fix STM32F3xx ADC mux table in documentation
The ADC driver documentation had some errors in the mux table for STM32F3xx.
Fix this table to match the datasheet and the actual code (mux settings for
B12 and B13 were also tested on a real STM32F303CCT6 chip).
* Add STM32F1xx ADC pins to the documentation
* Add STM32F4xx ADC pins to the documentation
* Add initial support for tinyuf2 bootloader (when hosted on F411 blackpill) (#12600)
* Add support for jumping to tinyuf2 bootloader. Adds blackpill UF2 example.
* Update flashing.md
* Update chconf.h
* Update config.h
* Update halconf.h
* Update mcuconf.h
* eeprom driver: Refactor where eeprom driver initialisation (and EEPROM emulation initialisation) occurs to make it non-target-specific. (#12671)
* Add support for MCU = STM32F446 (#12619)
* Add support for MCU = STM32F446
* Update platforms/chibios/GENERIC_STM32_F446XE/configs/config.h
* Restore mcuconf.h to the one used by RT-STM32F446RE-NUCLEO64
* stm32f446: update mcuconf.h and board.h for 16MHz operation, with USB enabled, and other peripherals disabled.
* Format code according to conventions (#12682)
* Format code according to conventions (#12687)
* Add STM32L433 and L443 support (#12063)
* initial L433 commit
* change to XC
* fix L433
* disable all peripherals
* update system and peripheral clocks
* 433 change
* use its own board files
* revert its own board files
* l433 specific change
* fix stm32l432xx define
* remove duplicate #define
* fix bootloader jump
* move to L443xx and add i2c2, spi2, usart3 to mcuconf.h
* move to L443
* move to L443
* fix sdmmc in mcuconf.h
* include STM32L443
* add L443
* Include L443 in compatible microcontrollers
* Include L443 in compatible microcontrollers
* Update config bootloader jump description
* Update ChibiOS define reasoning
* Update quantum/mcu_selection.mk
* fix git conflict
* Updated Function96 with V2 files and removed chconf.h and halconf.h (#12613)
* Fix bad PR merge for #6580. (#12721)
* Change RGB/LED Matrix to use a simple define for USB suspend (#12697)
* [CI] Format code according to conventions (#12731)
* Fixing transport's led/rgb matrix suspend state logic (#12770)
* [CI] Format code according to conventions (#12772)
* Fix comment parsing (#12750)
* Added OLED fade out support (#12086)
* fix some references to bin/qmk that slipped in (#12832)
* Resolve a number of warnings in `qmk generate-api` (#12833)
* New command: qmk console (#12828)
* stash poc
* stash
* tidy up implementation
* Tidy up slightly for review
* Tidy up slightly for review
* Bodge environment to make tests pass
* Refactor away from asyncio due to windows issues
* Filter devices
* align vid/pid printing
* Add hidapi to the installers
* start preparing for multiple hid_listeners
* udev rules for hid_listen
* refactor to move closer to end state
* very basic implementation of the threaded model
* refactor how vid/pid/index are supplied and parsed
* windows improvements
* read the report directly when usage page isn't available
* add per-device colors, the choice to show names or numbers, and refactor
* add timestamps
* Add support for showing bootloaders
* tweak the color for bootloaders
* Align bootloader disconnect with connect color
* add support for showing all bootloaders
* fix the pyusb check
* tweaks
* fix exception
* hide a stack trace behind -v
* add --no-bootloaders option
* add documentation for qmk console
* Apply suggestions from code review
* pyformat
* clean up and flesh out KNOWN_BOOTLOADERS
* Remove pointless SERIAL_LINK_ENABLE rules (#12846)
* Make Swap Hands use PROGMEM (#12284)
This converts the array that the Swap Hands feature uses to use PROGMEM,
and to read from that array, as such. Since this array never changes at
runtime, there is no reason to keep it in memory. Especially for AVR
boards, as memory is a precious resource.
* Fix another bin/qmk reference (#12856)
* [Keymap] Turn OLED off on suspend in soundmonster keymap (#10419)
* Fixup build errors on `develop` branch. (#12723)
* LED Matrix: Effects! (#12651)
* Fix syntax error when compiling for ARM (#12866)
* Remove KEYMAP and LAYOUT_kc (#12160)
* alias KEYMAP to LAYOUT
* remove KEYMAP and LAYOUT_kc
* Add setup, clone, and env to the list of commands we allow even with broken modules (#12868)
* Rename `point_t` -> `led_point_t` (#12864)
* [Keyboard] updated a vendor name / fixed minor keymap issues (#12881)
* Add missing LED Matrix suspend code to suspend.c (#12878)
* LED Matrix: Documentation (#12685)
* Deprecate `send_unicode_hex_string()` (#12602)
* Fix spelling mistake regarding LED Matrix in split_common. (#12888)
* [Keymap] Fix QWERTY/DVORAK status output for kzar keymap (#12895)
* Use milc.subcommand.config instead of qmk.cli.config (#12915)
* Use milc.subcommand.config instead
* pyformat
* remove the config test
* Add function to allow repeated blinking of one layer (#12237)
* Implement function rgblight_blink_layer_repeat to allow repeated blinking of one layer at a time
* Update doc
* Rework rgblight blinking according to requested change
* optimize storage
* Fixup housekeeping from being invoked twice per loop. (#12933)
* matrix: wait for row signal to go HIGH for every row (#12945)
I noticed this discrepancy (last row of the matrix treated differently than the
others) when optimizing the input latency of my keyboard controller, see also
https://michael.stapelberg.ch/posts/2021-05-08-keyboard-input-latency-qmk-kinesis/
Before this commit, when tuning the delays I noticed ghost key presses when
pressing the F2 key, which is on the last row of the keyboard matrix: the
dead_grave key, which is on the first row of the keyboard matrix, would be
incorrectly detected as pressed.
After this commit, all keyboard matrix rows are interpreted correctly.
I suspect that my setup is more susceptible to this nuance than others because I
use GPIO_INPUT_PIN_DELAY=0 and hence don’t have another delay that might mask
the problem.
* ensure we do not conflict with existing keymap aliases (#12976)
* Add support for up to 4 IS31FL3733 drivers (#12342)
* Convert Encoder callbacks to be boolean functions (#12805)
* [Keyboard] Fix Terrazzo build failure (#12977)
* Do not hard set config in CPTC files (#11864)
* [Keyboard] Corne - Remove legacy revision support (#12226)
* [Keymap] Update to Drashna keymap and user code (based on develop) (#12936)
* Add Full-duplex serial driver for ARM boards (#9842)
* Document LED_MATRIX_FRAMEBUFFER_EFFECTS (#12987)
* Backlight: add defines for default level and breathing state (#12560)
* Add dire message about LUFA mass storage bootloader (#13014)
* [Keyboard] Remove redundant legacy and common headers for crkbd (#13023)
Was causing compiler errors on some systems.
* Fix keyboards/keymaps for boolean encoder callback changes (#12985)
* `backlight.c`: include `eeprom.h` (#13024)
* Add changelog for 2021-05-29 Breaking Changes merge (#12939)
* Add ChangeLog for 2021-05-29 Breaking Changes Merge: initial version
* Add recent develop changes
* Sort recent develop changes
* Remove sections for ChibiOS changes per tzarc
No ChibiOS changes this round.
* Add and sort recent develop changes
* add notes about keyboard moves/deletions
* import changelog for PR 12172
Documents the change to BOOTMAGIC_ENABLE.
* update section headings
* re-sort changelog
* add additional note regarding Bootmagic changes
* remove changelog timestamp
* update dates in main Breaking Changes docs
* fix broken section anchors in previous changelogs
* add link to backlight/eeprom patch to changelog
* highlight some more changes
* link PRs from section headers
* Restore standard readme
* run: qmk cformat --core-only
2021-05-29 23:38:50 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2021-11-25 13:12:14 +01:00
|
|
|
|
|
|
|
// Prevent keyrepeating of older keys upon non-AS key event.
|
|
|
|
// Not commented at above returns but they serve the same function.
|
|
|
|
if (record->event.pressed) {
|
|
|
|
autoshift_lastkey = KC_NO;
|
|
|
|
}
|
2021 May 29 Breaking Changes Update (#13034)
* Add Per Key functionality for AutoShift (#11536)
* LED Matrix: Reactive effect buffers & advanced indicators (#12588)
* [Keyboard] kint36: switch to sym_eager_pk debouncing (#12626)
* [Keyboard] kint2pp: reduce input latency by ≈10ms (#12625)
* LED Matrix: Split (#12633)
* [CI] Format code according to conventions (#12650)
* feat: infinite timeout for leader key (#6580)
* feat: implement leader_no_timeout logic
* docs(leader_key): infinite leader timeout docs
* Format code according to conventions (#12680)
* Update ADC driver for STM32F1xx, STM32F3xx, STM32F4xx (#12403)
* Fix default ADC_RESOLUTION for ADCv3 (and ADCv4)
Recent ChibiOS update removed ADC_CFGR1_RES_10BIT from the ADCv3 headers
(that macro should not have been there, because ADCv3 has CFGR instead of
CFGR1). Fix the default value for ADC_RESOLUTION to use ADC_CFGR_RES_10BITS
if it is defined (that name is used for ADCv3 and ADCv4).
* Update ADC docs to match the actually used resolution
ADC driver for ChibiOS actually uses the 10-bit resolution by default
(probably to match AVR); fix the documentation accordingly. Also add
both ADC_CFGR_RES_10BITS and ADC_CFGR1_RES_10BIT constants (these names
differ according to the ADC implementation in the particular MCU).
* Fix pinToMux() for B12 and B13 on STM32F3xx
Testing on STM32F303CCT6 revealed that the ADC mux values for B12 and
B13 pins were wrong.
* Add support for all possible analog pins on STM32F1xx
Added ADC mux values for pins A0...A7, B0, B1, C0...C5 on STM32F1xx
(they are the same at least for STM32F103x8 and larger F103 devices, and
also F102, F105, F107 families). Actually tested on STM32F103C8T6
(therefore pins C0...C5 were not tested).
Pins F6...F10, which are present on STM32F103x[C-G] in 144-pin packages,
cannot be supported at the moment, because those pins are connected only
to ADC3, but the ChibiOS ADC driver for STM32F1xx supports only ADC1.
* Add support for all possible analog pins on STM32F4xx
Added ADC mux values for pins A0...A7, B0, B1, C0...C5 and optionally
F3...F10 (if STM32_ADC_USE_ADC3 is enabled). These mux values are
apparently the same for all F4xx devices, except some smaller devices may
not have ADC3.
Actually tested on STM32F401CCU6, STM32F401CEU6, STM32F411CEU6 (using
various WeAct “Blackpill” boards); only pins A0...A7, B0, B1 were tested.
Pins F3...F10 are inside `#if STM32_ADC_USE_ADC3` because some devices
which don't have ADC3 also don't have the GPIOF port, therefore the code
which refers to Fx pins does not compile.
* Fix STM32F3xx ADC mux table in documentation
The ADC driver documentation had some errors in the mux table for STM32F3xx.
Fix this table to match the datasheet and the actual code (mux settings for
B12 and B13 were also tested on a real STM32F303CCT6 chip).
* Add STM32F1xx ADC pins to the documentation
* Add STM32F4xx ADC pins to the documentation
* Add initial support for tinyuf2 bootloader (when hosted on F411 blackpill) (#12600)
* Add support for jumping to tinyuf2 bootloader. Adds blackpill UF2 example.
* Update flashing.md
* Update chconf.h
* Update config.h
* Update halconf.h
* Update mcuconf.h
* eeprom driver: Refactor where eeprom driver initialisation (and EEPROM emulation initialisation) occurs to make it non-target-specific. (#12671)
* Add support for MCU = STM32F446 (#12619)
* Add support for MCU = STM32F446
* Update platforms/chibios/GENERIC_STM32_F446XE/configs/config.h
* Restore mcuconf.h to the one used by RT-STM32F446RE-NUCLEO64
* stm32f446: update mcuconf.h and board.h for 16MHz operation, with USB enabled, and other peripherals disabled.
* Format code according to conventions (#12682)
* Format code according to conventions (#12687)
* Add STM32L433 and L443 support (#12063)
* initial L433 commit
* change to XC
* fix L433
* disable all peripherals
* update system and peripheral clocks
* 433 change
* use its own board files
* revert its own board files
* l433 specific change
* fix stm32l432xx define
* remove duplicate #define
* fix bootloader jump
* move to L443xx and add i2c2, spi2, usart3 to mcuconf.h
* move to L443
* move to L443
* fix sdmmc in mcuconf.h
* include STM32L443
* add L443
* Include L443 in compatible microcontrollers
* Include L443 in compatible microcontrollers
* Update config bootloader jump description
* Update ChibiOS define reasoning
* Update quantum/mcu_selection.mk
* fix git conflict
* Updated Function96 with V2 files and removed chconf.h and halconf.h (#12613)
* Fix bad PR merge for #6580. (#12721)
* Change RGB/LED Matrix to use a simple define for USB suspend (#12697)
* [CI] Format code according to conventions (#12731)
* Fixing transport's led/rgb matrix suspend state logic (#12770)
* [CI] Format code according to conventions (#12772)
* Fix comment parsing (#12750)
* Added OLED fade out support (#12086)
* fix some references to bin/qmk that slipped in (#12832)
* Resolve a number of warnings in `qmk generate-api` (#12833)
* New command: qmk console (#12828)
* stash poc
* stash
* tidy up implementation
* Tidy up slightly for review
* Tidy up slightly for review
* Bodge environment to make tests pass
* Refactor away from asyncio due to windows issues
* Filter devices
* align vid/pid printing
* Add hidapi to the installers
* start preparing for multiple hid_listeners
* udev rules for hid_listen
* refactor to move closer to end state
* very basic implementation of the threaded model
* refactor how vid/pid/index are supplied and parsed
* windows improvements
* read the report directly when usage page isn't available
* add per-device colors, the choice to show names or numbers, and refactor
* add timestamps
* Add support for showing bootloaders
* tweak the color for bootloaders
* Align bootloader disconnect with connect color
* add support for showing all bootloaders
* fix the pyusb check
* tweaks
* fix exception
* hide a stack trace behind -v
* add --no-bootloaders option
* add documentation for qmk console
* Apply suggestions from code review
* pyformat
* clean up and flesh out KNOWN_BOOTLOADERS
* Remove pointless SERIAL_LINK_ENABLE rules (#12846)
* Make Swap Hands use PROGMEM (#12284)
This converts the array that the Swap Hands feature uses to use PROGMEM,
and to read from that array, as such. Since this array never changes at
runtime, there is no reason to keep it in memory. Especially for AVR
boards, as memory is a precious resource.
* Fix another bin/qmk reference (#12856)
* [Keymap] Turn OLED off on suspend in soundmonster keymap (#10419)
* Fixup build errors on `develop` branch. (#12723)
* LED Matrix: Effects! (#12651)
* Fix syntax error when compiling for ARM (#12866)
* Remove KEYMAP and LAYOUT_kc (#12160)
* alias KEYMAP to LAYOUT
* remove KEYMAP and LAYOUT_kc
* Add setup, clone, and env to the list of commands we allow even with broken modules (#12868)
* Rename `point_t` -> `led_point_t` (#12864)
* [Keyboard] updated a vendor name / fixed minor keymap issues (#12881)
* Add missing LED Matrix suspend code to suspend.c (#12878)
* LED Matrix: Documentation (#12685)
* Deprecate `send_unicode_hex_string()` (#12602)
* Fix spelling mistake regarding LED Matrix in split_common. (#12888)
* [Keymap] Fix QWERTY/DVORAK status output for kzar keymap (#12895)
* Use milc.subcommand.config instead of qmk.cli.config (#12915)
* Use milc.subcommand.config instead
* pyformat
* remove the config test
* Add function to allow repeated blinking of one layer (#12237)
* Implement function rgblight_blink_layer_repeat to allow repeated blinking of one layer at a time
* Update doc
* Rework rgblight blinking according to requested change
* optimize storage
* Fixup housekeeping from being invoked twice per loop. (#12933)
* matrix: wait for row signal to go HIGH for every row (#12945)
I noticed this discrepancy (last row of the matrix treated differently than the
others) when optimizing the input latency of my keyboard controller, see also
https://michael.stapelberg.ch/posts/2021-05-08-keyboard-input-latency-qmk-kinesis/
Before this commit, when tuning the delays I noticed ghost key presses when
pressing the F2 key, which is on the last row of the keyboard matrix: the
dead_grave key, which is on the first row of the keyboard matrix, would be
incorrectly detected as pressed.
After this commit, all keyboard matrix rows are interpreted correctly.
I suspect that my setup is more susceptible to this nuance than others because I
use GPIO_INPUT_PIN_DELAY=0 and hence don’t have another delay that might mask
the problem.
* ensure we do not conflict with existing keymap aliases (#12976)
* Add support for up to 4 IS31FL3733 drivers (#12342)
* Convert Encoder callbacks to be boolean functions (#12805)
* [Keyboard] Fix Terrazzo build failure (#12977)
* Do not hard set config in CPTC files (#11864)
* [Keyboard] Corne - Remove legacy revision support (#12226)
* [Keymap] Update to Drashna keymap and user code (based on develop) (#12936)
* Add Full-duplex serial driver for ARM boards (#9842)
* Document LED_MATRIX_FRAMEBUFFER_EFFECTS (#12987)
* Backlight: add defines for default level and breathing state (#12560)
* Add dire message about LUFA mass storage bootloader (#13014)
* [Keyboard] Remove redundant legacy and common headers for crkbd (#13023)
Was causing compiler errors on some systems.
* Fix keyboards/keymaps for boolean encoder callback changes (#12985)
* `backlight.c`: include `eeprom.h` (#13024)
* Add changelog for 2021-05-29 Breaking Changes merge (#12939)
* Add ChangeLog for 2021-05-29 Breaking Changes Merge: initial version
* Add recent develop changes
* Sort recent develop changes
* Remove sections for ChibiOS changes per tzarc
No ChibiOS changes this round.
* Add and sort recent develop changes
* add notes about keyboard moves/deletions
* import changelog for PR 12172
Documents the change to BOOTMAGIC_ENABLE.
* update section headings
* re-sort changelog
* add additional note regarding Bootmagic changes
* remove changelog timestamp
* update dates in main Breaking Changes docs
* fix broken section anchors in previous changelogs
* add link to backlight/eeprom patch to changelog
* highlight some more changes
* link PRs from section headers
* Restore standard readme
* run: qmk cformat --core-only
2021-05-29 23:38:50 +02:00
|
|
|
return true;
|
|
|
|
}
|
2020-11-28 21:02:18 +01:00
|
|
|
|
2023-07-11 09:07:24 +02:00
|
|
|
#if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
|
2021-11-25 13:12:14 +01:00
|
|
|
// Called to record time before possible delays by action_tapping_process.
|
|
|
|
void retroshift_poll_time(keyevent_t *event) {
|
|
|
|
last_retroshift_time = retroshift_time;
|
|
|
|
retroshift_time = timer_read();
|
|
|
|
}
|
|
|
|
// Used to swap the times of Retro Shifted key and Auto Shift key that interrupted it.
|
2023-01-20 17:21:17 +01:00
|
|
|
void retroshift_swap_times(void) {
|
2023-09-25 04:45:49 +02:00
|
|
|
if (autoshift_flags.in_progress) {
|
|
|
|
autoshift_time = last_retroshift_time;
|
2017-09-17 07:33:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|