Browse Source

move ifdefs to get rid of wunused warning

xmkb
Shawn Meier 3 years ago committed by Julia Luna
parent
commit
c790c0a551
Signed by: xenua
GPG Key ID: 6A0C04FA9A7D7582
  1. 4
      app/src/mouse/key_listener.c
  2. 10
      app/src/mouse/tick_listener.c

4
app/src/mouse/key_listener.c

@ -18,6 +18,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); @@ -18,6 +18,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/endpoints.h>
#include <zmk/mouse.h>
//TODO: There is probably a better flag to use here
#if(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
static struct vector2d move_speed = {0};
static struct vector2d scroll_speed = {0};
static struct mouse_config move_config = (struct mouse_config){0};
@ -45,8 +47,6 @@ void mouse_clear_cb(struct k_timer *dummy) { @@ -45,8 +47,6 @@ void mouse_clear_cb(struct k_timer *dummy) {
k_work_submit_to_queue(zmk_mouse_work_q(), &mouse_clear);
}
//TODO: There is probably a better flag to use here
#if(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
static void mouse_tick_timer_handler(struct k_work *work) {
zmk_hid_mouse_movement_set(0, 0);
zmk_hid_mouse_scroll_set(0, 0);

10
app/src/mouse/tick_listener.c

@ -16,6 +16,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); @@ -16,6 +16,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <sys/util.h> // CLAMP
//TODO: probably a better flag to use here
#if(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
#if CONFIG_MINIMAL_LIBC
static float powf(float base, float exponent) {
// poor man's power implementation rounds the exponent down to the nearest integer.
@ -79,7 +81,6 @@ static struct vector2d update_movement(struct vector2d *remainder, @@ -79,7 +81,6 @@ static struct vector2d update_movement(struct vector2d *remainder,
return move;
}
#if(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
static void mouse_tick_handler(const struct zmk_mouse_tick *tick) {
struct vector2d move = update_movement(&move_remainder, &(tick->move_config), tick->max_move,
tick->timestamp, tick->start_time);
@ -90,18 +91,17 @@ static void mouse_tick_handler(const struct zmk_mouse_tick *tick) { @@ -90,18 +91,17 @@ static void mouse_tick_handler(const struct zmk_mouse_tick *tick) {
zmk_hid_mouse_scroll_update((int8_t)CLAMP(scroll.x, INT8_MIN, INT8_MAX),
(int8_t)CLAMP(scroll.y, INT8_MIN, INT8_MAX));
}
#endif
int zmk_mouse_tick_listener(const zmk_event_t *eh) {
const struct zmk_mouse_tick *tick = as_zmk_mouse_tick(eh);
#if(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
if (tick) {
mouse_tick_handler(tick);
return 0;
}
#endif
return 0;
}
ZMK_LISTENER(zmk_mouse_tick_listener, zmk_mouse_tick_listener);
ZMK_SUBSCRIPTION(zmk_mouse_tick_listener, zmk_mouse_tick);
ZMK_SUBSCRIPTION(zmk_mouse_tick_listener, zmk_mouse_tick);
#endif /* CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL */
Loading…
Cancel
Save