diff options
Diffstat (limited to 'users/konstantin/konstantin.c')
| -rw-r--r-- | users/konstantin/konstantin.c | 86 |
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)) |
| 41 | layer_state_t layer_state_set_keymap(layer_state_t state) { | ||
| 42 | return state; | ||
| 43 | } | ||
| 44 | |||
| 45 | layer_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)) | ||
| 60 | void led_set_keymap(uint8_t usb_led) {} | ||
| 61 | |||
| 62 | void led_set_user(uint8_t usb_led) { | ||
| 63 | led_set_keymap(usb_led); | ||
| 64 | } | ||
| 65 | |||
| 66 | __attribute__((weak)) | ||
| 67 | bool led_update_keymap(led_t led_state) { | ||
| 68 | return true; | ||
| 69 | } | ||
| 70 | |||
| 71 | bool led_update_user(led_t led_state) { | ||
| 72 | return led_update_keymap(led_state); | ||
| 73 | } | ||
| 74 | |||
| 75 | __attribute__((weak)) | ||
| 25 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | 76 | bool 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)) | ||
| 96 | uint32_t layer_state_set_keymap(uint32_t state) { | ||
| 97 | return state; | ||
| 98 | } | ||
| 99 | |||
| 100 | layer_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)) | ||
| 115 | void led_set_keymap(uint8_t usb_led) {} | ||
| 116 | |||
| 117 | void led_set_user(uint8_t usb_led) { | ||
| 118 | led_set_keymap(usb_led); | ||
| 119 | } | ||
| 120 | |||
| 121 | __attribute__((weak)) | ||
| 122 | bool led_update_keymap(led_t led_state) { | ||
| 123 | return true; | ||
| 124 | } | ||
| 125 | |||
| 126 | bool led_update_user(led_t led_state) { | ||
| 127 | return led_update_keymap(led_state); | ||
| 128 | } | ||
