exposing caps word state
This commit is contained in:
parent
85e31544e6
commit
8d0cf0a8fe
4 changed files with 26 additions and 0 deletions
|
@ -60,6 +60,7 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
target_sources(app PRIVATE src/events/endpoint_selection_changed.c)
|
target_sources(app PRIVATE src/events/endpoint_selection_changed.c)
|
||||||
target_sources(app PRIVATE src/hid_listener.c)
|
target_sources(app PRIVATE src/hid_listener.c)
|
||||||
target_sources(app PRIVATE src/keymap.c)
|
target_sources(app PRIVATE src/keymap.c)
|
||||||
|
target_sources(app PRIVATE src/caps_word.c)
|
||||||
target_sources(app PRIVATE src/events/layer_state_changed.c)
|
target_sources(app PRIVATE src/events/layer_state_changed.c)
|
||||||
target_sources(app PRIVATE src/events/modifiers_state_changed.c)
|
target_sources(app PRIVATE src/events/modifiers_state_changed.c)
|
||||||
target_sources(app PRIVATE src/events/keycode_state_changed.c)
|
target_sources(app PRIVATE src/events/keycode_state_changed.c)
|
||||||
|
|
12
app/include/zmk/caps_word.h
Normal file
12
app/include/zmk/caps_word.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
extern bool last_state_of_caps_word;
|
||||||
|
bool zmk_caps_word_state();
|
|
@ -20,6 +20,11 @@
|
||||||
#include <zmk/hid.h>
|
#include <zmk/hid.h>
|
||||||
#include <zmk/keymap.h>
|
#include <zmk/keymap.h>
|
||||||
|
|
||||||
|
#include <zmk/caps_word.h>
|
||||||
|
|
||||||
|
bool last_state_of_caps_word = false;
|
||||||
|
//bool zmk_caps_word_state() { return last_state_of_caps_word; }
|
||||||
|
|
||||||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||||
|
|
||||||
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
|
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
|
||||||
|
@ -44,12 +49,14 @@ struct behavior_caps_word_data {
|
||||||
static void activate_caps_word(const struct device *dev) {
|
static void activate_caps_word(const struct device *dev) {
|
||||||
struct behavior_caps_word_data *data = dev->data;
|
struct behavior_caps_word_data *data = dev->data;
|
||||||
|
|
||||||
|
last_state_of_caps_word = true;
|
||||||
data->active = true;
|
data->active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deactivate_caps_word(const struct device *dev) {
|
static void deactivate_caps_word(const struct device *dev) {
|
||||||
struct behavior_caps_word_data *data = dev->data;
|
struct behavior_caps_word_data *data = dev->data;
|
||||||
|
|
||||||
|
last_state_of_caps_word = false;
|
||||||
data->active = false;
|
data->active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
app/src/caps_word.c
Normal file
6
app/src/caps_word.c
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#include <zmk/caps_word.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <kernel.h>
|
||||||
|
|
||||||
|
bool zmk_caps_word_state() { return last_state_of_caps_word; }
|
Loading…
Add table
Reference in a new issue