From c68e596f32c5d450a714627871408407e9988ef7 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Mon, 13 Feb 2017 08:03:07 +0700 Subject: Implement faux-clicky feature --- tmk_core/common/action.c | 13 +++++++++++++ tmk_core/common/keyboard.c | 6 ++++++ 2 files changed, 19 insertions(+) (limited to 'tmk_core/common') diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index f03670a7f..94de36918 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -33,6 +33,9 @@ along with this program. If not, see . #include "nodebug.h" #endif +#ifdef FAUXCLICKY_ENABLE +#include +#endif void action_exec(keyevent_t event) { @@ -41,6 +44,16 @@ void action_exec(keyevent_t event) dprint("EVENT: "); debug_event(event); dprintln(); } +#ifdef FAUXCLICKY_ENABLE + if (IS_PRESSED(event)) { + FAUXCLICKY_ACTION_PRESS; + } + if (IS_RELEASED(event)) { + FAUXCLICKY_ACTION_RELEASE; + } + fauxclicky_check(); +#endif + #ifdef ONEHAND_ENABLE if (!IS_NOEVENT(event)) { process_hand_swap(&event); diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 3aa82231b..eac1f1dd8 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -51,6 +51,9 @@ along with this program. If not, see . #ifdef RGBLIGHT_ENABLE # include "rgblight.h" #endif +#ifdef FAUXCLICKY_ENABLE +# include "fauxclicky.h" +#endif #ifdef SERIAL_LINK_ENABLE # include "serial_link/system/serial_link.h" #endif @@ -108,6 +111,9 @@ void keyboard_init(void) { #ifdef RGBLIGHT_ENABLE rgblight_init(); #endif +#ifdef FAUXCLICKY_ENABLE + fauxclicky_init(); +#endif #if defined(NKRO_ENABLE) && defined(FORCE_NKRO) keymap_config.nkro = 1; #endif -- cgit v1.2.3 From d369bfb83a74d94ed0fbb13f8ee3a8a1146da770 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Wed, 15 Feb 2017 05:02:15 +0700 Subject: Add layer_state_set_kb hook --- tmk_core/common/action_layer.c | 6 ++++++ tmk_core/common/action_layer.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'tmk_core/common') diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index a3c757964..3363a2e53 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -57,8 +57,14 @@ void default_layer_xor(uint32_t state) */ uint32_t layer_state = 0; +__attribute__((weak)) +uint32_t layer_state_set_kb(uint32_t state) { + return state; +} + static void layer_state_set(uint32_t state) { + state = layer_state_set_kb(state); dprint("layer_state: "); layer_debug(); dprint(" to "); layer_state = state; diff --git a/tmk_core/common/action_layer.h b/tmk_core/common/action_layer.h index 025cf5420..fc714700d 100644 --- a/tmk_core/common/action_layer.h +++ b/tmk_core/common/action_layer.h @@ -69,6 +69,8 @@ void layer_xor(uint32_t state); #define layer_xor(state) #define layer_debug() +__attribute__((weak)) +void layer_state_set_kb(uint32_t oldstate, uint32_t newstate); #endif /* pressed actions cache */ -- cgit v1.2.3 From d96175937bfa9f700d9ee54c20e5d963c12d02df Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Wed, 15 Feb 2017 05:19:31 +0700 Subject: Bug fix & added default_layer_state_set_kb --- tmk_core/common/action_layer.c | 6 ++++++ tmk_core/common/action_layer.h | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'tmk_core/common') diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index 3363a2e53..58d919a04 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -16,8 +16,14 @@ */ uint32_t default_layer_state = 0; +__attribute__((weak)) +uint32_t default_layer_state_set_kb(uint32_t state) { + return state; +} + static void default_layer_state_set(uint32_t state) { + state = default_layer_state_set_kb(state); debug("default_layer_state: "); default_layer_debug(); debug(" to "); default_layer_state = state; diff --git a/tmk_core/common/action_layer.h b/tmk_core/common/action_layer.h index fc714700d..785bb5be4 100644 --- a/tmk_core/common/action_layer.h +++ b/tmk_core/common/action_layer.h @@ -27,7 +27,10 @@ along with this program. If not, see . */ extern uint32_t default_layer_state; void default_layer_debug(void); -void default_layer_set(uint32_t state); +uint32_t default_layer_set(uint32_t state); + +__attribute__((weak)) +void default_layer_state_set_kb(uint32_t state); #ifndef NO_ACTION_LAYER /* bitwise operation */ @@ -70,7 +73,7 @@ void layer_xor(uint32_t state); #define layer_debug() __attribute__((weak)) -void layer_state_set_kb(uint32_t oldstate, uint32_t newstate); +uint32_t layer_state_set_kb(uint32_t state); #endif /* pressed actions cache */ -- cgit v1.2.3 From bd8d717f1ff2eef42dfef490374a8cee61be5d87 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Wed, 15 Feb 2017 05:25:08 +0700 Subject: Fix bug fix attempt --- tmk_core/common/action_layer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tmk_core/common') diff --git a/tmk_core/common/action_layer.h b/tmk_core/common/action_layer.h index 785bb5be4..d89ed6e5c 100644 --- a/tmk_core/common/action_layer.h +++ b/tmk_core/common/action_layer.h @@ -27,10 +27,10 @@ along with this program. If not, see . */ extern uint32_t default_layer_state; void default_layer_debug(void); -uint32_t default_layer_set(uint32_t state); +void default_layer_set(uint32_t state); __attribute__((weak)) -void default_layer_state_set_kb(uint32_t state); +uint32_t default_layer_state_set_kb(uint32_t state); #ifndef NO_ACTION_LAYER /* bitwise operation */ -- cgit v1.2.3 From d0b4dcc82ce1dd8549c2f7416bf79f4d0c0f23a7 Mon Sep 17 00:00:00 2001 From: Phong Nguyen Date: Sat, 25 Feb 2017 19:49:03 +0700 Subject: Removes redundant {} which cause build failure when DEBUG_ACTION is set --- tmk_core/common/action_tapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tmk_core/common') diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c index e16e11be7..ff78d7f2a 100644 --- a/tmk_core/common/action_tapping.c +++ b/tmk_core/common/action_tapping.c @@ -257,7 +257,7 @@ bool process_tapping(keyrecord_t *keyp) return true; } } else { - if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n") {}; + if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n"); process_record(keyp); return true; } -- cgit v1.2.3