diff --git a/app/include/zmk/split/bluetooth/service.h b/app/include/zmk/split/service.h similarity index 68% rename from app/include/zmk/split/bluetooth/service.h rename to app/include/zmk/split/service.h index 112cd5529424..fe237145b4f1 100644 --- a/app/include/zmk/split/bluetooth/service.h +++ b/app/include/zmk/split/service.h @@ -30,8 +30,8 @@ struct zmk_split_run_behavior_payload { 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); -int zmk_split_bt_sensor_triggered(uint8_t sensor_index, - const struct zmk_sensor_channel_data channel_data[], - size_t channel_data_size); +int zmk_split_position_pressed(uint8_t position); +int zmk_split_position_released(uint8_t position); +int zmk_split_sensor_triggered(uint8_t sensor_index, + const struct zmk_sensor_channel_data channel_data[], + size_t channel_data_size); diff --git a/app/src/split/CMakeLists.txt b/app/src/split/CMakeLists.txt index 27abb82ad064..c89c55e39bd1 100644 --- a/app/src/split/CMakeLists.txt +++ b/app/src/split/CMakeLists.txt @@ -1,6 +1,10 @@ # Copyright (c) 2022 The ZMK Contributors # SPDX-License-Identifier: MIT +if (NOT CONFIG_ZMK_SPLIT_ROLE_CENTRAL) + target_sources(app PRIVATE listener.c) +endif() + if (CONFIG_ZMK_SPLIT_BLE) add_subdirectory(bluetooth) endif() \ No newline at end of file diff --git a/app/src/split/bluetooth/CMakeLists.txt b/app/src/split/bluetooth/CMakeLists.txt index 241a9b8d8c09..2a35f91ceff1 100644 --- a/app/src/split/bluetooth/CMakeLists.txt +++ b/app/src/split/bluetooth/CMakeLists.txt @@ -2,10 +2,9 @@ # SPDX-License-Identifier: MIT if (NOT CONFIG_ZMK_SPLIT_ROLE_CENTRAL) - target_sources(app PRIVATE split_listener.c) target_sources(app PRIVATE service.c) target_sources(app PRIVATE peripheral.c) endif() if (CONFIG_ZMK_SPLIT_ROLE_CENTRAL) target_sources(app PRIVATE central.c) -endif() \ No newline at end of file +endif() diff --git a/app/src/split/bluetooth/central.c b/app/src/split/bluetooth/central.c index 3635322431c2..2070ff13f74f 100644 --- a/app/src/split/bluetooth/central.c +++ b/app/src/split/bluetooth/central.c @@ -23,7 +23,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include #include -#include +#include #include #include #include diff --git a/app/src/split/bluetooth/service.c b/app/src/split/bluetooth/service.c index 0072cf8c8357..9a577b5b0cf1 100644 --- a/app/src/split/bluetooth/service.c +++ b/app/src/split/bluetooth/service.c @@ -20,7 +20,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include #include -#include +#include #if IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS) #include @@ -203,12 +203,12 @@ int send_position_state() { return 0; } -int zmk_split_bt_position_pressed(uint8_t position) { +int zmk_split_position_pressed(uint8_t position) { WRITE_BIT(position_state[position / 8], position % 8, true); return send_position_state(); } -int zmk_split_bt_position_released(uint8_t position) { +int zmk_split_position_released(uint8_t position) { WRITE_BIT(position_state[position / 8], position % 8, false); return send_position_state(); } @@ -250,9 +250,9 @@ int send_sensor_state(struct sensor_event ev) { return 0; } -int zmk_split_bt_sensor_triggered(uint8_t sensor_index, - const struct zmk_sensor_channel_data channel_data[], - size_t channel_data_size) { +int zmk_split_sensor_triggered(uint8_t sensor_index, + const struct zmk_sensor_channel_data channel_data[], + size_t channel_data_size) { if (channel_data_size > ZMK_SENSOR_EVENT_MAX_CHANNELS) { return -EINVAL; } diff --git a/app/src/split/bluetooth/split_listener.c b/app/src/split/listener.c similarity index 75% rename from app/src/split/bluetooth/split_listener.c rename to app/src/split/listener.c index 9b680d2c89cd..d7a144de57fa 100644 --- a/app/src/split/bluetooth/split_listener.c +++ b/app/src/split/listener.c @@ -7,7 +7,7 @@ #include #include -#include +#include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); @@ -23,17 +23,17 @@ int split_listener(const zmk_event_t *eh) { const struct zmk_position_state_changed *pos_ev; if ((pos_ev = as_zmk_position_state_changed(eh)) != NULL) { if (pos_ev->state) { - return zmk_split_bt_position_pressed(pos_ev->position); + return zmk_split_position_pressed(pos_ev->position); } else { - return zmk_split_bt_position_released(pos_ev->position); + return zmk_split_position_released(pos_ev->position); } } #if ZMK_KEYMAP_HAS_SENSORS const struct zmk_sensor_event *sensor_ev; if ((sensor_ev = as_zmk_sensor_event(eh)) != NULL) { - return zmk_split_bt_sensor_triggered(sensor_ev->sensor_index, sensor_ev->channel_data, - sensor_ev->channel_data_size); + return zmk_split_sensor_triggered(sensor_ev->sensor_index, sensor_ev->channel_data, + sensor_ev->channel_data_size); } #endif /* ZMK_KEYMAP_HAS_SENSORS */ return ZMK_EV_EVENT_BUBBLE;