diff options
Diffstat (limited to 'keyboards/rgbkb/sol/keymaps/xulkal/keymap.c')
| -rw-r--r-- | keyboards/rgbkb/sol/keymaps/xulkal/keymap.c | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/keyboards/rgbkb/sol/keymaps/xulkal/keymap.c b/keyboards/rgbkb/sol/keymaps/xulkal/keymap.c new file mode 100644 index 000000000..5c560abad --- /dev/null +++ b/keyboards/rgbkb/sol/keymaps/xulkal/keymap.c | |||
| @@ -0,0 +1,168 @@ | |||
| 1 | #include QMK_KEYBOARD_H | ||
| 2 | #include "xulkal.h" | ||
| 3 | |||
| 4 | #ifdef PROTOCOL_LUFA | ||
| 5 | #include "lufa.h" | ||
| 6 | #include "split_util.h" | ||
| 7 | #endif | ||
| 8 | |||
| 9 | #ifdef OLED_DRIVER_ENABLE | ||
| 10 | #include "oled_driver.h" | ||
| 11 | #endif | ||
| 12 | |||
| 13 | #define EXPAND_LAYOUT(...) LAYOUT(__VA_ARGS__) | ||
| 14 | |||
| 15 | // Define your non-alpha grouping in this define's LAYOUT, and all your BASE_LAYERS will share the same mod/macro columns | ||
| 16 | |||
| 17 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 18 | /* Qwerty Layout | ||
| 19 | * ,------------------------------------------------. ,------------------------------------------------. | ||
| 20 | * | GESC | 1 | 2 | 3 | 4 | 5 | - | | = | 6 | 7 | 8 | 9 | 0 | BkSp | | ||
| 21 | * |------+------+------+------+------+------|------| |------|------+------+------+------+------+------| | ||
| 22 | * | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \ | | ||
| 23 | * |------+------+------+------+------+------|------| |------|------+------+------+------+------+------| | ||
| 24 | * |FN(CAPS)| A | S | D | F | G | ` | | ' | H | J | K | L | ; | Enter| | ||
| 25 | * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------| | ||
| 26 | * | Sft[ | Z | X | C | V | B | RGB | |RGBRST| N | M | , | . | / | Sft] | | ||
| 27 | * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------| | ||
| 28 | * | Ctl- | Win | LOWER| RAISE| Alt | Space|RGBRMOD| |RGBMOD| Space| Left | Up | Down | Right| Ctl= | | ||
| 29 | * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------' | ||
| 30 | * | Space| DEL | | Enter| Space| | ||
| 31 | * `-------------' `-------------' | ||
| 32 | */ | ||
| 33 | [_QWERTY] = EXPAND_LAYOUT( \ | ||
| 34 | _________________QWERTY_L1_________________, KC_MINS, KC_EQL, _________________QWERTY_R1_________________, \ | ||
| 35 | _________________QWERTY_L2_________________, KC_LBRC, KC_RBRC, _________________QWERTY_R2_________________, \ | ||
| 36 | _________________QWERTY_L3_________________, KC_GRV, KC_QUOT, _________________QWERTY_R3_________________, \ | ||
| 37 | _________________QWERTY_L4_________________, RGB_TOG, RGBRST, _________________QWERTY_R4_________________, \ | ||
| 38 | _________________QWERTY_L5_________________, RGB_RMOD, RGB_MOD, _________________QWERTY_R5_________________, \ | ||
| 39 | KC_SPC, KC_DEL, KC_ENT, KC_SPC \ | ||
| 40 | ), | ||
| 41 | |||
| 42 | #ifndef GAMELAYER_DISABLE | ||
| 43 | [_GAME] = EXPAND_LAYOUT( \ | ||
| 44 | ___________________GAME_L1_________________, KC_MINS, KC_EQL, ___________________GAME_R1_________________, \ | ||
| 45 | ___________________GAME_L2_________________, KC_LBRC, KC_RBRC, ___________________GAME_R2_________________, \ | ||
| 46 | ___________________GAME_L3_________________, KC_GRV, KC_QUOT, ___________________GAME_R3_________________, \ | ||
| 47 | ___________________GAME_L4_________________, RGB_TOG, RGBRST, ___________________GAME_R4_________________, \ | ||
| 48 | ___________________GAME_L5_________________, RGB_RMOD, RGB_MOD, ___________________GAME_R5_________________, \ | ||
| 49 | KC_SPC, KC_DEL, KC_ENT, KC_SPC \ | ||
| 50 | ), | ||
| 51 | #endif | ||
| 52 | |||
| 53 | [_LOWER] = EXPAND_LAYOUT( \ | ||
| 54 | __________________LOWER_L1_________________, KC_PMNS, KC_PPLS, __________________LOWER_R1_________________, \ | ||
| 55 | __________________LOWER_L2_________________, _______, _______, __________________LOWER_R2_________________, \ | ||
| 56 | __________________LOWER_L3_________________, _______, _______, __________________LOWER_R3_________________, \ | ||
| 57 | __________________LOWER_L4_________________, _______, _______, __________________LOWER_R4_________________, \ | ||
| 58 | __________________LOWER_L5_________________, _______, _______, __________________LOWER_R5_________________, \ | ||
| 59 | _______, _______, _______, _______ \ | ||
| 60 | ), | ||
| 61 | |||
| 62 | [_RAISE] = EXPAND_LAYOUT( \ | ||
| 63 | __________________RAISE_L1_________________, _______, _______, __________________RAISE_R1_________________, \ | ||
| 64 | __________________RAISE_L2_________________, _______, _______, __________________RAISE_R2_________________, \ | ||
| 65 | __________________RAISE_L3_________________, _______, _______, __________________RAISE_R3_________________, \ | ||
| 66 | __________________RAISE_L4_________________, _______, _______, __________________RAISE_R4_________________, \ | ||
| 67 | __________________RAISE_L5_________________, _______, _______, __________________RAISE_R5_________________, \ | ||
| 68 | _______, _______, _______, _______ \ | ||
| 69 | ), | ||
| 70 | |||
| 71 | #ifdef TRILAYER_ENABLED | ||
| 72 | [_RAISE] = EXPAND_LAYOUT( \ | ||
| 73 | _________________ADJUST_L1_________________, _______, _______, _________________ADJUST_R1_________________, \ | ||
| 74 | _________________ADJUST_L2_________________, _______, _______, _________________ADJUST_R2_________________, \ | ||
| 75 | _________________ADJUST_L3_________________, _______, _______, _________________ADJUST_R3_________________, \ | ||
| 76 | _________________ADJUST_L4_________________, _______, _______, _________________ADJUST_R4_________________, \ | ||
| 77 | _________________ADJUST_L5_________________, _______, _______, _________________ADJUST_R5_________________, \ | ||
| 78 | _______, _______, _______, _______ \ | ||
| 79 | ), | ||
| 80 | #endif | ||
| 81 | }; | ||
| 82 | |||
| 83 | //SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h | ||
| 84 | #ifdef OLED_DRIVER_ENABLE | ||
| 85 | |||
| 86 | static void render_logo(void) { | ||
| 87 | static const char PROGMEM sol_logo[] = { | ||
| 88 | 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, | ||
| 89 | 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, | ||
| 90 | 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0}; | ||
| 91 | |||
| 92 | oled_write_P(sol_logo, false); | ||
| 93 | } | ||
| 94 | |||
| 95 | |||
| 96 | static void render_status(void) { | ||
| 97 | // Render to mode icon | ||
| 98 | static const char PROGMEM mode_logo[2][3] = { | ||
| 99 | {0x97,0x98,0}, | ||
| 100 | {0xb7,0xb8,0} }; | ||
| 101 | |||
| 102 | oled_write_P(mode_logo[0], false); | ||
| 103 | |||
| 104 | #if defined(RGB_MATRIX_ENABLE) | ||
| 105 | static char buffer[20] = {0}; | ||
| 106 | snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val); | ||
| 107 | oled_write(buffer, false); | ||
| 108 | #endif | ||
| 109 | |||
| 110 | oled_write_P(mode_logo[1], false); | ||
| 111 | |||
| 112 | #if defined(RGB_MATRIX_ENABLE) | ||
| 113 | snprintf(buffer, sizeof(buffer), " s%3d m%3d\n", rgb_matrix_config.speed, rgb_matrix_config.mode); | ||
| 114 | oled_write(buffer, false); | ||
| 115 | #endif | ||
| 116 | |||
| 117 | // 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 | ||
| 118 | oled_write_P(PSTR("Layer: "), false); | ||
| 119 | switch (biton32(layer_state)) { | ||
| 120 | case _QWERTY: | ||
| 121 | #ifndef GAMELAYER_DISABLE | ||
| 122 | switch (biton32(default_layer_state)) { | ||
| 123 | case _QWERTY: | ||
| 124 | oled_write_P(PSTR("Default\n"), false); | ||
| 125 | break; | ||
| 126 | case _GAME: | ||
| 127 | oled_write_P(PSTR("Game\n"), false); | ||
| 128 | break; | ||
| 129 | default: | ||
| 130 | oled_write_P(PSTR("Undefined\n"), false); | ||
| 131 | break; | ||
| 132 | } | ||
| 133 | #else | ||
| 134 | oled_write_P(PSTR("Default\n"), false); | ||
| 135 | #endif | ||
| 136 | break; | ||
| 137 | case _LOWER: | ||
| 138 | oled_write_P(PSTR("Lower\n"), false); | ||
| 139 | break; | ||
| 140 | case _RAISE: | ||
| 141 | oled_write_P(PSTR("Raise\n"), false); | ||
| 142 | break; | ||
| 143 | #ifdef TRILAYER_ENABLED | ||
| 144 | case _ADJUST: | ||
| 145 | oled_write_P(PSTR("Adjust\n"), false); | ||
| 146 | break; | ||
| 147 | #endif | ||
| 148 | default: | ||
| 149 | oled_write_P(PSTR("Undefined\n"), false); | ||
| 150 | } | ||
| 151 | |||
| 152 | // Host Keyboard LED Status | ||
| 153 | uint8_t led_usb_state = host_keyboard_leds(); | ||
| 154 | oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false); | ||
| 155 | oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false); | ||
| 156 | oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false); | ||
| 157 | } | ||
| 158 | |||
| 159 | void oled_task_user(void) { | ||
| 160 | if (is_keyboard_master()) { | ||
| 161 | render_status(); | ||
| 162 | } else { | ||
| 163 | render_logo(); | ||
| 164 | oled_scroll_left(); | ||
| 165 | } | ||
| 166 | } | ||
| 167 | |||
| 168 | #endif | ||
