Browse Source

refactor(hold-tap): simplify flavor enum

xmkb
Okke Formsma 4 years ago committed by Pete Johanson
parent
commit
6b7026cdd1
  1. 18
      app/src/behaviors/behavior_hold_tap.c

18
app/src/behaviors/behavior_hold_tap.c

@ -31,9 +31,9 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#define ZMK_BHV_HOLD_TAP_POSITION_NOT_USED 9999 #define ZMK_BHV_HOLD_TAP_POSITION_NOT_USED 9999
enum flavor { enum flavor {
ZMK_BHV_HOLD_TAP_FLAVOR_HOLD_PREFERRED = 0, FLAVOR_HOLD_PREFERRED,
ZMK_BHV_HOLD_TAP_FLAVOR_BALANCED = 1, FLAVOR_BALANCED,
ZMK_BHV_HOLD_TAP_FLAVOR_TAP_PREFERRED = 2, FLAVOR_TAP_PREFERRED,
}; };
struct behavior_hold_tap_config { struct behavior_hold_tap_config {
@ -273,11 +273,11 @@ static void decide_hold_preferred(struct active_hold_tap *hold_tap, enum decisio
static inline char *flavor_str(enum flavor flavor) { static inline char *flavor_str(enum flavor flavor) {
switch (flavor) { switch (flavor) {
case ZMK_BHV_HOLD_TAP_FLAVOR_HOLD_PREFERRED: case FLAVOR_HOLD_PREFERRED:
return "hold-preferred"; return "hold-preferred";
case ZMK_BHV_HOLD_TAP_FLAVOR_BALANCED: case FLAVOR_BALANCED:
return "balanced"; return "balanced";
case ZMK_BHV_HOLD_TAP_FLAVOR_TAP_PREFERRED: case FLAVOR_TAP_PREFERRED:
return "tap-preferred"; return "tap-preferred";
} }
return "UNKNOWN FLAVOR"; return "UNKNOWN FLAVOR";
@ -294,11 +294,11 @@ static void decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_mome
} }
switch (hold_tap->config->flavor) { switch (hold_tap->config->flavor) {
case ZMK_BHV_HOLD_TAP_FLAVOR_HOLD_PREFERRED: case FLAVOR_HOLD_PREFERRED:
decide_hold_preferred(hold_tap, event_type); decide_hold_preferred(hold_tap, event_type);
case ZMK_BHV_HOLD_TAP_FLAVOR_BALANCED: case FLAVOR_BALANCED:
decide_balanced(hold_tap, event_type); decide_balanced(hold_tap, event_type);
case ZMK_BHV_HOLD_TAP_FLAVOR_TAP_PREFERRED: case FLAVOR_TAP_PREFERRED:
decide_tap_preferred(hold_tap, event_type); decide_tap_preferred(hold_tap, event_type);
} }

Loading…
Cancel
Save