aboutsummaryrefslogtreecommitdiff
path: root/users/konstantin/konstantin.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/konstantin/konstantin.c')
-rw-r--r--users/konstantin/konstantin.c86
1 files changed, 51 insertions, 35 deletions
diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c
index 3fdf5a4ca..5d80877f0 100644
--- a/users/konstantin/konstantin.c
+++ b/users/konstantin/konstantin.c
@@ -1,3 +1,19 @@
1/* Copyright 2019-2021 Konstantin Đorđević <vomindoraan@gmail.com>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "konstantin.h" 17#include "konstantin.h"
2 18
3__attribute__((weak)) 19__attribute__((weak))
@@ -22,6 +38,41 @@ void keyboard_post_init_user(void) {
22} 38}
23 39
24__attribute__((weak)) 40__attribute__((weak))
41layer_state_t layer_state_set_keymap(layer_state_t state) {
42 return state;
43}
44
45layer_state_t layer_state_set_user(layer_state_t state) {
46 state = layer_state_set_keymap(state);
47
48#ifdef LAYER_NUMPAD
49 bool numpad = IS_LAYER_ON_STATE(state, L_NUMPAD);
50 bool num_lock = IS_HOST_LED_ON(USB_LED_NUM_LOCK);
51 if (numpad != num_lock) {
52 tap_code(KC_NLCK); // Toggle Num Lock to match Numpad layer state
53 }
54#endif
55
56 return state;
57}
58
59__attribute__((weak))
60void led_set_keymap(uint8_t usb_led) {}
61
62void led_set_user(uint8_t usb_led) {
63 led_set_keymap(usb_led);
64}
65
66__attribute__((weak))
67bool led_update_keymap(led_t led_state) {
68 return true;
69}
70
71bool led_update_user(led_t led_state) {
72 return led_update_keymap(led_state);
73}
74
75__attribute__((weak))
25bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { 76bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
26 return true; 77 return true;
27} 78}
@@ -91,38 +142,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
91 142
92 return true; 143 return true;
93} 144}
94
95__attribute__((weak))
96uint32_t layer_state_set_keymap(uint32_t state) {
97 return state;
98}
99
100layer_state_t layer_state_set_user(layer_state_t state) {
101 state = layer_state_set_keymap(state);
102
103#ifdef LAYER_NUMPAD
104 bool numpad = IS_LAYER_ON_STATE(state, L_NUMPAD);
105 bool num_lock = IS_HOST_LED_ON(USB_LED_NUM_LOCK);
106 if (numpad != num_lock) {
107 tap_code(KC_NLCK); // Toggle Num Lock to match Numpad layer state
108 }
109#endif
110
111 return state;
112}
113
114__attribute__((weak))
115void led_set_keymap(uint8_t usb_led) {}
116
117void led_set_user(uint8_t usb_led) {
118 led_set_keymap(usb_led);
119}
120
121__attribute__((weak))
122bool led_update_keymap(led_t led_state) {
123 return true;
124}
125
126bool led_update_user(led_t led_state) {
127 return led_update_keymap(led_state);
128}