1 #include "custom_oled.h"
2 #include "process_records.h"
7 rgblight_config_t rgblight_config;
10 #if KEYBOARD_helix_rev2
11 extern uint8_t is_master;
12 bool is_keyboard_master(void) { return is_master; }
15 static void render_logo(void)
17 static const char PROGMEM font_logo[] = {
18 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
19 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
20 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
21 oled_write_P(font_logo, false);
24 static void render_icon(void)
26 #ifdef OLED_90ROTATION
27 static const char PROGMEM font_icon[] = {
28 0x9b,0x9c,0x9d,0x9e,0x9f,
29 0xbb,0xbc,0xbd,0xbe,0xbf,
30 0xdb,0xdc,0xdd,0xde,0xdf,0
33 static const char PROGMEM font_icon[] = {
34 // Use \r (0x0d) to jump to the next line without clearing the rest of the current line
35 0x9b,0x9c,0x9d,0x9e,0x9f,0x0d,
36 0xbb,0xbc,0xbd,0xbe,0xbf,0x0d,
37 0xdb,0xdc,0xdd,0xde,0xdf,0
40 oled_write_P(font_icon, false);
43 static void render_layer(void)
45 uint8_t layer = layer_state ? biton(layer_state) : biton32(default_layer_state);
46 #ifdef OLED_90ROTATION
47 oled_write_P(PSTR("Layer"), false);
49 oled_write_P(PSTR("Layer: "), false);
55 oled_write_P(PSTR("BASE "), false);
57 #ifndef GAMELAYER_DISABLE
59 oled_write_P(PSTR("GAME "), false);
63 oled_write_P(PSTR("LOWER"), false);
66 oled_write_P(PSTR("RAISE"), false);
68 #ifdef TRILAYER_ENABLED
70 oled_write_P(PSTR("ADJST"), false);
76 static void render_keyboard_leds(void)
78 // Host Keyboard LED Status
79 uint8_t led_state = host_keyboard_leds();
80 #ifdef OLED_90ROTATION
81 oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUMLK") : PSTR(" "), false);
82 oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false);
83 oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false);
85 oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUM ") : PSTR(" "), false);
86 oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPS ") : PSTR(" "), false);
87 oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRL") : PSTR(" "), false);
92 extern uint8_t rgb_encoder_state;
95 #if defined(OLED_90ROTATION)
98 static void render_rgb_state(void)
100 // TODO: need to do a bit more handling here for horizontal rendering
101 #if defined(RGB_MATRIX_ENABLE)
102 static char buffer[31] = {0};
103 snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d e%3d ", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, rgb_matrix_config.speed, rgb_matrix_config.mode, rgb_matrix_get_flags());
104 #elif defined(RGBLIGHT_ENABLE)
105 static char buffer[26] = {0};
106 snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d ", rgblight_config.hue, rgblight_config.sat, rgblight_config.val, rgblight_config.speed, rgblight_config.mode);
110 buffer[4 + rgb_encoder_state * 5] = '<';
112 oled_write(buffer, false);
116 static void render_status(void)
121 // Host Keyboard LED Status
122 oled_write_P(PSTR("-----"), false);
123 render_keyboard_leds();
125 oled_write_P(PSTR("-----"), false);
131 oled_rotation_t oled_init_user(oled_rotation_t rotation) {
132 #if KEYBOARD_helix_rev2
133 if (is_keyboard_master())
134 return OLED_ROTATION_270;
137 if (is_keyboard_master())
138 return OLED_ROTATION_90;
143 #else // OLED_90ROTATION
146 static void render_rgb_state(void)
148 // TODO: need to do a bit more handling here for horizontal rendering
149 #if defined(RGB_MATRIX_ENABLE)
150 static char buffer[37] = {0};
151 snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d e%3d ", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, rgb_matrix_config.speed, rgb_matrix_config.mode, rgb_matrix_get_flags());
152 #elif defined(RGBLIGHT_ENABLE)
153 static char buffer[32] = {0};
154 snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d ", rgblight_config.hue, rgblight_config.sat, rgblight_config.val, rgblight_config.speed, rgblight_config.mode);
158 buffer[4 + rgb_encoder_state * 5] = '<';
160 oled_write(buffer, false);
164 static void render_status(void)
169 oled_set_cursor(6, 0);
172 // Host Keyboard LED Status
173 oled_set_cursor(6, 1);
174 render_keyboard_leds();
177 oled_set_cursor(6, 2);
182 #endif // OLED_90ROTATION
184 void oled_task_user(void)
186 if (is_keyboard_master())