2020-12-10 01:35:57 +11:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 The ZMK Contributors
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <zephyr.h>
|
2020-12-23 02:56:00 +11:00
|
|
|
#include <zmk/event_manager.h>
|
2020-12-10 01:35:57 +11:00
|
|
|
|
|
|
|
struct layer_state_changed {
|
|
|
|
struct zmk_event_header header;
|
2020-12-03 03:41:57 +11:00
|
|
|
uint8_t layer;
|
2020-12-10 01:35:57 +11:00
|
|
|
bool state;
|
2020-12-03 03:41:57 +11:00
|
|
|
int64_t timestamp;
|
2020-12-10 01:35:57 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
ZMK_EVENT_DECLARE(layer_state_changed);
|
|
|
|
|
2020-12-03 03:41:57 +11:00
|
|
|
static inline struct layer_state_changed *create_layer_state_changed(uint8_t layer, bool state) {
|
2020-12-10 01:35:57 +11:00
|
|
|
struct layer_state_changed *ev = new_layer_state_changed();
|
|
|
|
ev->layer = layer;
|
|
|
|
ev->state = state;
|
|
|
|
ev->timestamp = k_uptime_get();
|
|
|
|
|
|
|
|
return ev;
|
|
|
|
}
|