diff options
Diffstat (limited to 'keyboards/helix')
-rw-r--r-- | keyboards/helix/rev2/keymaps/edvorakjp/config.h | 25 | ||||
-rw-r--r-- | keyboards/helix/rev2/keymaps/edvorakjp/keymap.c | 42 | ||||
-rw-r--r-- | keyboards/helix/rev2/keymaps/edvorakjp/keymap_4rows.c | 63 | ||||
-rw-r--r-- | keyboards/helix/rev2/keymaps/edvorakjp/keymap_5rows.c | 75 | ||||
-rw-r--r-- | keyboards/helix/rev2/keymaps/edvorakjp/keymap_xrows.h | 16 | ||||
-rw-r--r-- | keyboards/helix/rev2/keymaps/edvorakjp/oled.c | 112 | ||||
-rw-r--r-- | keyboards/helix/rev2/keymaps/edvorakjp/oled.h | 21 | ||||
-rw-r--r-- | keyboards/helix/rev2/keymaps/edvorakjp/rules.mk | 1 |
8 files changed, 161 insertions, 194 deletions
diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/config.h b/keyboards/helix/rev2/keymaps/edvorakjp/config.h index cd0568f61e..ca3b73aa29 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/config.h +++ b/keyboards/helix/rev2/keymaps/edvorakjp/config.h @@ -1,5 +1,4 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H +#pragma once #define SWAP_SCLN @@ -12,15 +11,13 @@ // Selection of RGBLIGHT MODE to use. #if defined(LED_ANIMATIONS) - //#define RGBLIGHT_EFFECT_BREATHING - //#define RGBLIGHT_EFFECT_RAINBOW_MOOD - //#define RGBLIGHT_EFFECT_RAINBOW_SWIRL - //#define RGBLIGHT_EFFECT_SNAKE - //#define RGBLIGHT_EFFECT_KNIGHT - //#define RGBLIGHT_EFFECT_CHRISTMAS - #define RGBLIGHT_EFFECT_STATIC_GRADIENT - //#define RGBLIGHT_EFFECT_RGB_TEST - //#define RGBLIGHT_EFFECT_ALTERNATING -#endif - -#endif /* CONFIG_USER_H */ +//# define RGBLIGHT_EFFECT_BREATHING +//# define RGBLIGHT_EFFECT_RAINBOW_MOOD +//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# define RGBLIGHT_EFFECT_SNAKE +//# define RGBLIGHT_EFFECT_KNIGHT +//# define RGBLIGHT_EFFECT_CHRISTMAS +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +//# define RGBLIGHT_EFFECT_RGB_TEST +//# define RGBLIGHT_EFFECT_ALTERNATING +#endif // LED_ANIMATIONS diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/keymap.c b/keyboards/helix/rev2/keymaps/edvorakjp/keymap.c index 9fba5072c4..5de00cb14c 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/keymap.c +++ b/keyboards/helix/rev2/keymaps/edvorakjp/keymap.c @@ -1,38 +1,24 @@ #include QMK_KEYBOARD_H #include "split_util.h" #include "keymap_xrows.h" -#ifdef SSD1306OLED - #include "oled.h" -#endif // keymaps definitions are moved to keymap_Xrows.c. -#ifdef SSD1306OLED -void matrix_init_keymap(void) { - //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h - iota_gfx_init(!has_usb()); // turns on the display -} - -void matrix_scan_user(void) { - iota_gfx_task(); // this is what updates the display continuously -} -#endif - #ifdef RGBLIGHT_ENABLE uint32_t layer_state_set_keymap(uint32_t state) { - rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); - switch (biton32(state)) { - case _LOWER: - rgblight_sethsv_noeeprom_red(); - break; - case _RAISE: - rgblight_sethsv_noeeprom_blue(); - break; - default: // for any other layers, or the default layer - rgblight_mode(RGBLIGHT_MODE_STATIC_GRADIENT + 3); - rgblight_sethsv_red(); - break; - } - return state; + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + switch (biton32(state)) { + case L_EDVORAKJP_LOWER: + rgblight_sethsv_noeeprom_red(); + break; + case L_EDVORAKJP_RAISE: + rgblight_sethsv_noeeprom_green(); + break; + default: // for any other layers, or the default layer + rgblight_mode(RGBLIGHT_MODE_STATIC_GRADIENT + 3); + rgblight_sethsv_red(); + break; + } + return state; } #endif diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/keymap_4rows.c b/keyboards/helix/rev2/keymaps/edvorakjp/keymap_4rows.c index f2befc03b5..246c2a9fd2 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/keymap_4rows.c +++ b/keyboards/helix/rev2/keymaps/edvorakjp/keymap_4rows.c @@ -1,41 +1,42 @@ #include "helix.h" #include "keymap_xrows.h" +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - - [_EDVORAK] = LAYOUT_kc( - //,----+----+-----+-----+-----+----. ,----+-----+-----+-----+----+----. - GRV ,QUOT,COMM , DOT , Y , Q , F , G , R , W , P ,BSLS, - //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----| - EQL , A ,LA(O),LG(E),LC(I), U , D ,RS(T),RG(N),RA(S), M ,MINS, - //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----| - ESC ,SCLN, X , C , V , Z , H , J , K , L , B ,SLSH, - //|----+----+-----+-----+-----+----+----. ,----+----+-----+-----+-----+----+----| - HOME,PGDN,PGUP , END ,TMB1 ,TMB2,TMB3, TMB4,TMB5,TMB6 ,LEFT ,DOWN , UP ,RGHT - //`----+----+-----+-----+-----+----+----/ \----+----+-----+-----+-----+----+----' + [L_EDVORAKJP_BASE] = LAYOUT_wrapper( + //,-----------------------------------------------------. ,-----------------------------------------------------. + KC_GRV, __EDVORAKJP_BASE_L1__ , __EDVORAKJP_BASE_R1__ , KC_BSLS, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_EQL, __EDVORAKJP_BASE_L2__ , __EDVORAKJP_BASE_R2__ , KC_MINS, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_ESC, __EDVORAKJP_BASE_L3__ , __EDVORAKJP_BASE_R3__ , KC_SLSH, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + __EDVORAKJP_PAGE__ , LA_TAB, LS_SPC,LOWER_TD, RAISE_TD, RC_BSPC, RG_ENT, __EDVORAKJP_CURSOR__ + //`--------------------------------------------------------------' `--------------------------------------------------------------' ), - [_LOWER] = LAYOUT_kc( - //,----+----+------+------+------+----. ,----+------+------+-------+----+----. - , , LCBR , LBRC , LPRN , , , RPRN , RBRC , RCBR , , , - //|----+----+------+------+------+----| |----+------+------+-------+----+----| - F1 , F2 ,LA(F3),LG(F4),LC(F5), F6 , F7 ,RS(F8),RG(F9),RA(F10),F11 ,F12 , - //|----+----+------+------+------+----| |----+------+------+-------+----+----| - PSCR, , HOME , PGDN , PGUP ,END , LEFT, DOWN , UP , RGHT , , , - //|----+----+------+------+------+----+----. ,----+----+------+------+-------+----+----| - , , , , , , NO , MAC ,TMB7, , , , , - //`----+----+------+------+------+----+----/ \----+----+------+------+-------+----+----' + [L_EDVORAKJP_LOWER] = LAYOUT_wrapper( + //,-----------------------------------------------------. ,-----------------------------------------------------. + XXXXXXX, XXXXXXX, __EDVORAKJP_BRACKET_L__ , XXXXXXX, XXXXXXX, __EDVORAKJP_BRACKET_R__ , XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + __EDVORAKJP_FUNCTION_L__ , __EDVORAKJP_FUNCTION_R__ , + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_PSCR, XXXXXXX, __EDVORAKJP_PAGE__ , __EDVORAKJP_CURSOR__ , XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + __KC_TRNS_x4__ , KC_TRNS, KC_TRNS, XXXXXXX, KC_MAC, RC_DEL, KC_TRNS, __KC_TRNS_x4__ + //`--------------------------------------------------------------' `--------------------------------------------------------------' ), - [_RAISE] = LAYOUT_kc( - //,----+----+-----+-----+-----+----. ,----+-----+-----+-----+----+----. - , ,EXLM , AT ,HASH ,DLR , PERC,CIRC ,AMPR ,ASTR , , , - //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----| - , 1 ,LA(2),LG(3),LC(4), 5 , 6 ,RS(7),RG(8),RA(9), 0 , , - //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----| - PSCR, ,HOME ,PGDN ,PGUP ,END , LEFT,DOWN , UP ,RGHT , , , - //|----+----+-----+-----+-----+----+----. ,----+----+-----+-----+-----+----+----| - , , , , , ,WIN , NO , , , , , , - //`----+----+-----+-----+-----+----+----/ \----+----+-----+-----+-----+----+----' + [L_EDVORAKJP_RAISE] = LAYOUT_wrapper( + //,-----------------------------------------------------. ,-----------------------------------------------------. + XXXXXXX, XXXXXXX, __EDVORAKJP_SYMBOL_L__ , __EDVORAKJP_SYMBOL_R__ , XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + XXXXXXX, __EDVORAKJP_NUMBER_L__ , __EDVORAKJP_NUMBER_R__ , XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_PSCR, XXXXXXX, __EDVORAKJP_PAGE__ , __EDVORAKJP_CURSOR__ , XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + __KC_TRNS_x4__ , KC_TRNS, KC_TRNS, KC_WIN, XXXXXXX, KC_TRNS, KC_TRNS, __KC_TRNS_x4__ + //`--------------------------------------------------------------' `--------------------------------------------------------------' ) }; +// clang-format on diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/keymap_5rows.c b/keyboards/helix/rev2/keymaps/edvorakjp/keymap_5rows.c index 642ba8c635..6f2a4d371a 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/keymap_5rows.c +++ b/keyboards/helix/rev2/keymaps/edvorakjp/keymap_5rows.c @@ -1,47 +1,48 @@ #include "helix.h" #include "keymap_xrows.h" +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - - [_EDVORAK] = LAYOUT_kc( - //,----+----+-----+-----+-----+----. ,----+-----+-----+-----+----+----. - ESC ,EXLM, AT ,HASH , DLR ,PERC, CIRC,AMPR ,ASTR ,LPRN ,RPRN,BSPC, - //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----| - GRV ,QUOT,COMM , DOT , Y , Q , F , G , R , W , P ,BSLS, - //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----| - EQL , A ,LA(O),LG(E),LC(I), U , D ,RS(T),RG(N),RA(S), M ,MINS, - //|----+----+-----+-----+-----+----+----. ,----+----+-----+-----+-----+----+----| - TAB ,SCLN, X , C , V , Z , NO , NO , H , J , K , L , B ,SLSH, - //|----+----+-----+-----+-----+----+----| |----+----+-----+-----+-----+----+----| - HOME,PGDN,PGUP , END ,TMB1 ,TMB2,TMB3, TMB4,TMB5,TMB6 ,LEFT ,DOWN , UP ,RGHT - //`----+----+-----+-----+-----+----+----/ \----+----+-----+-----+-----+----+----' + [L_EDVORAKJP_BASE] = LAYOUT_wrapper( + //,-----------------------------------------------------. ,-----------------------------------------------------. + KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_GRV, __EDVORAKJP_BASE_L1__ , __EDVORAKJP_BASE_R1__ , KC_BSLS, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_EQL, __EDVORAKJP_BASE_L2__ , __EDVORAKJP_BASE_R2__ , KC_MINS, + //|--------+--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------+--------| + KC_ESC, __EDVORAKJP_BASE_L3__ , XXXXXXX, XXXXXXX, __EDVORAKJP_BASE_R3__ , KC_SLSH, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + __EDVORAKJP_PAGE__ , LA_TAB, LS_SPC,LOWER_TD, RAISE_TD, RC_BSPC, RG_ENT, __EDVORAKJP_CURSOR__ + //`--------------------------------------------------------------' `--------------------------------------------------------------' ), - [_LOWER] = LAYOUT_kc( - //,----+----+------+------+------+----. ,----+------+------+-------+----+----. - PSCR, , , , , , , , , , , , - //|----+----+------+------+------+----| |----+------+------+-------+----+----| - , , LCBR , LBRC , LPRN , , , RPRN , RBRC , RCBR , , , - //|----+----+------+------+------+----| |----+------+------+-------+----+----| - F1 , F2 ,LA(F3),LG(F4),LC(F5), F6 , F7 ,RS(F8),RG(F9),RA(F10),F11 ,F12 , - //|----+----+------+------+------+----+----. ,----+----+------+------+-------+----+----| - , , HOME , PGDN , PGUP ,END , , ,LEFT, DOWN , UP , RGHT , , , - //|----+----+------+------+------+----+----| |----+----+------+------+-------+----+----| - , , , , , , NO , MAC ,TMB7, , , , , - //`----+----+------+------+------+----+----/ \----+----+------+------+-------+----+----' + [L_EDVORAKJP_LOWER] = LAYOUT_wrapper( + //,-----------------------------------------------------. ,-----------------------------------------------------. + __KC_TRNS_x6__ , __KC_TRNS_x6__ , + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, __EDVORAKJP_BRACKET_L__ , XXXXXXX, XXXXXXX, __EDVORAKJP_BRACKET_R__ , XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + __EDVORAKJP_FUNCTION_L__ , __EDVORAKJP_FUNCTION_R__ , + //|--------+--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------+--------| + KC_PSCR, XXXXXXX, __EDVORAKJP_PAGE__ , KC_TRNS, KC_TRNS, __EDVORAKJP_CURSOR__ , XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + __KC_TRNS_x4__ , KC_TRNS, KC_TRNS, XXXXXXX, KC_MAC, RC_DEL, KC_TRNS, __KC_TRNS_x4__ + //`--------------------------------------------------------------' `--------------------------------------------------------------' ), - [_RAISE] = LAYOUT_kc( - //,----+----+-----+-----+-----+----. ,----+-----+-----+-----+----+----. - PSCR, , , , , , , , , , , , - //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----| - , ,EXLM , AT ,HASH ,DLR , PERC,CIRC ,AMPR ,ASTR , , , - //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----| - , 1 ,LA(2),LG(3),LC(4), 5 , 6 ,RS(7),RG(8),RA(9), 0 , , - //|----+----+-----+-----+-----+----+----. ,----+----+-----+-----+-----+----+----| - , ,HOME ,PGDN ,PGUP ,END , , ,LEFT,DOWN , UP ,RGHT , , , - //|----+----+-----+-----+-----+----+----| |----+----+-----+-----+-----+----+----| - , , , , , ,WIN , NO , , , , , , - //`----+----+-----+-----+-----+----+----/ \----+----+-----+-----+-----+----+----' + [L_EDVORAKJP_RAISE] = LAYOUT_wrapper( + //,-----------------------------------------------------. ,-----------------------------------------------------. + __KC_TRNS_x6__ , __KC_TRNS_x6__ , + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, __EDVORAKJP_SYMBOL_L__ , __EDVORAKJP_SYMBOL_R__ , XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + XXXXXXX, __EDVORAKJP_NUMBER_L__ , __EDVORAKJP_NUMBER_R__ , XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------+--------| + KC_PSCR, XXXXXXX, __EDVORAKJP_PAGE__ , KC_TRNS, KC_TRNS, __EDVORAKJP_CURSOR__ , XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + __KC_TRNS_x4__ , KC_TRNS, KC_TRNS, KC_WIN, XXXXXXX, KC_TRNS, KC_TRNS, __KC_TRNS_x4__ + //`--------------------------------------------------------------' `--------------------------------------------------------------' ) }; +// clang-format on diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/keymap_xrows.h b/keyboards/helix/rev2/keymaps/edvorakjp/keymap_xrows.h index d9561d0b70..aae83fc7a8 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/keymap_xrows.h +++ b/keyboards/helix/rev2/keymaps/edvorakjp/keymap_xrows.h @@ -1,5 +1,4 @@ -#ifndef KEYMAP_XROWS_H -#define KEYMAP_XROWS_H +#pragma once #include "edvorakjp.h" /* @@ -8,14 +7,7 @@ * }; */ -#define KC_ KC_TRNS +#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) -#define KC_TMB1 KC_LA(TAB) -#define KC_TMB2 KC_LS(SPC) -#define KC_TMB3 TD(TD_LOWER) // act as LOWER when hold, as KC_LANG2(=English) when tapped -#define KC_TMB4 TD(TD_RAISE) // act as RAISE when hold, as KC_LANG1(=Japanese) when tapped -#define KC_TMB5 KC_RC(BSPC) -#define KC_TMB6 KC_RG(ENT) -#define KC_TMB7 KC_RC(DEL) - -#endif +#define __KC_TRNS_x4__ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +#define __KC_TRNS_x6__ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/oled.c b/keyboards/helix/rev2/keymaps/edvorakjp/oled.c index b931b72b7c..4bbab1dc4b 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/oled.c +++ b/keyboards/helix/rev2/keymaps/edvorakjp/oled.c @@ -1,72 +1,68 @@ +#include <stdio.h> #include <string.h> #include "oled.h" -static void render_logo(struct CharacterMatrix *matrix) { +#ifdef OLED_DRIVER_ENABLE +void render_host_led_state(void) { + char led_state_str[24]; + uint8_t leds = host_keyboard_leds(); - static char logo[] = { - 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, - 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, - 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, - 0}; - matrix_write(matrix, logo); -} + bool is_num_lock_enabled = leds & (1 << USB_LED_NUM_LOCK); + bool is_caps_lock_enabled = leds & (1 << USB_LED_CAPS_LOCK); + bool is_scroll_lock_enabled = leds & (1 << USB_LED_SCROLL_LOCK); -void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } + snprintf(led_state_str, sizeof(led_state_str), "NL:%s CL:%s SL:%s", is_num_lock_enabled ? "on" : "- ", is_caps_lock_enabled ? "on" : "- ", is_scroll_lock_enabled ? "on" : "- "); + oled_write(led_state_str, false); } -void render_status(struct CharacterMatrix *matrix) { - - // Render to mode icon - static char logo[][2][3] = {{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; - int mode_number = get_enable_kc_lang() ? 0 : 1; - matrix_write(matrix, logo[mode_number][0]); - matrix_write(matrix, "\n"); - matrix_write(matrix, logo[mode_number][1]); +void render_layer_state(void) { + char layer_name[17]; + oled_write_P(PSTR("Layer: "), false); - // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); - matrix_write_P(matrix, PSTR("\nLayer: ")); - switch (biton32(layer_state)) { - case L_BASE: - matrix_write_P(matrix, PSTR("Default")); - break; - case _RAISE: - matrix_write_P(matrix, PSTR("Raise")); - break; - case _LOWER: - matrix_write_P(matrix, PSTR("Lower")); - break; - default: - matrix_write(matrix, buf); - } + switch (biton32(layer_state)) { + case L_EDVORAKJP_BASE: + oled_write_ln_P(PSTR("Default"), false); + break; + case L_EDVORAKJP_LOWER: + oled_write_ln_P(PSTR("Lower"), false); + break; + case L_EDVORAKJP_RAISE: + oled_write_ln_P(PSTR("Raise"), false); + break; + default: + snprintf(layer_name, sizeof(layer_name), "Undef-%ld", layer_state); + oled_write_ln(layer_name, false); + } +} - // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n%s %s %s", - (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NMLK" : " ", - (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", - (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); - matrix_write(matrix, led); +void render_logo(void) { + static const char helix_logo[] PROGMEM = {0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0}; + oled_write_P(helix_logo, false); } -void iota_gfx_task_user(void) { - struct CharacterMatrix matrix; +void render_mode_icon(bool is_windows) { + static const char logo[][2][3] = { + {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, + {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}, + }; + static char mode_icon[10]; -#if DEBUG_TO_SCREEN - if (debug_enable) { return; } -#endif + snprintf(mode_icon, sizeof(mode_icon), "%s\n%s ", logo[is_windows][0], logo[is_windows][1]); + oled_write(mode_icon, false); +} + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + // flips the display 180 degrees if offhand + return is_keyboard_left() ? rotation : rotation ^ OLED_ROTATION_180; +} - matrix_clear(&matrix); - if (is_master) { - render_status(&matrix); - } else { - render_logo(&matrix); - } - matrix_update(&display, &matrix); +void oled_task_user(void) { + if (is_keyboard_left()) { + render_mode_icon(!get_enable_kc_lang()); + render_layer_state(); + render_host_led_state(); + } else { + render_logo(); + } } +#endif // OLED_DRIVER_ENABLE diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/oled.h b/keyboards/helix/rev2/keymaps/edvorakjp/oled.h index 421de2d817..994dcb5f54 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/oled.h +++ b/keyboards/helix/rev2/keymaps/edvorakjp/oled.h @@ -1,19 +1,12 @@ -#ifndef OLED_USER_H -#define OLED_USER_H +#pragma once -//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h -#include "ssd1306.h" #include "edvorakjp.h" -//assign the right code to your layers for OLED display -#define L_BASE 0 - -extern uint8_t is_master; extern bool japanese_mode; -void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source); -void render_status(struct CharacterMatrix *matrix); -void iota_gfx_task_user(void); - -#endif // OLED_CONFIG_USER_H +void render_host_led_state(void); +void render_layer_state(void); +void render_logo(void); +void render_mode_icon(bool is_windows); +oled_rotation_t oled_init_user(oled_rotation_t rotation); +void oled_task_user(void); diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/rules.mk b/keyboards/helix/rev2/keymaps/edvorakjp/rules.mk index 18bef6bf71..59b7acad5b 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/rules.mk +++ b/keyboards/helix/rev2/keymaps/edvorakjp/rules.mk @@ -18,6 +18,7 @@ TAP_DANCE_ENABLE = yes # LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) # LED_ANIMATIONS = yes # LED animations # IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) +OLED_SELECT = core # convert Helix-specific options (that represent combinations of standard options) # into QMK standard options. |