summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/action.c42
-rw-r--r--quantum/action.h18
-rw-r--r--quantum/action_code.h32
-rw-r--r--quantum/action_macro.c93
-rw-r--r--quantum/action_macro.h123
-rw-r--r--quantum/action_util.c42
-rw-r--r--quantum/action_util.h7
-rw-r--r--quantum/audio/audio.c3
-rw-r--r--quantum/color.h2
-rw-r--r--quantum/debounce.h2
-rw-r--r--quantum/debounce/asym_eager_defer_pk.c1
-rw-r--r--quantum/debounce/none.c2
-rw-r--r--quantum/debounce/sym_defer_g.c2
-rw-r--r--quantum/debounce/sym_defer_pk.c1
-rw-r--r--quantum/debounce/sym_defer_pr.c72
-rw-r--r--quantum/debounce/sym_eager_pk.c1
-rw-r--r--quantum/debounce/sym_eager_pr.c1
-rw-r--r--quantum/debounce/tests/rules.mk5
-rw-r--r--quantum/debounce/tests/sym_defer_pr_tests.cpp238
-rw-r--r--quantum/debounce/tests/testlist.mk1
-rw-r--r--quantum/deferred_exec.c85
-rw-r--r--quantum/deferred_exec.h119
-rw-r--r--quantum/keyboard.c169
-rw-r--r--quantum/keyboard.h2
-rw-r--r--quantum/keycode.h43
-rw-r--r--quantum/keymap.h9
-rw-r--r--quantum/keymap_common.c41
-rw-r--r--quantum/led.c57
-rw-r--r--quantum/led.h12
-rw-r--r--quantum/led_matrix/led_matrix.h4
-rw-r--r--quantum/matrix.c41
-rw-r--r--quantum/matrix.h3
-rw-r--r--quantum/matrix_common.c74
-rw-r--r--quantum/mousekey.h18
-rw-r--r--quantum/pointing_device.c385
-rw-r--r--quantum/pointing_device.h19
-rw-r--r--quantum/pointing_device_drivers.c65
-rw-r--r--quantum/process_keycode/process_audio.c1
-rw-r--r--quantum/process_keycode/process_audio.h1
-rw-r--r--quantum/process_keycode/process_combo.c52
-rw-r--r--quantum/process_keycode/process_grave_esc.c4
-rw-r--r--quantum/process_keycode/process_haptic.c3
-rw-r--r--quantum/process_keycode/process_key_lock.c5
-rw-r--r--quantum/process_keycode/process_key_lock.h1
-rw-r--r--quantum/process_keycode/process_magic.c4
-rw-r--r--quantum/process_keycode/process_printer.c5
-rw-r--r--quantum/process_keycode/process_printer.h2
-rw-r--r--quantum/process_keycode/process_rgb.c6
-rw-r--r--quantum/quantum.c138
-rw-r--r--quantum/quantum.h9
-rw-r--r--quantum/quantum_keycodes.h29
-rw-r--r--quantum/quantum_keycodes_legacy.h13
-rw-r--r--quantum/rgb_matrix/animations/pixel_fractal_anim.h4
-rw-r--r--quantum/split_common/split_util.h1
-rw-r--r--quantum/split_common/transaction_id_define.h6
-rw-r--r--quantum/split_common/transactions.c88
-rw-r--r--quantum/split_common/transactions.h1
-rw-r--r--quantum/split_common/transport.c2
-rw-r--r--quantum/split_common/transport.h13
-rw-r--r--quantum/via_ensure_keycode.h6
-rw-r--r--quantum/wpm.c75
-rw-r--r--quantum/wpm.h2
62 files changed, 1459 insertions, 846 deletions
diff --git a/quantum/action.c b/quantum/action.c
index 5e81efb671..d932c01688 100644
--- a/quantum/action.c
+++ b/quantum/action.c
@@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "led.h"
#include "action_layer.h"
#include "action_tapping.h"
-#include "action_macro.h"
#include "action_util.h"
#include "action.h"
#include "wait.h"
@@ -634,12 +633,7 @@ void process_action(keyrecord_t *record, action_t action) {
break;
# endif
#endif
- /* Extentions */
-#ifndef NO_ACTION_MACRO
- case ACT_MACRO:
- action_macro_play(action_get_macro(record, action.func.id, action.func.opt));
- break;
-#endif
+
#ifdef SWAP_HANDS_ENABLE
case ACT_SWAP_HANDS:
switch (action.swap.code) {
@@ -713,11 +707,6 @@ void process_action(keyrecord_t *record, action_t action) {
# endif
}
#endif
-#ifndef NO_ACTION_FUNCTION
- case ACT_FUNCTION:
- action_function(record, action.func.id, action.func.opt);
- break;
-#endif
default:
break;
}
@@ -794,7 +783,7 @@ void process_action(keyrecord_t *record, action_t action) {
*
* FIXME: Needs documentation.
*/
-void register_code(uint8_t code) {
+__attribute__((weak)) void register_code(uint8_t code) {
if (code == KC_NO) {
return;
}
@@ -890,7 +879,7 @@ void register_code(uint8_t code) {
*
* FIXME: Needs documentation.
*/
-void unregister_code(uint8_t code) {
+__attribute__((weak)) void unregister_code(uint8_t code) {
if (code == KC_NO) {
return;
}
@@ -955,7 +944,7 @@ void unregister_code(uint8_t code) {
* \param code The basic keycode to tap.
* \param delay The amount of time in milliseconds to leave the keycode registered, before unregistering it.
*/
-void tap_code_delay(uint8_t code, uint16_t delay) {
+__attribute__((weak)) void tap_code_delay(uint8_t code, uint16_t delay) {
register_code(code);
for (uint16_t i = delay; i > 0; i--) {
wait_ms(1);
@@ -967,13 +956,13 @@ void tap_code_delay(uint8_t code, uint16_t delay) {
*
* \param code The basic keycode to tap. If `code` is `KC_CAPS_LOCK`, the delay will be `TAP_HOLD_CAPS_DELAY`, otherwise `TAP_CODE_DELAY`, if defined.
*/
-void tap_code(uint8_t code) { tap_code_delay(code, code == KC_CAPS_LOCK ? TAP_HOLD_CAPS_DELAY : TAP_CODE_DELAY); }
+__attribute__((weak)) void tap_code(uint8_t code) { tap_code_delay(code, code == KC_CAPS_LOCK ? TAP_HOLD_CAPS_DELAY : TAP_CODE_DELAY); }
/** \brief Adds the given physically pressed modifiers and sends a keyboard report immediately.
*
* \param mods A bitfield of modifiers to register.
*/
-void register_mods(uint8_t mods) {
+__attribute__((weak)) void register_mods(uint8_t mods) {
if (mods) {
add_mods(mods);
send_keyboard_report();
@@ -984,7 +973,7 @@ void register_mods(uint8_t mods) {
*
* \param mods A bitfield of modifiers to unregister.
*/
-void unregister_mods(uint8_t mods) {
+__attribute__((weak)) void unregister_mods(uint8_t mods) {
if (mods) {
del_mods(mods);
send_keyboard_report();
@@ -995,7 +984,7 @@ void unregister_mods(uint8_t mods) {
*
* \param mods A bitfield of modifiers to register.
*/
-void register_weak_mods(uint8_t mods) {
+__attribute__((weak)) void register_weak_mods(uint8_t mods) {
if (mods) {
add_weak_mods(mods);
send_keyboard_report();
@@ -1006,7 +995,7 @@ void register_weak_mods(uint8_t mods) {
*
* \param mods A bitfield of modifiers to unregister.
*/
-void unregister_weak_mods(uint8_t mods) {
+__attribute__((weak)) void unregister_weak_mods(uint8_t mods) {
if (mods) {
del_weak_mods(mods);
send_keyboard_report();
@@ -1041,7 +1030,6 @@ void clear_keyboard_but_mods_and_keys() {
host_consumer_send(0);
#endif
clear_weak_mods();
- clear_macro_mods();
send_keyboard_report();
#ifdef MOUSEKEY_ENABLE
mousekey_clear();
@@ -1104,12 +1092,6 @@ bool is_tap_action(action_t action) {
return true;
}
return false;
- case ACT_MACRO:
- case ACT_FUNCTION:
- if (action.func.opt & FUNC_TAP) {
- return true;
- }
- return false;
}
return false;
}
@@ -1166,12 +1148,6 @@ void debug_action(action_t action) {
case ACT_LAYER_TAP_EXT:
dprint("ACT_LAYER_TAP_EXT");
break;
- case ACT_MACRO:
- dprint("ACT_MACRO");
- break;
- case ACT_FUNCTION:
- dprint("ACT_FUNCTION");
- break;
case ACT_SWAP_HANDS:
dprint("ACT_SWAP_HANDS");
break;
diff --git a/quantum/action.h b/quantum/action.h
index b562f18c5b..39b5da63b8 100644
--- a/quantum/action.h
+++ b/quantum/action.h
@@ -19,25 +19,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdint.h>
#include <stdbool.h>
+#include "progmem.h"
#include "keyboard.h"
#include "keycode.h"
#include "action_code.h"
-#include "action_macro.h"
#ifdef __cplusplus
extern "C" {
#endif
-/* Disable macro and function features when LTO is enabled, since they break */
-#ifdef LTO_ENABLE
-# ifndef NO_ACTION_MACRO
-# define NO_ACTION_MACRO
-# endif
-# ifndef NO_ACTION_FUNCTION
-# define NO_ACTION_FUNCTION
-# endif
-#endif
-
#ifndef TAP_CODE_DELAY
# define TAP_CODE_DELAY 0
#endif
@@ -72,12 +62,6 @@ void action_exec(keyevent_t event);
action_t action_for_key(uint8_t layer, keypos_t key);
action_t action_for_keycode(uint16_t keycode);
-/* macro */
-const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
-
-/* user defined special function */
-void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
-
/* keyboard-specific key event (pre)processing */
bool process_record_quantum(keyrecord_t *record);
diff --git a/quantum/action_code.h b/quantum/action_code.h
index eb18c36ae8..20b3e459d2 100644
--- a/quantum/action_code.h
+++ b/quantum/action_code.h
@@ -79,19 +79,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* 101E|LLLL|1111 0100 One Shot Layer (0xF4) [TAP]
* 101E|LLLL|1111 xxxx Reserved (0xF5-FF)
* ELLLL: layer 0-31(E: extra bit for layer 16-31)
- *
- * Extensions(11xx)
- * ----------------
- * ACT_MACRO(1100):
- * 1100|opt | id(8) Macro play?
- * 1100|1111| id(8) Macro record?
- *
- * 1101|xxxx xxxx xxxx (reserved)
- * 1110|xxxx xxxx xxxx (reserved)
- *
- * ACT_FUNCTION(1111):
- * 1111| address(12) Function?
- * 1111|opt | id(8) Function?
*/
enum action_kind_id {
/* Key Actions */
@@ -111,9 +98,6 @@ enum action_kind_id {
ACT_LAYER_MODS = 0b1001,
ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */
ACT_LAYER_TAP_EXT = 0b1011, /* Layer 16-31 */
- /* Extensions */
- ACT_MACRO = 0b1100,
- ACT_FUNCTION = 0b1111
};
/** \brief Action Code Struct
@@ -164,11 +148,6 @@ typedef union {
uint8_t page : 2;
uint8_t kind : 4;
} usage;
- struct action_function {
- uint8_t id : 8;
- uint8_t opt : 4;
- uint8_t kind : 4;
- } func;
struct action_swap {
uint8_t code : 8;
uint8_t opt : 4;
@@ -275,17 +254,6 @@ enum layer_param_tap_op {
#define ACTION_DEFAULT_LAYER_BIT_XOR(part, bits) ACTION_LAYER_BITOP(OP_BIT_XOR, (part), (bits), 0)
#define ACTION_DEFAULT_LAYER_BIT_SET(part, bits) ACTION_LAYER_BITOP(OP_BIT_SET, (part), (bits), 0)
-/* Macro */
-#define ACTION_MACRO(id) ACTION(ACT_MACRO, (id))
-#define ACTION_MACRO_TAP(id) ACTION(ACT_MACRO, FUNC_TAP << 8 | (id))
-#define ACTION_MACRO_OPT(id, opt) ACTION(ACT_MACRO, (opt) << 8 | (id))
-/* Function */
-enum function_opts {
- FUNC_TAP = 0x8, /* indciates function is tappable */
-};
-#define ACTION_FUNCTION(id) ACTION(ACT_FUNCTION, (id))
-#define ACTION_FUNCTION_TAP(id) ACTION(ACT_FUNCTION, FUNC_TAP << 8 | (id))
-#define ACTION_FUNCTION_OPT(id, opt) ACTION(ACT_FUNCTION, (opt) << 8 | (id))
/* OneHand Support */
enum swap_hands_param_tap_op {
OP_SH_TOGGLE = 0xF0,
diff --git a/quantum/action_macro.c b/quantum/action_macro.c
deleted file mode 100644
index 92228c0ba8..0000000000
--- a/quantum/action_macro.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-Copyright 2013 Jun Wako <wakojun@gmail.com>
-
-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 "action.h"
-#include "action_util.h"
-#include "action_macro.h"
-#include "wait.h"
-
-#ifdef DEBUG_ACTION
-# include "debug.h"
-#else
-# include "nodebug.h"
-#endif
-
-#ifndef NO_ACTION_MACRO
-
-# define MACRO_READ() (macro = MACRO_GET(macro_p++))
-/** \brief Action Macro Play
- *
- * FIXME: Needs doc
- */
-void action_macro_play(const macro_t *macro_p) {
- macro_t macro = END;
- uint8_t interval = 0;
-
- if (!macro_p) return;
- while (true) {
- switch (MACRO_READ()) {
- case KEY_DOWN:
- MACRO_READ();
- dprintf("KEY_DOWN(%02X)\n", macro);
- if (IS_MOD(macro)) {
- add_macro_mods(MOD_BIT(macro));
- send_keyboard_report();
- } else {
- register_code(macro);
- }
- break;
- case KEY_UP:
- MACRO_READ();
- dprintf("KEY_UP(%02X)\n", macro);
- if (IS_MOD(macro)) {
- del_macro_mods(MOD_BIT(macro));
- send_keyboard_report();
- } else {
- unregister_code(macro);
- }
- break;
- case WAIT:
- MACRO_READ();
- dprintf("WAIT(%u)\n", macro);
- {
- uint8_t ms = macro;
- while (ms--) wait_ms(1);
- }
- break;
- case INTERVAL:
- interval = MACRO_READ();
- dprintf("INTERVAL(%u)\n", interval);
- break;
- case 0x04 ... 0x73:
- dprintf("DOWN(%02X)\n", macro);
- register_code(macro);
- break;
- case 0x84 ... 0xF3:
- dprintf("UP(%02X)\n", macro);
- unregister_code(macro & 0x7F);
- break;
- case END:
- default:
- return;
- }
- // interval
- {
- uint8_t ms = interval;
- while (ms--) wait_ms(1);
- }
- }
-}
-#endif
diff --git a/quantum/action_macro.h b/quantum/action_macro.h
deleted file mode 100644
index 685e2c6ffc..0000000000
--- a/quantum/action_macro.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-Copyright 2013 Jun Wako <wakojun@gmail.com>
-
-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 <stdint.h>
-#include "progmem.h"
-
-typedef uint8_t macro_t;
-
-#define MACRO_NONE (macro_t *)0
-#define MACRO(...) \
- ({ \
- static const macro_t __m[] PROGMEM = {__VA_ARGS__}; \
- &__m[0]; \
- })
-#define MACRO_GET(p) pgm_read_byte(p)
-
-// Sends press when the macro key is pressed, release when release, or tap_macro when the key has been tapped
-#define MACRO_TAP_HOLD(record, press, release, tap_macro) (((record)->event.pressed) ? (((record)->tap.count <= 0 || (record)->tap.interrupted) ? (press) : MACRO_NONE) : (((record)->tap.count > 0 && !((record)->tap.interrupted)) ? (tap_macro) : (release)))
-
-// Holds down the modifier mod when the macro key is held, or sends macro instead when tapped
-#define MACRO_TAP_HOLD_MOD(record, macro, mod) MACRO_TAP_HOLD(record, (MACRO(D(mod), END)), MACRO(U(mod), END), macro)
-
-// Holds down the modifier mod when the macro key is held, or pressed a shifted key when tapped (eg: shift+3 for #)
-#define MACRO_TAP_SHFT_KEY_HOLD_MOD(record, key, mod) MACRO_TAP_HOLD_MOD(record, (MACRO(I(10), D(LSFT), T(key), U(LSFT), END)), mod)
-
-// Momentary switch layer when held, sends macro if tapped
-#define MACRO_TAP_HOLD_LAYER(record, macro, layer) \
- (((record)->event.pressed) ? (((record)->tap.count <= 0 || (record)->tap.interrupted) ? ({ \
- layer_on((layer)); \
- MACRO_NONE; \
- }) \
- : MACRO_NONE) \
- : (((record)->tap.count > 0 && !((record)->tap.interrupted)) ? (macro) : ({ \
- layer_off((layer)); \
- MACRO_NONE; \
- })))
-
-// Momentary switch layer when held, presses a shifted key when tapped (eg: shift+3 for #)
-#define MACRO_TAP_SHFT_KEY_HOLD_LAYER(record, key, layer) MACRO_TAP_HOLD_LAYER(record, MACRO(I(10), D(LSFT), T(key), U(LSFT), END), layer)
-
-#ifndef NO_ACTION_MACRO
-void action_macro_play(const macro_t *macro_p);
-#else
-# define action_macro_play(macro)
-#endif
-
-/* Macro commands
- * code(0x04-73) // key down(1byte)
- * code(0x04-73) | 0x80 // key up(1byte)
- * { KEY_DOWN, code(0x04-0xff) } // key down(2bytes)
- * { KEY_UP, code(0x04-0xff) } // key up(2bytes)
- * WAIT // wait milli-seconds
- * INTERVAL // set interval between macro commands
- * END // stop macro execution
- *
- * Ideas(Not implemented):
- * modifiers
- * system usage
- * consumer usage
- * unicode usage
- * function call
- * conditionals
- * loop
- */
-enum macro_command_id {
- /* 0x00 - 0x03 */
- END = 0x00,
- KEY_DOWN,
- KEY_UP,
-
- /* 0x04 - 0x73 (reserved for keycode down) */
-
- /* 0x74 - 0x83 */
- WAIT = 0x74,
- INTERVAL,
-
- /* 0x84 - 0xf3 (reserved for keycode up) */
-
- /* 0xf4 - 0xff */
-};
-
-/* TODO: keycode:0x04-0x73 can be handled by 1byte command else 2bytes are needed
- * if keycode between 0x04 and 0x73
- * keycode / (keycode|0x80)
- * else
- * {KEY_DOWN, keycode} / {KEY_UP, keycode}
- */
-#define DOWN(key) KEY_DOWN, (key)
-#define UP(key) KEY_UP, (key)
-#define TYPE(key) DOWN(key), UP(key)
-#define WAIT(ms) WAIT, (ms)
-#define INTERVAL(ms) INTERVAL, (ms)
-
-/* key down */
-#define D(key) DOWN(KC_##key)
-/* key up */
-#define U(key) UP(KC_##key)
-/* key type */
-#define T(key) TYPE(KC_##key)
-/* wait */
-#define W(ms) WAIT(ms)
-/* interval */
-#define I(ms) INTERVAL(ms)
-
-/* for backward comaptibility */
-#define MD(key) DOWN(KC_##key)
-#define MU(key) UP(KC_##key)
diff --git a/quantum/action_util.c b/quantum/action_util.c
index 78e02aec18..9eb2a6d30d 100644
--- a/quantum/action_util.c
+++ b/quantum/action_util.c
@@ -21,12 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action_layer.h"
#include "timer.h"
#include "keycode_config.h"
+#include <string.h>
extern keymap_config_t keymap_config;
-static uint8_t real_mods = 0;
-static uint8_t weak_mods = 0;
-static uint8_t macro_mods = 0;
+static uint8_t real_mods = 0;
+static uint8_t weak_mods = 0;
#ifdef KEY_OVERRIDE_ENABLE
static uint8_t weak_override_mods = 0;
static uint8_t suppressed_mods = 0;
@@ -223,7 +223,6 @@ bool is_oneshot_enabled(void) { return keymap_config.oneshot_disable; }
void send_keyboard_report(void) {
keyboard_report->mods = real_mods;
keyboard_report->mods |= weak_mods;
- keyboard_report->mods |= macro_mods;
#ifndef NO_ACTION_ONESHOT
if (oneshot_mods) {
@@ -247,7 +246,13 @@ void send_keyboard_report(void) {
keyboard_report->mods |= weak_override_mods;
#endif
- host_keyboard_send(keyboard_report);
+ static report_keyboard_t last_report;
+
+ /* Only send the report if there are changes to propagate to the host. */
+ if (memcmp(keyboard_report, &last_report, sizeof(report_keyboard_t)) != 0) {
+ memcpy(&last_report, keyboard_report, sizeof(report_keyboard_t));
+ host_keyboard_send(keyboard_report);
+ }
}
/** \brief Get mods
@@ -318,33 +323,6 @@ void set_suppressed_override_mods(uint8_t mods) { suppressed_mods = mods; }
void clear_suppressed_override_mods(void) { suppressed_mods = 0; }
#endif
-/* macro modifier */
-/** \brief get macro mods
- *
- * FIXME: needs doc
- */
-uint8_t get_macro_mods(void) { return macro_mods; }
-/** \brief add macro mods
- *
- * FIXME: needs doc
- */
-void add_macro_mods(uint8_t mods) { macro_mods |= mods; }
-/** \brief del macro mods
- *
- * FIXME: needs doc
- */
-void del_macro_mods(uint8_t mods) { macro_mods &= ~mods; }
-/** \brief set macro mods
- *
- * FIXME: needs doc
- */
-void set_macro_mods(uint8_t mods) { macro_mods = mods; }
-/** \brief clear macro mods
- *
- * FIXME: needs doc
- */
-void clear_macro_mods(void) { macro_mods = 0; }
-
#ifndef NO_ACTION_ONESHOT
/** \brief