Modifier event, tweaks for linker script.

This commit is contained in:
Pete Johanson
2020-06-30 10:43:09 -04:00
parent 9a991bf019
commit 96ec16da92
8 changed files with 73 additions and 41 deletions

View File

@@ -1,16 +1,10 @@
#include <linker/linker-defs.h>
SECTION_PROLOGUE(event_types,,)
{
__event_type_start = .; \
KEEP(*(".event_type")); \
__event_type_end = .; \
} GROUP_LINK_IN(ROMABLE_REGION)
SECTION_PROLOGUE(event_subscriptions,,)
{
__event_subscriptions_start = .; \
KEEP(*(".event_subscription")); \
__event_subscriptions_end = .; \
} GROUP_LINK_IN(ROMABLE_REGION)

View File

@@ -2,14 +2,8 @@
#include <zmk/keys.h>
int zmk_events_position_pressed(u32_t position);
int zmk_events_position_released(u32_t position);
int zmk_events_keycode_pressed(u8_t usage_page, u32_t keycode);
int zmk_events_keycode_released(u8_t usage_page, u32_t keycode);
int zmk_events_modifiers_pressed(zmk_mod_flags modifiers);
int zmk_events_modifiers_released(zmk_mod_flags modifiers);
int zmk_events_consumer_key_pressed(u32_t usage);
int zmk_events_consumer_key_released(u32_t usage);
// TODO: Encoders?
// TODO: Sensors?

View File

@@ -10,4 +10,14 @@ struct keycode_state_changed {
bool state;
};
ZMK_EVENT_DECLARE(keycode_state_changed);
ZMK_EVENT_DECLARE(keycode_state_changed);
inline struct keycode_state_changed* create_keycode_state_changed(u8_t usage_page, u32_t keycode, bool state)
{
struct keycode_state_changed* ev = new_keycode_state_changed();
ev->usage_page = usage_page;
ev->keycode = keycode;
ev->state = state;
return ev;
}

View File

@@ -0,0 +1,22 @@
#pragma once
#include <zephyr.h>
#include <zmk/keys.h>
#include <zmk/event-manager.h>
struct modifiers_state_changed {
struct zmk_event_header header;
zmk_mod_flags modifiers;
bool state;
};
ZMK_EVENT_DECLARE(modifiers_state_changed);
inline struct modifiers_state_changed* create_modifiers_state_changed(zmk_mod_flags modifiers, bool state)
{
struct modifiers_state_changed* ev = new_modifiers_state_changed();
ev->modifiers = modifiers;
ev->state = state;
return ev;
}