From 4e4faca67015df3a3e1bf1b9937265f465c5093d Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Sun, 20 Dec 2020 09:49:42 -0500 Subject: feature(split): behavior locality support. * GATT characteristic allowing passng data + behavior label to invoke the behavior on the peripheral side. * Behaviors have a locality setting to specify where they run. * Build reset/power/RGB on peripheral. --- app/include/zmk/split/bluetooth/central.h | 8 ++++++++ app/include/zmk/split/bluetooth/service.h | 14 ++++++++++++++ app/include/zmk/split/bluetooth/uuid.h | 1 + 3 files changed, 23 insertions(+) create mode 100644 app/include/zmk/split/bluetooth/central.h (limited to 'app/include/zmk/split') 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 +#include + +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) -- cgit v1.2.3