aboutsummaryrefslogtreecommitdiff
path: root/keyboards/yushakobo/navpad/navpad_prefs.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/yushakobo/navpad/navpad_prefs.c')
-rw-r--r--keyboards/yushakobo/navpad/navpad_prefs.c104
1 files changed, 104 insertions, 0 deletions
diff --git a/keyboards/yushakobo/navpad/navpad_prefs.c b/keyboards/yushakobo/navpad/navpad_prefs.c
new file mode 100644
index 000000000..fd2a7b078
--- /dev/null
+++ b/keyboards/yushakobo/navpad/navpad_prefs.c
@@ -0,0 +1,104 @@
1/* Copyright 2021 yushakobo
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
17#include QMK_KEYBOARD_H
18
19bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
20 if (!process_record_user(keycode, record)) { return false; }
21 switch (keycode) {
22 case TAP_00:
23 if (record->event.pressed){
24 tap_code(KC_P0);
25 tap_code(KC_P0);
26 }
27 break;
28
29 default:
30 break;
31 }
32 return true;
33}
34
35bool led_update_kb(led_t led_state) {
36 return led_update_user(led_state);
37}
38
39#ifdef ENCODER_ENABLE
40bool encoder_update_kb(uint8_t index, bool clockwise) {
41 if (!encoder_update_user(index, clockwise)) { return false; }
42 if (index == 0) { /* Navpad side encoder */
43 switch (get_highest_layer(layer_state|default_layer_state)) {
44 case _BASE:
45 if (clockwise) {
46 tap_code16(KC_VOLU);
47 } else {
48 tap_code16(KC_VOLD);
49 }
50 break;
51
52 case _FN1:
53 if (clockwise) {
54 rgblight_increase_hue();
55 } else {
56 rgblight_decrease_hue();
57 }
58 break;
59
60 case _FN2:
61 if (clockwise) {
62 rgblight_increase_sat();
63 } else {
64 rgblight_decrease_sat();
65 }
66 break;
67
68 default:
69 break;
70 }
71 }
72 if (index == 1) { /* Helix side encoder */
73 switch (get_highest_layer(layer_state|default_layer_state)) {
74 case _BASE:
75 if (clockwise) {
76 tap_code(KC_RBRC);
77 } else {
78 tap_code(KC_LBRC);
79 }
80 break;
81
82 case _FN1:
83 if (clockwise) {
84 tap_code16(KC_RPRN);
85 } else {
86 tap_code16(KC_LPRN);
87 }
88 break;
89
90 case _FN2:
91 if (clockwise) {
92 tap_code16(KC_RCBR);
93 } else {
94 tap_code16(KC_LCBR);
95 }
96 break;
97
98 default:
99 break;
100 }
101 }
102 return false;
103 }
104#endif