aboutsummaryrefslogtreecommitdiff
path: root/keyboards/yampad/yampad.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/yampad/yampad.c')
-rw-r--r--keyboards/yampad/yampad.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/keyboards/yampad/yampad.c b/keyboards/yampad/yampad.c
new file mode 100644
index 000000000..764f48404
--- /dev/null
+++ b/keyboards/yampad/yampad.c
@@ -0,0 +1,64 @@
1
2/* Copyright 2019
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17#include "yampad.h"
18
19#if defined(OLED_DRIVER_ENABLE)
20__attribute__((weak))
21oled_rotation_t oled_init_user(oled_rotation_t rotation) {
22 return OLED_ROTATION_270; // flips the display 270 degrees
23}
24
25__attribute__((weak))
26void oled_task_user(void) {
27 // Host Keyboard Layer Status
28 oled_write_P(PSTR("Layer"), false);
29 switch (get_highest_layer(layer_state)) {
30 case 0:
31 oled_write_ln_P(PSTR(" BAS"), false);
32 break;
33 case 1:
34 oled_write_ln_P(PSTR(" NAV"), false);
35 break;
36 case 2:
37 oled_write_ln_P(PSTR(" RGB"), false);
38 break;
39 default:
40 // Or use the write_ln shortcut over adding '\n' to the end of your string
41 oled_write_ln_P(PSTR(" UND"), false);
42 }
43
44 // Host Keyboard LED Status
45 led_t led_state = host_keyboard_led_state();
46 oled_write_P(PSTR("-----"), false);
47 oled_write_P(PSTR("Stats"), false);
48 oled_write_P(led_state.num_lock ? PSTR("num:*") : PSTR("num:."), false);
49 oled_write_P(led_state.caps_lock ? PSTR("cap:*") : PSTR("cap:."), false);
50 oled_write_P(led_state.scroll_lock ? PSTR("scr:*") : PSTR("scr:."), false);
51
52 // Host Keyboard RGB backlight status
53 oled_write_P(PSTR("-----"), false);
54 oled_write_P(PSTR("Light"), false);
55
56 static char led_buf[30];
57 snprintf(led_buf, sizeof(led_buf) - 1, "RGB:%cM: %2d\nh: %2ds: %2dv: %2d\n",
58 rgblight_is_enabled() ? '*' : '.', (uint8_t)rgblight_get_mode(),
59 (uint8_t)(rgblight_get_hue() / RGBLIGHT_HUE_STEP),
60 (uint8_t)(rgblight_get_sat() / RGBLIGHT_SAT_STEP),
61 (uint8_t)(rgblight_get_val() / RGBLIGHT_VAL_STEP));
62 oled_write(led_buf, false);
63}
64#endif