aboutsummaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorGreg Wright <kwip000@protonmail.com>2020-08-15 16:55:13 -0400
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2020-08-29 14:30:02 -0700
commit568cae28ec41acc84a4a60bc3e20120e33ebee89 (patch)
tree11399d2b3865d08a73249ef6ebbdd14e952804ef /quantum
parent167daa9cf8c6376a1c9b92ae7dfaa8bdac21f62a (diff)
downloadfirmware-568cae28ec41acc84a4a60bc3e20120e33ebee89.tar.gz
firmware-568cae28ec41acc84a4a60bc3e20120e33ebee89.tar.bz2
firmware-568cae28ec41acc84a4a60bc3e20120e33ebee89.zip
#define AUTO_SHIFT_SETUP (#8441)
* #define AUTO_SHIFT_SETUP * Clarification Changed `#ifndef` to `#ifdef` and moved enable disable outside AUTO_SHIFT_SETUP * AUTO_SHIFT_NO_SETUp
Diffstat (limited to 'quantum')
-rw-r--r--quantum/process_keycode/process_auto_shift.c70
-rw-r--r--quantum/quantum_keycodes.h4
2 files changed, 40 insertions, 34 deletions
diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c
index b474bda69..330037cef 100644
--- a/quantum/process_keycode/process_auto_shift.c
+++ b/quantum/process_keycode/process_auto_shift.c
@@ -25,19 +25,6 @@ static uint16_t autoshift_time = 0;
static uint16_t autoshift_timeout = AUTO_SHIFT_TIMEOUT;
static uint16_t autoshift_lastkey = KC_NO;
-void autoshift_timer_report(void) {
- char display[8];
-
- snprintf(display, 8, "\n%d\n", autoshift_timeout);
-
- send_string((const char *)display);
-}
-
-void autoshift_on(uint16_t keycode) {
- autoshift_time = timer_read();
- autoshift_lastkey = keycode;
-}
-
void autoshift_flush(void) {
if (autoshift_lastkey != KC_NO) {
uint16_t elapsed = timer_elapsed(autoshift_time);
@@ -53,21 +40,36 @@ void autoshift_flush(void) {
}
}
-void autoshift_enable(void) { autoshift_enabled = true; }
-void autoshift_disable(void) {
+void autoshift_on(uint16_t keycode) {
+ autoshift_time = timer_read();
+ autoshift_lastkey = keycode;
+}
+
+void autoshift_toggle(void) {
+ if (autoshift_enabled) {
autoshift_enabled = false;
autoshift_flush();
+ } else {
+ autoshift_enabled = true;
+ }
}
-void autoshift_toggle(void) {
- if (autoshift_enabled) {
- autoshift_enabled = false;
- autoshift_flush();
- } else {
- autoshift_enabled = true;
- }
+void autoshift_enable(void) { autoshift_enabled = true; }
+void autoshift_disable(void) {
+ autoshift_enabled = false;
+ autoshift_flush();
}
+#ifndef AUTO_SHIFT_NO_SETUP
+void autoshift_timer_report(void) {
+ char display[8];
+
+ snprintf(display, 8, "\n%d\n", autoshift_timeout);
+
+ send_string((const char *)display);
+}
+#endif
+
bool get_autoshift_state(void) { return autoshift_enabled; }
uint16_t get_autoshift_timeout(void) { return autoshift_timeout; }
@@ -77,21 +79,11 @@ void set_autoshift_timeout(uint16_t timeout) { autoshift_timeout = timeout; }
bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch (keycode) {
- case KC_ASUP:
- autoshift_timeout += 5;
- return true;
-
- case KC_ASDN:
- autoshift_timeout -= 5;
- return true;
-
- case KC_ASRP:
- autoshift_timer_report();
- return true;
case KC_ASTG:
autoshift_toggle();
return true;
+
case KC_ASON:
autoshift_enable();
return true;
@@ -99,6 +91,18 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
autoshift_disable();
return true;
+# ifndef AUTO_SHIFT_NO_SETUP
+ case KC_ASUP:
+ autoshift_timeout += 5;
+ return true;
+ case KC_ASDN:
+ autoshift_timeout -= 5;
+ return true;
+
+ case KC_ASRP:
+ autoshift_timer_report();
+ return true;
+# endif
# ifndef NO_AUTO_SHIFT_ALPHA
case KC_A ... KC_Z:
# endif
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 5e7c9ad33..a0a7bc340 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -123,10 +123,12 @@ enum quantum_keycodes {
KC_LEAD,
#endif
- // Auto Shift setup
+// Auto Shift setup
+#ifndef AUTO_SHIFT_NO_SETUP
KC_ASUP,
KC_ASDN,
KC_ASRP,
+#endif
KC_ASTG,
KC_ASON,
KC_ASOFF,