* Move to local/stack allocated event API that doesn't require dynamic allocation/freeing. * Disable heap, we no longer use alloc/free unless using LVGL. * Tons of refactors all over to account for the new event approach.
26 lines
714 B
C
26 lines
714 B
C
|
|
/*
|
|
* Copyright (c) 2020 The ZMK Contributors
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <zmk/hid.h>
|
|
#include <zmk/event_manager.h>
|
|
#include <zmk/mouse.h>
|
|
|
|
struct zmk_mouse_button_state_changed {
|
|
zmk_mouse_button_t buttons;
|
|
bool state;
|
|
int64_t timestamp;
|
|
};
|
|
|
|
ZMK_EVENT_DECLARE(zmk_mouse_button_state_changed);
|
|
|
|
static inline int raise_zmk_mouse_button_state_changed_from_encoded(uint32_t encoded, bool pressed,
|
|
int64_t timestamp) {
|
|
return raise_zmk_mouse_button_state_changed((struct zmk_mouse_button_state_changed){
|
|
.buttons = ZMK_HID_USAGE_ID(encoded), .state = pressed, .timestamp = timestamp});
|
|
}
|