summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/include/zmk/behavior.h3
-rw-r--r--app/src/behaviors/behavior_bt.c2
-rw-r--r--app/src/behaviors/behavior_ext_power.c2
-rw-r--r--app/src/behaviors/behavior_hold_tap.c10
-rw-r--r--app/src/behaviors/behavior_none.c4
-rw-r--r--app/src/behaviors/behavior_reset.c2
-rw-r--r--app/src/behaviors/behavior_rgb_underglow.c2
-rw-r--r--app/src/behaviors/behavior_sticky_key.c8
-rw-r--r--app/src/behaviors/behavior_toggle_layer.c2
-rw-r--r--app/src/behaviors/behavior_transparent.c4
10 files changed, 21 insertions, 18 deletions
diff --git a/app/include/zmk/behavior.h b/app/include/zmk/behavior.h
index f00ea4f..31fb43e 100644
--- a/app/include/zmk/behavior.h
+++ b/app/include/zmk/behavior.h
@@ -6,6 +6,9 @@
#pragma once
+#define ZMK_BEHAVIOR_OPAQUE 0
+#define ZMK_BEHAVIOR_TRANSPARENT 1
+
struct zmk_behavior_binding {
char *behavior_dev;
uint32_t param1;
diff --git a/app/src/behaviors/behavior_bt.c b/app/src/behaviors/behavior_bt.c
index bfafc4b..3149c8c 100644
--- a/app/src/behaviors/behavior_bt.c
+++ b/app/src/behaviors/behavior_bt.c
@@ -39,7 +39,7 @@ static int behavior_bt_init(const struct device *dev) { return 0; };
static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
static const struct behavior_driver_api behavior_bt_driver_api = {
diff --git a/app/src/behaviors/behavior_ext_power.c b/app/src/behaviors/behavior_ext_power.c
index dbc6fd9..18520f7 100644
--- a/app/src/behaviors/behavior_ext_power.c
+++ b/app/src/behaviors/behavior_ext_power.c
@@ -43,7 +43,7 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
static int behavior_ext_power_init(const struct device *dev) { return 0; };
diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c
index 7ad1d32..9b62eb1 100644
--- a/app/src/behaviors/behavior_hold_tap.c
+++ b/app/src/behaviors/behavior_hold_tap.c
@@ -310,7 +310,7 @@ static int on_hold_tap_binding_pressed(struct zmk_behavior_binding *binding,
if (undecided_hold_tap != NULL) {
LOG_DBG("ERROR another hold-tap behavior is undecided.");
// if this happens, make sure the behavior events occur AFTER other position events.
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
struct active_hold_tap *hold_tap =
@@ -318,7 +318,7 @@ static int on_hold_tap_binding_pressed(struct zmk_behavior_binding *binding,
if (hold_tap == NULL) {
LOG_ERR("unable to store hold-tap info, did you press more than %d hold-taps?",
ZMK_BHV_HOLD_TAP_MAX_HELD);
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
LOG_DBG("%d new undecided hold_tap", event.position);
@@ -331,7 +331,7 @@ static int on_hold_tap_binding_pressed(struct zmk_behavior_binding *binding,
k_delayed_work_submit(&hold_tap->work, K_MSEC(tapping_term_ms_left));
}
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
static int on_hold_tap_binding_released(struct zmk_behavior_binding *binding,
@@ -339,7 +339,7 @@ static int on_hold_tap_binding_released(struct zmk_behavior_binding *binding,
struct active_hold_tap *hold_tap = find_hold_tap(event.position);
if (hold_tap == NULL) {
LOG_ERR("ACTIVE_HOLD_TAP_CLEANED_UP_TOO_EARLY");
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
// If these events were queued, the timer event may be queued too late or not at all.
@@ -379,7 +379,7 @@ static int on_hold_tap_binding_released(struct zmk_behavior_binding *binding,
clear_hold_tap(hold_tap);
}
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
static const struct behavior_driver_api behavior_hold_tap_driver_api = {
diff --git a/app/src/behaviors/behavior_none.c b/app/src/behaviors/behavior_none.c
index 12542f0..e0eaa15 100644
--- a/app/src/behaviors/behavior_none.c
+++ b/app/src/behaviors/behavior_none.c
@@ -22,12 +22,12 @@ static int behavior_none_init(const struct device *dev) { return 0; };
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
static const struct behavior_driver_api behavior_none_driver_api = {
diff --git a/app/src/behaviors/behavior_reset.c b/app/src/behaviors/behavior_reset.c
index cb77a83..e4b720f 100644
--- a/app/src/behaviors/behavior_reset.c
+++ b/app/src/behaviors/behavior_reset.c
@@ -30,7 +30,7 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
// See
// https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/d6b28e66053eea467166f44875e3c7ec741cb471/src/main.c#L107
sys_reboot(cfg->type);
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
static const struct behavior_driver_api behavior_reset_driver_api = {
diff --git a/app/src/behaviors/behavior_rgb_underglow.c b/app/src/behaviors/behavior_rgb_underglow.c
index a0db9a9..399123a 100644
--- a/app/src/behaviors/behavior_rgb_underglow.c
+++ b/app/src/behaviors/behavior_rgb_underglow.c
@@ -50,7 +50,7 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
static const struct behavior_driver_api behavior_rgb_underglow_driver_api = {
diff --git a/app/src/behaviors/behavior_sticky_key.c b/app/src/behaviors/behavior_sticky_key.c
index 271b168..15c9e21 100644
--- a/app/src/behaviors/behavior_sticky_key.c
+++ b/app/src/behaviors/behavior_sticky_key.c
@@ -138,12 +138,12 @@ static int on_sticky_key_binding_pressed(struct zmk_behavior_binding *binding,
if (sticky_key == NULL) {
LOG_ERR("unable to store sticky key, did you press more than %d sticky_key?",
ZMK_BHV_STICKY_KEY_MAX_HELD);
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
press_sticky_key_behavior(sticky_key, event.timestamp);
LOG_DBG("%d new sticky_key", event.position);
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
static int on_sticky_key_binding_released(struct zmk_behavior_binding *binding,
@@ -151,7 +151,7 @@ static int on_sticky_key_binding_released(struct zmk_behavior_binding *binding,
struct active_sticky_key *sticky_key = find_sticky_key(event.position);
if (sticky_key == NULL) {
LOG_ERR("ACTIVE STICKY KEY CLEARED TOO EARLY");
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
if (sticky_key->modified_key_usage_page != 0 && sticky_key->modified_key_keycode != 0) {
@@ -167,7 +167,7 @@ static int on_sticky_key_binding_released(struct zmk_behavior_binding *binding,
if (ms_left > 0) {
k_delayed_work_submit(&sticky_key->release_timer, K_MSEC(ms_left));
}
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
static const struct behavior_driver_api behavior_sticky_key_driver_api = {
diff --git a/app/src/behaviors/behavior_toggle_layer.c b/app/src/behaviors/behavior_toggle_layer.c
index 3283377..21daa00 100644
--- a/app/src/behaviors/behavior_toggle_layer.c
+++ b/app/src/behaviors/behavior_toggle_layer.c
@@ -29,7 +29,7 @@ static int tog_keymap_binding_pressed(struct zmk_behavior_binding *binding,
static int tog_keymap_binding_released(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
LOG_DBG("position %d layer %d", event.position, binding->param1);
- return 0;
+ return ZMK_BEHAVIOR_OPAQUE;
}
static const struct behavior_driver_api behavior_tog_driver_api = {
diff --git a/app/src/behaviors/behavior_transparent.c b/app/src/behaviors/behavior_transparent.c
index 17a5e43..ca3d279 100644
--- a/app/src/behaviors/behavior_transparent.c
+++ b/app/src/behaviors/behavior_transparent.c
@@ -22,12 +22,12 @@ static int behavior_transparent_init(const struct device *dev) { return 0; };
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
- return 1;
+ return ZMK_BEHAVIOR_TRANSPARENT;
}
static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
- return 1;
+ return ZMK_BEHAVIOR_TRANSPARENT;
}
static const struct behavior_driver_api behavior_transparent_driver_api = {