summaryrefslogtreecommitdiff
path: root/quantum/process_keycode/process_auto_shift.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/process_keycode/process_auto_shift.c')
-rw-r--r--quantum/process_keycode/process_auto_shift.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c
index bbc6367ff1..2150edd7b2 100644
--- a/quantum/process_keycode/process_auto_shift.c
+++ b/quantum/process_keycode/process_auto_shift.c
@@ -62,7 +62,9 @@ static struct {
62// clang-format on 62// clang-format on
63 63
64/** \brief Called on physical press, returns whether key should be added to Auto Shift */ 64/** \brief Called on physical press, returns whether key should be added to Auto Shift */
65__attribute__((weak)) bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record) { return false; } 65__attribute__((weak)) bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record) {
66 return false;
67}
66 68
67/** \brief Called on physical press, returns whether is Auto Shift key */ 69/** \brief Called on physical press, returns whether is Auto Shift key */
68__attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) { 70__attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) {
@@ -82,8 +84,12 @@ __attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *r
82} 84}
83 85
84/** \brief Called to check whether defines should apply if PER_KEY is set for it */ 86/** \brief Called to check whether defines should apply if PER_KEY is set for it */
85__attribute__((weak)) bool get_auto_shift_repeat(uint16_t keycode, keyrecord_t *record) { return true; } 87__attribute__((weak)) bool get_auto_shift_repeat(uint16_t keycode, keyrecord_t *record) {
86__attribute__((weak)) bool get_auto_shift_no_auto_repeat(uint16_t keycode, keyrecord_t *record) { return true; } 88 return true;
89}
90__attribute__((weak)) bool get_auto_shift_no_auto_repeat(uint16_t keycode, keyrecord_t *record) {
91 return true;
92}
87 93
88/** \brief Called when an Auto Shift key needs to be pressed */ 94/** \brief Called when an Auto Shift key needs to be pressed */
89__attribute__((weak)) void autoshift_press_user(uint16_t keycode, bool shifted, keyrecord_t *record) { 95__attribute__((weak)) void autoshift_press_user(uint16_t keycode, bool shifted, keyrecord_t *record) {
@@ -94,7 +100,9 @@ __attribute__((weak)) void autoshift_press_user(uint16_t keycode, bool shifted,
94} 100}
95 101
96/** \brief Called when an Auto Shift key needs to be released */ 102/** \brief Called when an Auto Shift key needs to be released */
97__attribute__((weak)) void autoshift_release_user(uint16_t keycode, bool shifted, keyrecord_t *record) { unregister_code16((IS_RETRO(keycode)) ? keycode & 0xFF : keycode); } 103__attribute__((weak)) void autoshift_release_user(uint16_t keycode, bool shifted, keyrecord_t *record) {
104 unregister_code16((IS_RETRO(keycode)) ? keycode & 0xFF : keycode);
105}
98 106
99/** \brief Sets the shift state to use when keyrepeating, required by custom shifts */ 107/** \brief Sets the shift state to use when keyrepeating, required by custom shifts */
100void set_autoshift_shift_state(uint16_t keycode, bool shifted) { 108void set_autoshift_shift_state(uint16_t keycode, bool shifted) {
@@ -311,7 +319,9 @@ void autoshift_toggle(void) {
311 autoshift_flush_shift(); 319 autoshift_flush_shift();
312} 320}
313 321
314void autoshift_enable(void) { autoshift_flags.enabled = true; } 322void autoshift_enable(void) {
323 autoshift_flags.enabled = true;
324}
315 325
316void autoshift_disable(void) { 326void autoshift_disable(void) {
317 autoshift_flags.enabled = false; 327 autoshift_flags.enabled = false;
@@ -328,12 +338,20 @@ void autoshift_timer_report(void) {
328} 338}
329# endif 339# endif
330 340
331bool get_autoshift_state(void) { return autoshift_flags.enabled; } 341bool get_autoshift_state(void) {
342 return autoshift_flags.enabled;
343}
332 344
333uint16_t get_generic_autoshift_timeout() { return autoshift_timeout; } 345uint16_t get_generic_autoshift_timeout() {
334__attribute__((weak)) uint16_t get_autoshift_timeout(uint16_t keycode, keyrecord_t *record) { return autoshift_timeout; } 346 return autoshift_timeout;
347}
348__attribute__((weak)) uint16_t get_autoshift_timeout(uint16_t keycode, keyrecord_t *record) {
349 return autoshift_timeout;
350}
335 351
336void set_autoshift_timeout(uint16_t timeout) { autoshift_timeout = timeout; } 352void set_autoshift_timeout(uint16_t timeout) {
353 autoshift_timeout = timeout;
354}
337 355
338bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { 356bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
339 // Note that record->event.time isn't reliable, see: 357 // Note that record->event.time isn't reliable, see: