summaryrefslogtreecommitdiff
path: root/app/include/zmk
diff options
context:
space:
mode:
Diffstat (limited to 'app/include/zmk')
-rw-r--r--app/include/zmk/events/position_state_changed.h11
-rw-r--r--app/include/zmk/keymap.h5
-rw-r--r--app/include/zmk/split/bluetooth/central.h8
-rw-r--r--app/include/zmk/split/bluetooth/service.h14
-rw-r--r--app/include/zmk/split/bluetooth/uuid.h1
5 files changed, 37 insertions, 2 deletions
diff --git a/app/include/zmk/events/position_state_changed.h b/app/include/zmk/events/position_state_changed.h
index e2f6872..59619db 100644
--- a/app/include/zmk/events/position_state_changed.h
+++ b/app/include/zmk/events/position_state_changed.h
@@ -8,10 +8,19 @@
#include <zephyr.h>
#include <zmk/event_manager.h>
+#include <bluetooth/addr.h>
+
+#if IS_ENABLED(CONFIG_ZMK_BLE)
+typedef const bt_addr_le_t *zmk_position_state_changed_source_t;
+#else
+typedef void *zmk_position_state_changed_source_t;
+#endif
+
struct zmk_position_state_changed {
+ zmk_position_state_changed_source_t source;
uint32_t position;
bool state;
int64_t timestamp;
};
-ZMK_EVENT_DECLARE(zmk_position_state_changed); \ No newline at end of file
+ZMK_EVENT_DECLARE(zmk_position_state_changed);
diff --git a/app/include/zmk/keymap.h b/app/include/zmk/keymap.h
index 7151930..0771542 100644
--- a/app/include/zmk/keymap.h
+++ b/app/include/zmk/keymap.h
@@ -6,6 +6,8 @@
#pragma once
+#include <zmk/events/position_state_changed.h>
+
typedef uint32_t zmk_keymap_layers_state_t;
uint8_t zmk_keymap_layer_default();
@@ -18,7 +20,8 @@ int zmk_keymap_layer_toggle(uint8_t layer);
int zmk_keymap_layer_to(uint8_t layer);
const char *zmk_keymap_layer_label(uint8_t layer);
-int zmk_keymap_position_state_changed(uint32_t position, bool pressed, int64_t timestamp);
+int zmk_keymap_position_state_changed(zmk_position_state_changed_source_t source, uint32_t position,
+ bool pressed, int64_t timestamp);
#define ZMK_KEYMAP_EXTRACT_BINDING(idx, drv_inst) \
{ \
diff --git a/app/include/zmk/split/bluetooth/central.h b/app/include/zmk/split/bluetooth/central.h
new file mode 100644
index 0000000..ab46a8f
--- /dev/null
+++ b/app/include/zmk/split/bluetooth/central.h
@@ -0,0 +1,8 @@
+
+#pragma once
+
+#include <bluetooth/addr.h>
+#include <zmk/behavior.h>
+
+int zmk_split_bt_invoke_behavior(const bt_addr_le_t *source, struct zmk_behavior_binding *binding,
+ struct zmk_behavior_binding_event event, bool state); \ No newline at end of file
diff --git a/app/include/zmk/split/bluetooth/service.h b/app/include/zmk/split/bluetooth/service.h
index b9f9fc3..f0c1d79 100644
--- a/app/include/zmk/split/bluetooth/service.h
+++ b/app/include/zmk/split/bluetooth/service.h
@@ -6,5 +6,19 @@
#pragma once
+#define ZMK_SPLIT_RUN_BEHAVIOR_DEV_LEN 9
+
+struct zmk_split_run_behavior_data {
+ uint8_t position;
+ uint8_t state;
+ uint32_t param1;
+ uint32_t param2;
+} __packed;
+
+struct zmk_split_run_behavior_payload {
+ struct zmk_split_run_behavior_data data;
+ char behavior_dev[ZMK_SPLIT_RUN_BEHAVIOR_DEV_LEN];
+} __packed;
+
int zmk_split_bt_position_pressed(uint8_t position);
int zmk_split_bt_position_released(uint8_t position); \ No newline at end of file
diff --git a/app/include/zmk/split/bluetooth/uuid.h b/app/include/zmk/split/bluetooth/uuid.h
index a31884d..735f575 100644
--- a/app/include/zmk/split/bluetooth/uuid.h
+++ b/app/include/zmk/split/bluetooth/uuid.h
@@ -15,3 +15,4 @@
#define ZMK_BT_SPLIT_UUID(num) BT_UUID_128_ENCODE(num, 0x0096, 0x7107, 0xc967, 0xc5cfb1c2482a)
#define ZMK_SPLIT_BT_SERVICE_UUID ZMK_BT_SPLIT_UUID(0x00000000)
#define ZMK_SPLIT_BT_CHAR_POSITION_STATE_UUID ZMK_BT_SPLIT_UUID(0x00000001)
+#define ZMK_SPLIT_BT_CHAR_RUN_BEHAVIOR_UUID ZMK_BT_SPLIT_UUID(0x00000002)