summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/action_util.c9
-rw-r--r--quantum/audio/audio.c3
-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_eager_pk.c1
-rw-r--r--quantum/debounce/sym_eager_pr.c1
-rw-r--r--quantum/matrix.h2
-rw-r--r--quantum/matrix_common.c6
-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_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/quantum.c4
-rw-r--r--quantum/quantum.h4
-rw-r--r--quantum/quantum_keycodes.h3
21 files changed, 35 insertions, 25 deletions
diff --git a/quantum/action_util.c b/quantum/action_util.c
index 78e02aec18..7e30593fb1 100644
--- a/quantum/action_util.c
+++ b/quantum/action_util.c
@@ -21,6 +21,7 @@ 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;
@@ -247,7 +248,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
diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c
index 49bb309e80..b3d6389dd5 100644
--- a/quantum/audio/audio.c
+++ b/quantum/audio/audio.c
@@ -160,6 +160,8 @@ void audio_toggle(void) {
eeconfig_update_audio(audio_config.raw);
if (audio_config.enable) {
audio_on_user();
+ } else {
+ audio_off_user();
}
}
@@ -172,6 +174,7 @@ void audio_on(void) {
void audio_off(void) {
PLAY_SONG(audio_off_song);
+ audio_off_user();
wait_ms(100);
audio_stop_all();
audio_config.enable = 0;
diff --git a/quantum/debounce.h b/quantum/debounce.h
index 5043868289..3532d9cd7b 100644
--- a/quantum/debounce.h
+++ b/quantum/debounce.h
@@ -6,8 +6,6 @@
// changed is true if raw has changed since the last call
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed);
-bool debounce_active(void);
-
void debounce_init(uint8_t num_rows);
void debounce_free(void);
diff --git a/quantum/debounce/asym_eager_defer_pk.c b/quantum/debounce/asym_eager_defer_pk.c
index 81f39383c4..b1eb4a2b7b 100644
--- a/quantum/debounce/asym_eager_defer_pk.c
+++ b/quantum/debounce/asym_eager_defer_pk.c
@@ -165,7 +165,6 @@ static void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], ui
}
}
-bool debounce_active(void) { return true; }
#else
# include "none.c"
#endif
diff --git a/quantum/debounce/none.c b/quantum/debounce/none.c
index b03892bc5b..8a85cc04a8 100644
--- a/quantum/debounce/none.c
+++ b/quantum/debounce/none.c
@@ -26,6 +26,4 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool
}
}
-bool debounce_active(void) { return false; }
-
void debounce_free(void) {}
diff --git a/quantum/debounce/sym_defer_g.c b/quantum/debounce/sym_defer_g.c
index 9155eb914c..8cac1c37f9 100644
--- a/quantum/debounce/sym_defer_g.c
+++ b/quantum/debounce/sym_defer_g.c
@@ -44,8 +44,6 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool
}
}
-bool debounce_active(void) { return debouncing; }
-
void debounce_free(void) {}
#else // no debouncing.
# include "none.c"
diff --git a/quantum/debounce/sym_defer_pk.c b/quantum/debounce/sym_defer_pk.c
index 1b698ba347..9dee29e28e 100644
--- a/quantum/debounce/sym_defer_pk.c
+++ b/quantum/debounce/sym_defer_pk.c
@@ -134,7 +134,6 @@ static void start_debounce_counters(matrix_row_t raw[], matrix_row_t cooked[], u
}
}
-bool debounce_active(void) { return true; }
#else
# include "none.c"
#endif
diff --git a/quantum/debounce/sym_eager_pk.c b/quantum/debounce/sym_eager_pk.c
index 9da000ea9a..deec463649 100644
--- a/quantum/debounce/sym_eager_pk.c
+++ b/quantum/debounce/sym_eager_pk.c
@@ -140,7 +140,6 @@ static void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], ui
}
}
-bool debounce_active(void) { return true; }
#else
# include "none.c"
#endif
diff --git a/quantum/debounce/sym_eager_pr.c b/quantum/debounce/sym_eager_pr.c
index eda92a263b..29b0cabefb 100644
--- a/quantum/debounce/sym_eager_pr.c
+++ b/quantum/debounce/sym_eager_pr.c
@@ -132,7 +132,6 @@ static void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], ui
}
}
-bool debounce_active(void) { return true; }
#else
# include "none.c"
#endif
diff --git a/quantum/matrix.h b/quantum/matrix.h
index 5c696622fc..1a3f362fba 100644
--- a/quantum/matrix.h
+++ b/quantum/matrix.h
@@ -46,8 +46,6 @@ void matrix_setup(void);
void matrix_init(void);
/* scan all key states on matrix */
uint8_t matrix_scan(void);
-/* whether modified from previous scan. used after matrix_scan. */
-bool matrix_is_modified(void) __attribute__((deprecated));
/* whether a switch is on */
bool matrix_is_on(uint8_t row, uint8_t col);
/* matrix state on row */
diff --git a/quantum/matrix_common.c b/quantum/matrix_common.c
index 66c89970b1..fe1d5b1edd 100644
--- a/quantum/matrix_common.c
+++ b/quantum/matrix_common.c
@@ -45,12 +45,6 @@ inline matrix_row_t matrix_get_row(uint8_t row) {
#endif
}
-// Deprecated.
-bool matrix_is_modified(void) {
- if (debounce_active()) return false;
- return true;
-}
-
#if (MATRIX_COLS <= 8)
# define print_matrix_header() print("\nr/c 01234567\n")
# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
diff --git a/quantum/process_keycode/process_audio.c b/quantum/process_keycode/process_audio.c
index 3b5fa8490b..23664721e8 100644
--- a/quantum/process_keycode/process_audio.c
+++ b/quantum/process_keycode/process_audio.c
@@ -57,3 +57,4 @@ void process_audio_noteoff(uint8_t note) { stop_note(compute_freq_for_midi_note(
void process_audio_all_notes_off(void) { stop_all_notes(); }
__attribute__((weak)) void audio_on_user() {}
+__attribute__((weak)) void audio_off_user() {}
diff --git a/quantum/process_keycode/process_audio.h b/quantum/process_keycode/process_audio.h
index d89a834ea8..42cfab4af2 100644
--- a/quantum/process_keycode/process_audio.h
+++ b/quantum/process_keycode/process_audio.h
@@ -8,3 +8,4 @@ void process_audio_noteoff(uint8_t note);
void process_audio_all_notes_off(void);
void audio_on_user(void);
+void audio_off_user(void);
diff --git a/quantum/process_keycode/process_key_lock.c b/quantum/process_keycode/process_key_lock.c
index 4bd58f0c1e..941a2c5780 100644
--- a/quantum/process_keycode/process_key_lock.c
+++ b/quantum/process_keycode/process_key_lock.c
@@ -56,6 +56,11 @@ static inline uint16_t translate_keycode(uint16_t keycode) {
}
}
+void cancel_key_lock(void) {
+ watching = false;
+ UNSET_KEY_STATE(0x0);
+}
+
bool process_key_lock(uint16_t *keycode, keyrecord_t *record) {
// We start by categorizing the keypress event. In the event of a down
// event, there are several possibilities:
diff --git a/quantum/process_keycode/process_key_lock.h b/quantum/process_keycode/process_key_lock.h
index baa0b39077..5159b0ba02 100644
--- a/quantum/process_keycode/process_key_lock.h
+++ b/quantum/process_keycode/process_key_lock.h
@@ -18,4 +18,5 @@
#include "quantum.h"
+void cancel_key_lock(void);
bool process_key_lock(uint16_t *keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_magic.c b/quantum/process_keycode/process_magic.c
index d5cff4f12a..6332be647c 100644
--- a/quantum/process_keycode/process_magic.c
+++ b/quantum/process_keycode/process_magic.c
@@ -44,6 +44,7 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_ALT_GUI:
case MAGIC_SWAP_LCTL_LGUI ... MAGIC_EE_HANDS_RIGHT:
case MAGIC_TOGGLE_GUI:
+ case MAGIC_TOGGLE_CONTROL_CAPSLOCK:
/* keymap config */
keymap_config.raw = eeconfig_read_keymap();
switch (keycode) {
@@ -168,6 +169,9 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
case MAGIC_TOGGLE_GUI:
keymap_config.no_gui = !keymap_config.no_gui;
break;
+ case MAGIC_TOGGLE_CONTROL_CAPSLOCK:
+ keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock;
+ break;
}
eeconfig_update_keymap(keymap_config.raw);
diff --git a/quantum/process_keycode/process_printer.c b/quantum/process_keycode/process_printer.c
index 82528cc680..0801f078ef 100644
--- a/quantum/process_keycode/process_printer.c
+++ b/quantum/process_keycode/process_printer.c
@@ -16,13 +16,14 @@
#include "process_printer.h"
#include "action_util.h"
+#include "uart.h"
bool printing_enabled = false;
uint8_t character_shift = 0;
void enable_printing(void) {
printing_enabled = true;
- serial_init();
+ uart_init(19200);
}
void disable_printing(void) { printing_enabled = false; }
@@ -35,7 +36,7 @@ uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0
void print_char(char c) {
USB_Disable();
- serial_send(c);
+ uart_write(c);
USB_Init();
}
diff --git a/quantum/process_keycode/process_printer.h b/quantum/process_keycode/process_printer.h
index 3c6d06ff94..6f4d09f333 100644
--- a/quantum/process_keycode/process_printer.h
+++ b/quantum/process_keycode/process_printer.h
@@ -18,6 +18,4 @@
#include "quantum.h"
-#include "protocol/serial.h"
-
bool process_printer(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 35b6351e9d..5ecc183327 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -263,7 +263,7 @@ bool process_record_quantum(keyrecord_t *record) {
#ifdef TAP_DANCE_ENABLE
process_tap_dance(keycode, record) &&
#endif
-#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)
+#if defined(UNICODE_COMMON_ENABLE)
process_unicode_common(keycode, record) &&
#endif
#ifdef LEADER_ENABLE
@@ -387,7 +387,7 @@ void matrix_init_quantum() {
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_init();
#endif
-#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)
+#if defined(UNICODE_COMMON_ENABLE)
unicode_input_mode_init();
#endif
#ifdef HAPTIC_ENABLE
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 6927884e2f..5d3a665887 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -109,6 +109,10 @@ extern layer_state_t layer_state;
# include "process_unicodemap.h"
#endif
+#ifdef UNICODE_COMMON_ENABLE
+# include "process_unicode_common.h"
+#endif
+
#ifdef KEY_OVERRIDE_ENABLE
# include "process_key_override.h"
#endif
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index e4d0167aac..3950a3bcae 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -597,6 +597,8 @@ enum quantum_keycodes {
MACRO_30,
MACRO_31,
+ MAGIC_TOGGLE_CONTROL_CAPSLOCK,
+
// Start of custom keycode range for keyboards and keymaps - always leave at the end
SAFE_RANGE
};
@@ -749,6 +751,7 @@ enum quantum_keycodes {
#define CL_NORM MAGIC_UNSWAP_CONTROL_CAPSLOCK
#define CL_CTRL MAGIC_CAPSLOCK_TO_CONTROL
#define CL_CAPS MAGIC_UNCAPSLOCK_TO_CONTROL
+#define CL_TOGG MAGIC_TOGGLE_CONTROL_CAPSLOCK
#define LCG_SWP MAGIC_SWAP_LCTL_LGUI
#define LCG_NRM MAGIC_UNSWAP_LCTL_LGUI