move ifdefs to get rid of wunused warning
This commit is contained in:
parent
a69e54ae3f
commit
b949c99311
2 changed files with 7 additions and 7 deletions
|
@ -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) {
|
|||
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);
|
||||
|
|
|
@ -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,
|
|||
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) {
|
|||
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…
Add table
Reference in a new issue