2020-09-10 13:57:44 +10:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 The ZMK Contributors
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*/
|
|
|
|
|
2020-05-13 04:15:33 +10:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <zephyr.h>
|
2020-05-17 13:26:26 +10:00
|
|
|
#include <dt-bindings/zmk/keys.h>
|
2020-05-13 04:15:33 +10:00
|
|
|
|
2020-12-20 04:32:02 +11:00
|
|
|
typedef uint32_t zmk_key_t;
|
2020-12-20 04:32:40 +11:00
|
|
|
typedef uint8_t zmk_mod_t;
|
2020-12-20 04:33:15 +11:00
|
|
|
typedef uint8_t zmk_mod_flags_t;
|
2020-05-13 04:15:33 +10:00
|
|
|
|
2020-09-14 12:53:24 +10:00
|
|
|
struct zmk_key_event {
|
2020-12-03 03:41:57 +11:00
|
|
|
uint32_t column;
|
|
|
|
uint32_t row;
|
2020-12-20 04:32:02 +11:00
|
|
|
zmk_key_t key;
|
2020-05-13 04:15:33 +10:00
|
|
|
bool pressed;
|
2021-01-23 01:45:51 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline bool is_mod(uint8_t usage_page, uint32_t keycode) {
|
|
|
|
return (keycode >= HID_USAGE_KEY_KEYBOARD_LEFTCONTROL &&
|
|
|
|
keycode <= HID_USAGE_KEY_KEYBOARD_RIGHT_GUI && usage_page == HID_USAGE_KEY);
|
|
|
|
}
|