diff options
Diffstat (limited to 'keyboards/pearlboards/zeuspad/zeuspad.c')
-rw-r--r-- | keyboards/pearlboards/zeuspad/zeuspad.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/keyboards/pearlboards/zeuspad/zeuspad.c b/keyboards/pearlboards/zeuspad/zeuspad.c new file mode 100644 index 000000000..fd79058e8 --- /dev/null +++ b/keyboards/pearlboards/zeuspad/zeuspad.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /* Copyright 2021 Koobaczech | ||
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 "zeuspad.h" | ||
18 | |||
19 | // Encoder rotate function | ||
20 | bool encoder_update_user(uint8_t index, bool clockwise) { | ||
21 | /* First encoder */ | ||
22 | if (index == 0) { | ||
23 | if (clockwise) { | ||
24 | tap_code(KC_AUDIO_VOL_UP); | ||
25 | } else { | ||
26 | tap_code(KC_AUDIO_VOL_DOWN); | ||
27 | } | ||
28 | } | ||
29 | return true; | ||
30 | } | ||
31 | |||
32 | //21 characters max | ||
33 | #ifdef OLED_ENABLE | ||
34 | void oled_task_user(void) { | ||
35 | oled_write_P(PSTR("ZEUSPAD BY KOOBACZECH"), false); | ||
36 | // Keyboard Layer Status | ||
37 | oled_write_P(PSTR("LAYER: "), false); | ||
38 | |||
39 | switch (get_highest_layer(layer_state)) { | ||
40 | case 1: | ||
41 | oled_write_ln_P(PSTR("FN"), false); | ||
42 | break; | ||
43 | default: | ||
44 | oled_write_ln_P(PSTR("Default"), false); | ||
45 | } | ||
46 | // Keyboard Locking Status | ||
47 | led_t led_state = host_keyboard_led_state(); | ||
48 | oled_write_P(led_state.caps_lock ? PSTR("CAPS ") : PSTR(" "), false); | ||
49 | oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); | ||
50 | oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); | ||
51 | |||
52 | switch (rgblight_is_enabled() ? 1 : 2) { | ||
53 | case 1: | ||
54 | // Or use the write_ln shortcut over adding '\n' to the end of your string | ||
55 | oled_write_P(PSTR("RGB"), false); | ||
56 | static char led_buf[30]; | ||
57 | snprintf(led_buf, sizeof(led_buf) - 1, "\nMODE:%2d BRIGHT:%2d/10", | ||
58 | (uint8_t)(rgblight_get_mode()), | ||
59 | (uint8_t)(rgblight_get_val()/25.5)); | ||
60 | oled_write(led_buf, false); | ||
61 | break; | ||
62 | default: | ||
63 | oled_write_ln_P(PSTR(""), false); | ||
64 | oled_write_P(PSTR("\n"), false); | ||
65 | } | ||
66 | } | ||
67 | #endif | ||