|
|
|
@ -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); |
|
|
|
|
|
|
|
|
|
#endif /* CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL */ |