diff options
| author | CodeFreak <lisca94@gmail.com> | 2021-05-27 16:46:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-27 16:46:19 +0100 |
| commit | 147cf8afbb3f7f9b09623c50e42fd3dec76d2147 (patch) | |
| tree | 86bb2763e5760ef68e6ab37a42ff8b7b2f75e8a3 | |
| parent | 9da95bc3abc2d5682aea917e56abfeae30a7980f (diff) | |
| download | qmk_firmware-147cf8afbb3f7f9b09623c50e42fd3dec76d2147.tar.gz qmk_firmware-147cf8afbb3f7f9b09623c50e42fd3dec76d2147.zip | |
Sofle rev1 Keymap - featuring keyboard pets (#12499)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
| -rw-r--r-- | keyboards/sofle/keymaps/helltm/config.h | 21 | ||||
| -rw-r--r-- | keyboards/sofle/keymaps/helltm/keymap.c | 762 | ||||
| -rw-r--r-- | keyboards/sofle/keymaps/helltm/readme.md | 32 | ||||
| -rw-r--r-- | keyboards/sofle/keymaps/helltm/rules.mk | 6 |
4 files changed, 821 insertions, 0 deletions
diff --git a/keyboards/sofle/keymaps/helltm/config.h b/keyboards/sofle/keymaps/helltm/config.h new file mode 100644 index 000000000..61ffb70fb --- /dev/null +++ b/keyboards/sofle/keymaps/helltm/config.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* Copyright 2021 HellSingCoder | ||
| 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 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | #define OLED_TIMEOUT 120000 | ||
| 21 | #define OLED_BRIGHTNESS 120 | ||
diff --git a/keyboards/sofle/keymaps/helltm/keymap.c b/keyboards/sofle/keymaps/helltm/keymap.c new file mode 100644 index 000000000..d3bdd5fa8 --- /dev/null +++ b/keyboards/sofle/keymaps/helltm/keymap.c | |||
| @@ -0,0 +1,762 @@ | |||
| 1 | /* Copyright 2021 HellSingCoder | ||
| 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 QMK_KEYBOARD_H | ||
| 18 | |||
| 19 | enum sofle_layers { | ||
| 20 | /* _M_XYZ = Mac Os, _W_XYZ = Win/Linux */ | ||
| 21 | _QWERTY, | ||
| 22 | _GAMING, | ||
| 23 | _LOWER, | ||
| 24 | _RAISE, | ||
| 25 | _ADJUST, | ||
| 26 | }; | ||
| 27 | |||
| 28 | enum custom_keycodes { | ||
| 29 | KC_QWERTY = SAFE_RANGE, | ||
| 30 | KC_GAMING, | ||
| 31 | KC_LOWER, | ||
| 32 | KC_RAISE, | ||
| 33 | KC_ADJUST, | ||
| 34 | KC_PRVWD, | ||
| 35 | KC_NXTWD, | ||
| 36 | KC_LSTRT, | ||
| 37 | KC_LEND, | ||
| 38 | KC_DLINE, | ||
| 39 | KC_BSPC_DEL, | ||
| 40 | KC_LAYER | ||
| 41 | }; | ||
| 42 | |||
| 43 | |||
| 44 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 45 | /* | ||
| 46 | * QWERTY | ||
| 47 | * ,-----------------------------------------. ,-----------------------------------------. | ||
| 48 | * | Esc | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BS | | ||
| 49 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 50 | * | Tab | Q | W | E | R | T | | Y | U | I | O | P | ` | | ||
| 51 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 52 | * | Caps | A | S | D | F | G |-------. ,-------| H | J | K | L | ; | ' | | ||
| 53 | * |------+------+------+------+------+------| play | | mute |------+------+------+------+------+------| | ||
| 54 | * |LShift| Z | X | C | V | B |-------| |-------| N | M | , | . | / | \ | | ||
| 55 | * `-----------------------------------------/ / \ \-----------------------------------------' | ||
| 56 | * | LGUI | LAlt | LAYER| LCTR | /Enter / \Space \ | [ | ] | - | = | | ||
| 57 | * | | | | |/ / \ \ | | | | | | ||
| 58 | * `----------------------------------' '------''---------------------------' | ||
| 59 | */ | ||
| 60 | |||
| 61 | [_QWERTY] = LAYOUT( | ||
| 62 | KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC_DEL, | ||
| 63 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_GRV, | ||
| 64 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | ||
| 65 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_GAMING, KC_QWERTY,KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_BSLS, | ||
| 66 | KC_LGUI,KC_LALT,KC_LAYER, KC_LCTRL, KC_ENT, KC_SPC, KC_LBRC, KC_RBRC, KC_MINS, KC_EQL | ||
| 67 | ), | ||
| 68 | |||
| 69 | /* | ||
| 70 | * GAMING | ||
| 71 | * ,-----------------------------------------. ,-----------------------------------------. | ||
| 72 | * | Esc | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BS | | ||
| 73 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 74 | * | Tab | Q | W | E | R | T | | Y | U | I | O | P | ` | | ||
| 75 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 76 | * | Caps | A | S | D | F | G |-------. ,-------| H | J | K | L | Up | ' | | ||
| 77 | * |------+------+------+------+------+------| play | | mute |------+------+------+------+------+------| | ||
| 78 | * |LShift| Z | X | C | V | B |-------| |-------| N | M | , | Left | Down | Right| | ||
| 79 | * `-----------------------------------------/ / \ \-----------------------------------------' | ||
| 80 | * | LGUI | LAlt | LAYER| LCTR | /Space / \Enter \ | [ | ] | - | = | | ||
| 81 | * | | | | |/ / \ \ | | | | | | ||
| 82 | * `----------------------------------' '------''---------------------------' | ||
| 83 | */ | ||
| 84 | |||
| 85 | [_GAMING] = LAYOUT( | ||
| 86 | KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC_DEL, | ||
| 87 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_GRV, | ||
| 88 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_UP, KC_QUOT, | ||
| 89 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_MPLY, KC_MUTE,KC_N, KC_M, KC_COMM, KC_LEFT, KC_DOWN, KC_RIGHT, | ||
| 90 | KC_LGUI,KC_LALT,KC_LAYER, KC_LCTRL, KC_SPC, KC_ENT, KC_LBRC, KC_RBRC, KC_MINS, KC_EQL | ||
| 91 | ), | ||
| 92 | |||
| 93 | /* LOWER | ||
| 94 | * ,-----------------------------------------. ,-----------------------------------------. | ||
| 95 | * | Esc | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 | | ||
| 96 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 97 | * | Tab | | Up | | RESET| | | PWrd | NWrd | Pscr |Scroll| Pause| F12 | | ||
| 98 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 99 | * | Caps | Left | Down | Rigth| | |-------. ,-------| | | Ins | Home | PUp | | | ||
| 100 | * |------+------+------+------+------+------| play | | mute |------+------+------+------+------+------| | ||
| 101 | * | Shift| | | | | |-------| |-------| | Menu | Del | End | PDown| | | ||
| 102 | * `-----------------------------------------/ / \ \-----------------------------------------' | ||
| 103 | * |MACWIN| RAlt | LAYER| RCTR | /Enter / \Space \ | | | | | | ||
| 104 | * | | | | |/ / \ \ | | | | | | ||
| 105 | * `----------------------------------' '------''---------------------------' | ||
| 106 | */ | ||
| 107 | [_LOWER] = LAYOUT( | ||
| 108 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, | ||
| 109 | _______, XXXXXXX, KC_UP, XXXXXXX, RESET, XXXXXXX, KC_PRVWD, KC_NXTWD, KC_PSCR, KC_SLCK, KC_PAUS, KC_F12, | ||
| 110 | _______, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_HOME, KC_PGUP, XXXXXXX, | ||
| 111 | _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, KC_APP, KC_DEL, KC_END, KC_PGDN, XXXXXXX, | ||
| 112 | CG_TOGG, KC_RALT, _______, KC_RCTL, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX | ||
| 113 | ), | ||
| 114 | |||
| 115 | /* RAISE | ||
| 116 | * ,----------------------------------------. ,-----------------------------------------. | ||
| 117 | * | | | | | | | | | | | | | | | ||
| 118 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 119 | * | Esc | Ins | Pscr | Menu | | | | | PWrd | Up | NWrd | DLine| Bspc | | ||
| 120 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 121 | * | Tab | LAt | LCtl |LShift| | Caps |-------. ,-------| | Left | Down | Rigth| Del | Bspc | | ||
| 122 | * |------+------+------+------+------+------| MUTE | | |------+------+------+------+------+------| | ||
| 123 | * |Shift | Undo | Cut | Copy | Paste| |-------| |-------| | LStr | | LEnd | | Shift| | ||
| 124 | * `-----------------------------------------/ / \ \-----------------------------------------' | ||
| 125 | * | LGUI | LAlt | LCTR |LOWER | /Enter / \Space \ |RAISE | RCTR | RAlt | RGUI | | ||
| 126 | * | | | | |/ / \ \ | | | | | | ||
| 127 | * `----------------------------------' '------''---------------------------' | ||
| 128 | */ | ||
| 129 | [_RAISE] = LAYOUT( | ||
| 130 | _______, _______ , _______ , _______ , _______ , _______, _______, _______ , _______, _______ , _______ ,_______, | ||
| 131 | _______, KC_INS, KC_PSCR, KC_APP, XXXXXXX, XXXXXXX, KC_PGUP, KC_PRVWD, KC_UP, KC_NXTWD,KC_DLINE, KC_BSPC, | ||
| 132 | _______, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_CAPS, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_DEL, KC_BSPC, | ||
| 133 | _______,KC_UNDO, KC_CUT, KC_COPY, KC_PASTE, XXXXXXX, _______, _______, XXXXXXX, KC_LSTRT, XXXXXXX, KC_LEND, _______, _______, | ||
| 134 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 135 | ), | ||
| 136 | /* ADJUST | ||
| 137 | * ,-----------------------------------------. ,-----------------------------------------. | ||
| 138 | * | | | | | | | | | | | | | | | ||
| 139 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 140 | * | RESET| |QWERTY| | | | | | | | | | | | ||
| 141 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 142 | * | | |MACWIN| | | |-------. ,-------| | VOLDO| MUTE | VOLUP| | | | ||
| 143 | * |------+------+------+------+------+------| MUTE | | |------+------+------+------+------+------| | ||
| 144 | * | | | | | | |-------| |-------| | PREV | PLAY | NEXT | | | | ||
| 145 | * `-----------------------------------------/ / \ \-----------------------------------------' | ||
| 146 | * | LGUI | LAlt | LCTR |LOWER | /Enter / \Space \ |RAISE | RCTR | RAlt | RGUI | | ||
| 147 | * | | | | |/ / \ \ | | | | | | ||
| 148 | * `----------------------------------' '------''---------------------------' | ||
| 149 | */ | ||
| 150 | [_ADJUST] = LAYOUT( | ||
| 151 | XXXXXXX , XXXXXXX, XXXXXXX , XXXXXXX , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
| 152 | RESET , XXXXXXX,KC_QWERTY,XXXXXXX,CG_TOGG,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
| 153 | XXXXXXX , XXXXXXX,CG_TOGG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD, KC_MUTE, KC_VOLU, XXXXXXX, XXXXXXX, | ||
| 154 | XXXXXXX , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, XXXXXXX, | ||
| 155 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 156 | ) | ||
| 157 | }; | ||
| 158 | |||
| 159 | #ifdef OLED_DRIVER_ENABLE | ||
| 160 | |||
| 161 | /* 32 * 32 logo */ | ||
| 162 | static void render_logo(void) { | ||
| 163 | static const char PROGMEM hell_logo[] = { | ||
| 164 | 0x00, 0x80, 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x30, 0x18, 0x1c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x80, | ||
| 165 | 0xe0, 0x78, 0x1e, 0x06, 0x00, 0x0c, 0x1c, 0x18, 0x30, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0x80, 0x00, | ||
| 166 | 0x01, 0x03, 0x07, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x70, 0x60, 0x00, 0xc0, 0xf0, 0x3c, 0x0f, | ||
| 167 | 0x03, 0x00, 0x00, 0x00, 0x00, 0x60, 0x70, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x07, 0x03, 0x01, | ||
| 168 | 0x00, 0xf8, 0xf8, 0x80, 0x80, 0x80, 0xf8, 0xf8, 0x00, 0x80, 0xc0, 0xc0, 0x40, 0xc0, 0xc0, 0x80, | ||
| 169 | 0x00, 0xf8, 0xf8, 0x00, 0xf8, 0xf8, 0x00, 0x08, 0x38, 0x08, 0x00, 0x38, 0x08, 0x30, 0x08, 0x38, | ||
| 170 | 0x00, 0x1f, 0x1f, 0x01, 0x01, 0x01, 0x1f, 0x1f, 0x00, 0x0f, 0x1f, 0x1a, 0x12, 0x1a, 0x1b, 0x0b, | ||
| 171 | 0x00, 0x1f, 0x1f, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 172 | }; | ||
| 173 | |||
| 174 | oled_write_raw_P(hell_logo, sizeof(hell_logo)); | ||
| 175 | } | ||
| 176 | |||
| 177 | /* 32 * 14 os logos */ | ||
| 178 | static const char PROGMEM windows_logo[] = { | ||
| 179 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0xbc, 0xbe, 0xbe, 0x00, | ||
| 180 | 0xbe, 0xbe, 0xbf, 0xbf, 0xbf, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 181 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x0f, 0x0f, 0x00, | ||
| 182 | 0x0f, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 183 | }; | ||
| 184 | |||
| 185 | static const char PROGMEM mac_logo[] = { | ||
| 186 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xf0, 0xf8, 0xf8, 0xf8, | ||
| 187 | 0xf0, 0xf6, 0xfb, 0xfb, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 188 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x0f, 0x1f, 0x1f, | ||
| 189 | 0x0f, 0x0f, 0x1f, 0x1f, 0x0f, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 190 | }; | ||
| 191 | |||
| 192 | /* Smart Backspace Delete */ | ||
| 193 | |||
| 194 | bool shift_held = false; | ||
| 195 | static uint16_t held_shift = 0; | ||
| 196 | |||
| 197 | /* KEYBOARD PET START */ | ||
| 198 | |||
| 199 | /* settings */ | ||
| 200 | #define MIN_WALK_SPEED 10 | ||
| 201 | #define MIN_RUN_SPEED 40 | ||
| 202 | |||
| 203 | /* advanced settings */ | ||
| 204 | #define ANIM_FRAME_DURATION 200 // how long each frame lasts in ms | ||
| 205 | #define ANIM_SIZE 96 // number of bytes in array. If you change sprites, minimize for adequate firmware size. max is 1024 | ||
| 206 | |||
| 207 | /* timers */ | ||
| 208 | uint32_t anim_timer = 0; | ||
| 209 | uint32_t anim_sleep = 0; | ||
| 210 | |||
| 211 | /* current frame */ | ||
| 212 | uint8_t current_frame = 0; | ||
| 213 | |||
| 214 | /* status variables */ | ||
| 215 | int current_wpm = 0; | ||
| 216 | led_t led_usb_state; | ||
| 217 | |||
| 218 | bool isSneaking = false; | ||
| 219 | bool isJumping = false; | ||
| 220 | bool showedJump = true; | ||
| 221 | |||
| 222 | /* logic */ | ||
| 223 | static void render_luna(int LUNA_X, int LUNA_Y) { | ||
| 224 | |||
| 225 | /* Sit */ | ||
| 226 | static const char PROGMEM sit[2][ANIM_SIZE] = { | ||
| 227 | /* 'sit1', 32x22px */ | ||
| 228 | { | ||
| 229 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1c, | ||
| 230 | 0x02, 0x05, 0x02, 0x24, 0x04, 0x04, 0x02, 0xa9, 0x1e, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 231 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x08, 0x68, 0x10, 0x08, 0x04, 0x03, 0x00, 0x00, | ||
| 232 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x82, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 233 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0c, 0x10, 0x10, 0x20, 0x20, 0x20, 0x28, | ||
| 234 | 0x3e, 0x1c, 0x20, 0x20, 0x3e, 0x0f, 0x11, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 235 | }, | ||
| 236 | |||
| 237 | /* 'sit2', 32x22px */ | ||
| 238 | { | ||
| 239 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1c, | ||
| 240 | 0x02, 0x05, 0x02, 0x24, 0x04, 0x04, 0x02, 0xa9, 0x1e, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 241 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x90, 0x08, 0x18, 0x60, 0x10, 0x08, 0x04, 0x03, 0x00, 0x00, | ||
| 242 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0e, 0x82, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 243 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0c, 0x10, 0x10, 0x20, 0x20, 0x20, 0x28, | ||
| 244 | 0x3e, 0x1c, 0x20, 0x20, 0x3e, 0x0f, 0x11, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 245 | } | ||
| 246 | }; | ||
| 247 | |||
| 248 | /* Walk */ | ||
| 249 | static const char PROGMEM walk[2][ANIM_SIZE] = { | ||
| 250 | /* 'walk1', 32x22px */ | ||
| 251 | { | ||
| 252 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x90, 0x90, 0x90, 0xa0, 0xc0, 0x80, 0x80, | ||
| 253 | 0x80, 0x70, 0x08, 0x14, 0x08, 0x90, 0x10, 0x10, 0x08, 0xa4, 0x78, 0x80, 0x00, 0x00, 0x00, 0x00, | ||
| 254 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, | ||
| 255 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x18, 0xea, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, | ||
| 256 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x20, 0x20, 0x3c, 0x0f, 0x11, 0x1f, 0x03, | ||
| 257 | 0x06, 0x18, 0x20, 0x20, 0x3c, 0x0c, 0x12, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 258 | }, | ||
| 259 | |||
| 260 | /* 'walk2', 32x22px */ | ||
| 261 | { | ||
| 262 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x20, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, | ||
| 263 | 0x00, 0xe0, 0x10, 0x28, 0x10, 0x20, 0x20, 0x20, 0x10, 0x48, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 264 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x20, 0xf8, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, | ||
| 265 | 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x30, 0xd5, 0x20, 0x1f, 0x00, 0x00, 0x00, 0x00, | ||
| 266 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x30, 0x0c, 0x02, 0x05, 0x09, 0x12, 0x1e, | ||
| 267 | 0x02, 0x1c, 0x14, 0x08, 0x10, 0x20, 0x2c, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 268 | } | ||
| 269 | }; | ||
| 270 | |||
| 271 | /* Run */ | ||
| 272 | static const char PROGMEM run[2][ANIM_SIZE] = { | ||
| 273 | /* 'run1', 32x22px */ | ||
| 274 | { | ||
| 275 | 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x08, 0x08, 0xc8, 0xb0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, | ||
| 276 | 0x80, 0x40, 0x40, 0x3c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, | ||
| 277 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0xc4, 0xa4, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, | ||
| 278 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc8, 0x58, 0x28, 0x2a, 0x10, 0x0f, 0x00, 0x00, | ||
| 279 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x09, 0x04, 0x04, 0x04, 0x04, 0x02, 0x03, 0x02, 0x01, 0x01, | ||
| 280 | 0x02, 0x02, 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 281 | }, | ||
| 282 | |||
| 283 | /* 'run2', 32x22px */ | ||
| 284 | { | ||
| 285 | 0x00, 0x00, 0x00, 0xe0, 0x10, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, | ||
| 286 | 0x80, 0x80, 0x78, 0x28, 0x08, 0x10, 0x20, 0x30, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, | ||
| 287 | 0x00, 0x00, 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, | ||
| 288 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0xb0, 0x50, 0x55, 0x20, 0x1f, 0x00, 0x00, | ||
| 289 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, | ||
| 290 | 0x02, 0x1e, 0x20, 0x20, 0x18, 0x0c, 0x14, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 291 | } | ||
| 292 | }; | ||
| 293 | |||
| 294 | /* Bark */ | ||
| 295 | static const char PROGMEM bark[2][ANIM_SIZE] = { | ||
| 296 | /* 'bark1', 32x22px */ | ||
| 297 | { | ||
| 298 | 0x00, 0xc0, 0x20, 0x10, 0xd0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, | ||
| 299 | 0x3c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 300 | 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, | ||
| 301 | 0x00, 0x00, 0x00, 0x00, 0x80, 0xc8, 0x48, 0x28, 0x2a, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 302 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x02, | ||
| 303 | 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 304 | }, | ||
| 305 | |||
| 306 | /* 'bark2', 32x22px */ | ||
| 307 | { | ||
| 308 | 0x00, 0xe0, 0x10, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, | ||
| 309 | 0x40, 0x2c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, | ||
| 310 | 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, | ||
| 311 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x48, 0x28, 0x2a, 0x10, 0x0f, 0x20, 0x4a, 0x09, 0x10, | ||
| 312 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x02, | ||
| 313 | 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 314 | } | ||
| 315 | }; | ||
| 316 | |||
| 317 | /* Sneak */ | ||
| 318 | static const char PROGMEM sneak[2][ANIM_SIZE] = { | ||
| 319 | /* 'sneak1', 32x22px */ | ||
| 320 | { | ||
| 321 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, | ||
| 322 | 0x00, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 323 | 0x00, 0x00, 0x00, 0x00, 0x1e, 0x21, 0xf0, 0x04, 0x02, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x04, | ||
| 324 | 0x04, 0x04, 0x03, 0x01, 0x00, 0x00, 0x09, 0x01, 0x80, 0x80, 0xab, 0x04, 0xf8, 0x00, 0x00, 0x00, | ||
| 325 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x20, 0x20, 0x3c, 0x0f, 0x11, 0x1f, 0x02, 0x06, | ||
| 326 | 0x18, 0x20, 0x20, 0x38, 0x08, 0x10, 0x18, 0x04, 0x04, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, | ||
| 327 | }, | ||
| 328 | |||
| 329 | /* 'sneak2', 32x22px */ | ||
| 330 | { | ||
| 331 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 332 | 0x00, 0x00, 0xe0, 0xa0, 0x20, 0x40, 0x80, 0xc0, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 333 | 0x00, 0x00, 0x00, 0x00, 0x3e, 0x41, 0xf0, 0x04, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x02, 0x04, | ||
| 334 | 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x40, 0x40, 0x55, 0x82, 0x7c, 0x00, 0x00, 0x00, | ||
| 335 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x30, 0x0c, 0x02, 0x05, 0x09, 0x12, 0x1e, 0x04, | ||
| 336 | 0x18, 0x10, 0x08, 0x10, 0x20, 0x28, 0x34, 0x06, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 337 | } | ||
| 338 | }; | ||
| 339 | |||
| 340 | /* animation */ | ||
| 341 | void animate_luna(void) { | ||
| 342 | |||
| 343 | /* jump */ | ||
| 344 | if (isJumping || !showedJump) { | ||
| 345 | |||
| 346 | /* clear */ | ||
| 347 | oled_set_cursor(LUNA_X,LUNA_Y +2); | ||
| 348 | oled_write(" ", false); | ||
| 349 | |||
| 350 | oled_set_cursor(LUNA_X,LUNA_Y -1); | ||
| 351 | |||
| 352 | showedJump = true; | ||
| 353 | } else { | ||
| 354 | |||
| 355 | /* clear */ | ||
| 356 | oled_set_cursor(LUNA_X,LUNA_Y -1); | ||
| 357 | oled_write(" ", false); | ||
| 358 | |||
| 359 | oled_set_cursor(LUNA_X,LUNA_Y); | ||
| 360 | } | ||
| 361 | |||
| 362 | /* switch frame */ | ||
| 363 | current_frame = (current_frame + 1) % 2; | ||
| 364 | |||
| 365 | /* current status */ | ||
| 366 | if(led_usb_state.caps_lock) { | ||
| 367 | oled_write_raw_P(bark[abs(1 - current_frame)], ANIM_SIZE); | ||
| 368 | |||
| 369 | } else if(isSneaking) { | ||
| 370 | oled_write_raw_P(sneak[abs(1 - current_frame)], ANIM_SIZE); | ||
| 371 | |||
| 372 | } else if(current_wpm <= MIN_WALK_SPEED) { | ||
| 373 | oled_write_raw_P(sit[abs(1 - current_frame)], ANIM_SIZE); | ||
| 374 | |||
| 375 | } else if(current_wpm <= MIN_RUN_SPEED) { | ||
| 376 | oled_write_raw_P(walk[abs(1 - current_frame)], ANIM_SIZE); | ||
| 377 | |||
| 378 | } else { | ||
| 379 | oled_write_raw_P(run[abs(1 - current_frame)], ANIM_SIZE); | ||
| 380 | } | ||
| 381 | } | ||
| 382 | |||
| 383 | /* animation timer */ | ||
| 384 | if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) { | ||
| 385 | anim_timer = timer_read32(); | ||
| 386 | animate_luna(); | ||
| 387 | } | ||
| 388 | |||
| 389 | /* this fixes the screen on and off bug */ | ||
| 390 | if (current_wpm > 0) { | ||
| 391 | oled_on(); | ||
| 392 | anim_sleep = timer_read32(); | ||
| 393 | } else if(timer_elapsed32(anim_sleep) > OLED_TIMEOUT) { | ||
| 394 | oled_off(); | ||
| 395 | } | ||
| 396 | |||
| 397 | } | ||
| 398 | |||
| 399 | /* KEYBOARD PET END */ | ||
| 400 | |||
| 401 | static void print_logo_narrow(void) { | ||
| 402 | render_logo(); | ||
| 403 | |||
| 404 | /* wpm counter */ | ||
| 405 | uint8_t n = get_current_wpm(); | ||
| 406 | char wpm_str[4]; | ||
| 407 | oled_set_cursor(0,14); | ||
| 408 | wpm_str[3] = '\0'; | ||
| 409 | wpm_str[2] = '0' + n % 10; | ||
| 410 | wpm_str[1] = '0' + ( n /= 10) % 10; | ||
| 411 | wpm_str[0] = '0' + n / 10; | ||
| 412 | oled_write(wpm_str, false); | ||
| 413 | |||
| 414 | oled_set_cursor(0,15); | ||
| 415 | oled_write(" wpm", false); | ||
| 416 | } | ||
| 417 | |||
| 418 | static void print_status_narrow(void) { | ||
| 419 | /* Print current mode */ | ||
| 420 | oled_set_cursor(0,0); | ||
| 421 | if (keymap_config.swap_lctl_lgui) { | ||
| 422 | oled_write_raw_P(mac_logo, sizeof(mac_logo)); | ||
| 423 | } else { | ||
| 424 | oled_write_raw_P(windows_logo, sizeof(windows_logo)); | ||
| 425 | } | ||
| 426 | |||
| 427 | oled_set_cursor(0,3); | ||
| 428 | |||
| 429 | switch (get_highest_layer(default_layer_state)) { | ||
| 430 | case _QWERTY: | ||
| 431 | oled_write("QWRTY", false); | ||
| 432 | break; | ||
| 433 | case _GAMING: | ||
| 434 | oled_write("GAMES", false); | ||
| 435 | break; | ||
| 436 | default: | ||
| 437 | oled_write("UNDEF", false); | ||
| 438 | } | ||
| 439 | |||
| 440 | oled_set_cursor(0,5); | ||
| 441 | |||
| 442 | /* Print current layer */ | ||
| 443 | oled_write("LAYER", false); | ||
| 444 | |||
| 445 | oled_set_cursor(0,6); | ||
| 446 | |||
| 447 | switch (get_highest_layer(layer_state)) { | ||
| 448 | case _QWERTY: | ||
| 449 | oled_write("Base ", false); | ||
| 450 | break; | ||
| 451 | case _GAMING: | ||
| 452 | oled_write("Games", false); | ||
| 453 | break; | ||
| 454 | case _RAISE: | ||
| 455 | oled_write("Raise", false); | ||
| 456 | break; | ||
| 457 | case _LOWER: | ||
| 458 | oled_write("Lower", false); | ||
| 459 | break; | ||
| 460 | case _ADJUST: | ||
| 461 | oled_write("Adj ", false); | ||
| 462 | break; | ||
| 463 | default: | ||
| 464 | oled_write("Undef", false); | ||
| 465 | } | ||
| 466 | |||
| 467 | /* caps lock */ | ||
| 468 | oled_set_cursor(0,8); | ||
| 469 | oled_write("CPSLK", led_usb_state.caps_lock); | ||
| 470 | |||
| 471 | /* KEYBOARD PET RENDER START */ | ||
| 472 | |||
| 473 | render_luna(0,13); | ||
| 474 | |||
| 475 | /* KEYBOARD PET RENDER END */ | ||
| 476 | } | ||
| 477 | |||
| 478 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 479 | return OLED_ROTATION_270; | ||
| 480 | } | ||
| 481 | |||
| 482 | void oled_task_user(void) { | ||
| 483 | |||
| 484 | /* KEYBOARD PET VARIABLES START */ | ||
| 485 | |||
| 486 | current_wpm = get_current_wpm(); | ||
| 487 | led_usb_state = host_keyboard_led_state(); | ||
| 488 | |||
| 489 | /* KEYBOARD PET VARIABLES END */ | ||
| 490 | |||
| 491 | if (is_keyboard_master()) { | ||
| 492 | print_status_narrow(); | ||
| 493 | } else { | ||
| 494 | print_logo_narrow(); | ||
| 495 | } | ||
| 496 | } | ||
| 497 | |||
| 498 | #endif | ||
| 499 | |||
| 500 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 501 | switch (keycode) { | ||
| 502 | case KC_QWERTY: | ||
| 503 | if (record->event.pressed) { | ||
| 504 | set_single_persistent_default_layer(_QWERTY); | ||
| 505 | } | ||
| 506 | return false; | ||
| 507 | case KC_GAMING: | ||
| 508 | if (record->event.pressed) { | ||
| 509 | set_single_persistent_default_layer(_GAMING); | ||
| 510 | } | ||
| 511 | return false; | ||
| 512 | case KC_LOWER: | ||
| 513 | if (record->event.pressed) { | ||
| 514 | layer_on(_LOWER); | ||
| 515 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 516 | } else { | ||
| 517 | layer_off(_LOWER); | ||
| 518 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 519 | } | ||
| 520 | return false; | ||
| 521 | case KC_RAISE: | ||
| 522 | if (record->event.pressed) { | ||
| 523 | layer_on(_RAISE); | ||
| 524 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 525 | } else { | ||
| 526 | layer_off(_RAISE); | ||
| 527 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 528 | } | ||
| 529 | return false; | ||
| 530 | case KC_ADJUST: | ||
| 531 | if (record->event.pressed) { | ||
| 532 | layer_on(_ADJUST); | ||
| 533 | } else { | ||
| 534 | layer_off(_ADJUST); | ||
| 535 | } | ||
| 536 | return false; | ||
| 537 | case KC_PRVWD: | ||
| 538 | if (record->event.pressed) { | ||
| 539 | if (keymap_config.swap_lctl_lgui) { | ||
| 540 | register_mods(mod_config(MOD_LALT)); | ||
| 541 | register_code(KC_LEFT); | ||
| 542 | } else { | ||
| 543 | register_mods(mod_config(MOD_LCTL)); | ||
| 544 | register_code(KC_LEFT); | ||
| 545 | } | ||
| 546 | } else { | ||
| 547 | if (keymap_config.swap_lctl_lgui) { | ||
| 548 | unregister_mods(mod_config(MOD_LALT)); | ||
| 549 | unregister_code(KC_LEFT); | ||
| 550 | } else { | ||
| 551 | unregister_mods(mod_config(MOD_LCTL)); | ||
| 552 | unregister_code(KC_LEFT); | ||
| 553 | } | ||
| 554 | } | ||
| 555 | break; | ||
| 556 | case KC_NXTWD: | ||
| 557 | if (record->event.pressed) { | ||
| 558 | if (keymap_config.swap_lctl_lgui) { | ||
| 559 | register_mods(mod_config(MOD_LALT)); | ||
| 560 | register_code(KC_RIGHT); | ||
| 561 | } else { | ||
| 562 | register_mods(mod_config(MOD_LCTL)); | ||
| 563 | register_code(KC_RIGHT); | ||
| 564 | } | ||
| 565 | } else { | ||
| 566 | if (keymap_config.swap_lctl_lgui) { | ||
| 567 | unregister_mods(mod_config(MOD_LALT)); | ||
| 568 | unregister_code(KC_RIGHT); | ||
| 569 | } else { | ||
| 570 | unregister_mods(mod_config(MOD_LCTL)); | ||
| 571 | unregister_code(KC_RIGHT); | ||
| 572 | } | ||
| 573 | } | ||
| 574 | break; | ||
| 575 | case KC_LSTRT: | ||
| 576 | if (record->event.pressed) { | ||
| 577 | if (keymap_config.swap_lctl_lgui) { | ||
| 578 | /* CMD-arrow on Mac, but we have CTL and GUI swapped */ | ||
| 579 | register_mods(mod_config(MOD_LCTL)); | ||
| 580 | register_code(KC_LEFT); | ||
| 581 | } else { | ||
| 582 | register_code(KC_HOME); | ||
| 583 | } | ||
| 584 | } else { | ||
| 585 | if (keymap_config.swap_lctl_lgui) { | ||
| 586 | unregister_mods(mod_config(MOD_LCTL)); | ||
| 587 | unregister_code(KC_LEFT); | ||
| 588 | } else { | ||
| 589 | unregister_code(KC_HOME); | ||
| 590 | } | ||
| 591 | } | ||
| 592 | break; | ||
| 593 | case KC_LEND: | ||
| 594 | if (record->event.pressed) { | ||
| 595 | if (keymap_config.swap_lctl_lgui) { | ||
| 596 | /* CMD-arrow on Mac, but we have CTL and GUI swapped */ | ||
| 597 | register_mods(mod_config(MOD_LCTL)); | ||
| 598 | register_code(KC_RIGHT); | ||
| 599 | } else { | ||
| 600 | register_code(KC_END); | ||
| 601 | } | ||
| 602 | } else { | ||
| 603 | if (keymap_config.swap_lctl_lgui) { | ||
| 604 | unregister_mods(mod_config(MOD_LCTL)); | ||
| 605 | unregister_code(KC_RIGHT); | ||
| 606 | } else { | ||
| 607 | unregister_code(KC_END); | ||
| 608 | } | ||
| 609 | } | ||
| 610 | break; | ||
| 611 | case KC_DLINE: | ||
| 612 | if (record->event.pressed) { | ||
| 613 | register_mods(mod_config(MOD_LCTL)); | ||
| 614 | register_code(KC_BSPC); | ||
| 615 | } else { | ||
| 616 | unregister_mods(mod_config(MOD_LCTL)); | ||
| 617 | unregister_code(KC_BSPC); | ||
| 618 | } | ||
| 619 | break; | ||
| 620 | case KC_COPY: | ||
| 621 | if (record->event.pressed) { | ||
| 622 | register_mods(mod_config(MOD_LCTL)); | ||
| 623 | register_code(KC_C); | ||
| 624 | } else { | ||
| 625 | unregister_mods(mod_config(MOD_LCTL)); | ||
| 626 | unregister_code(KC_C); | ||
| 627 | } | ||
| 628 | return false; | ||
| 629 | case KC_PASTE: | ||
| 630 | if (record->event.pressed) { | ||
| 631 | register_mods(mod_config(MOD_LCTL)); | ||
| 632 | register_code(KC_V); | ||
| 633 | } else { | ||
| 634 | unregister_mods(mod_config(MOD_LCTL)); | ||
| 635 | unregister_code(KC_V); | ||
| 636 | } | ||
| 637 | return false; | ||
| 638 | case KC_CUT: | ||
| 639 | if (record->event.pressed) { | ||
| 640 | register_mods(mod_config(MOD_LCTL)); | ||
| 641 | register_code(KC_X); | ||
| 642 | } else { | ||
| 643 | unregister_mods(mod_config(MOD_LCTL)); | ||
| 644 | unregister_code(KC_X); | ||
| 645 | } | ||
| 646 | return false; | ||
| 647 | break; | ||
| 648 | case KC_UNDO: | ||
| 649 | if (record->event.pressed) { | ||
| 650 | register_mods(mod_config(MOD_LCTL)); | ||
| 651 | register_code(KC_Z); | ||
| 652 | } else { | ||
| 653 | unregister_mods(mod_config(MOD_LCTL)); | ||
| 654 | unregister_code(KC_Z); | ||
| 655 | } | ||
| 656 | return false; | ||
| 657 | |||
| 658 | /* Smart Backspace Delete */ | ||
| 659 | |||
| 660 | case KC_RSFT: | ||
| 661 | case KC_LSFT: | ||
| 662 | shift_held = record->event.pressed; | ||
| 663 | held_shift = keycode; | ||
| 664 | break; | ||
| 665 | case KC_BSPC_DEL: | ||
| 666 | if (record->event.pressed) { | ||
| 667 | if (shift_held) { | ||
| 668 | unregister_code(held_shift); | ||
| 669 | register_code(KC_DEL); | ||
| 670 | } else { | ||
| 671 | register_code(KC_BSPC); | ||
| 672 | } | ||
| 673 | } else { | ||
| 674 | unregister_code(KC_DEL); | ||
| 675 | unregister_code(KC_BSPC); | ||
| 676 | if (shift_held) { | ||
| 677 | register_code(held_shift); | ||
| 678 | } | ||
| 679 | } | ||
| 680 | return false; | ||
| 681 | |||
| 682 | /* LAYER */ | ||
| 683 | |||
| 684 | case KC_LAYER: | ||
| 685 | if (record->event.pressed) { | ||
| 686 | if (shift_held) { | ||
| 687 | if (record->event.pressed) { | ||
| 688 | if (get_highest_layer(default_layer_state) == _QWERTY) { | ||
| 689 | set_single_persistent_default_layer(_GAMING); | ||
| 690 | } else if(get_highest_layer(default_layer_state) == _GAMING) { | ||
| 691 | set_single_persistent_default_layer(_QWERTY); | ||
| 692 | } | ||
| 693 | } | ||
| 694 | } else { | ||
| 695 | layer_on(_LOWER); | ||
| 696 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 697 | } | ||
| 698 | } else { | ||
| 699 | layer_off(_LOWER); | ||
| 700 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 701 | } | ||
| 702 | return false; | ||
| 703 | |||
| 704 | /* KEYBOARD PET STATUS START */ | ||
| 705 | |||
| 706 | case KC_LCTL: | ||
| 707 | case KC_RCTL: | ||
| 708 | if (record->event.pressed) { | ||
| 709 | isSneaking = true; | ||
| 710 | } else { | ||
| 711 | isSneaking = false; | ||
| 712 | } | ||
| 713 | break; | ||
| 714 | case KC_SPC: | ||
| 715 | if (record->event.pressed) { | ||
| 716 | isJumping = true; | ||
| 717 | showedJump = false; | ||
| 718 | } else { | ||
| 719 | isJumping = false; | ||
| 720 | } | ||
| 721 | break; | ||
| 722 | |||
| 723 | /* KEYBOARD PET STATUS END */ | ||
| 724 | } | ||
| 725 | return true; | ||
| 726 | } | ||
| 727 | |||
| 728 | #ifdef ENCODER_ENABLE | ||
| 729 | |||
| 730 | void encoder_update_user(uint8_t index, bool clockwise) { | ||
| 731 | if (index == 0) { | ||
| 732 | if (clockwise) { | ||
| 733 | if(shift_held) { | ||
| 734 | tap_code(KC_MNXT); | ||
| 735 | } else { | ||
| 736 | tap_code(KC_RIGHT); | ||
| 737 | } | ||
| 738 | } else { | ||
| 739 | if(shift_held) { | ||
| 740 | tap_code(KC_MPRV); | ||
| 741 | } else { | ||
| 742 | tap_code(KC_LEFT); | ||
| 743 | } | ||
| 744 | } | ||
| 745 | } else if (index == 1) { | ||
| 746 | if (clockwise) { | ||
| 747 | if(shift_held) { | ||
| 748 | tap_code(KC_VOLU); | ||
| 749 | } else { | ||
| 750 | tap_code(KC_DOWN); | ||
| 751 | } | ||
| 752 | } else { | ||
| 753 | if(shift_held) { | ||
| 754 | tap_code(KC_VOLD); | ||
| 755 | } else { | ||
| 756 | tap_code(KC_UP); | ||
| 757 | } | ||
| 758 | } | ||
| 759 | } | ||
| 760 | } | ||
| 761 | |||
| 762 | #endif | ||
diff --git a/keyboards/sofle/keymaps/helltm/readme.md b/keyboards/sofle/keymaps/helltm/readme.md new file mode 100644 index 000000000..3034f740a --- /dev/null +++ b/keyboards/sofle/keymaps/helltm/readme.md | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | [](https://www.youtube.com/watch?v=HgIQRazCAjo) | ||
| 2 | |||
| 3 | # Personal keymap for Sofle Keyboard rev1 | ||
| 4 | |||
| 5 | |||
| 6 | Features: | ||
| 7 | |||
| 8 | - Modes for Qwerty and Games support. Games swaps enter and space to play FPS games and adds directional arrows. | ||
| 9 | - Modified Qwerty layout to allow usage without hidden layers (for the most). | ||
| 10 | - The OLED on master half shows selected OS, Layer and caps lock state. | ||
| 11 | - The secondary display shows a logo and the wpm counter. | ||
| 12 | - Left encoder controls arrow left/right. Right encoder arrow up/down. | ||
| 13 | - Holding shift changes the encoders to next/previous and volup/voldown respectively. | ||
| 14 | - Press the encoders to play/pause and mute. | ||
| 15 | - Smart Backspace (shift + backspace to delete) | ||
| 16 | - Single Layer button (press to Lower, shift + press to change mode) | ||
| 17 | - **Features Luna, your keyboard pet!** | ||
| 18 | |||
| 19 | #Luna, the keyboard pet | ||
| 20 | |||
| 21 | Features: | ||
| 22 | - Luna reacts to your wpm counter | ||
| 23 | - under 10 wpm she sits | ||
| 24 | - between 10 and 40 wpm she walks | ||
| 25 | - over 40 wpm she runs | ||
| 26 | - She will move sneakily if you hold down Ctrl | ||
| 27 | - Will bark at people on the internet if you activate Caps Lock! | ||
| 28 | - Luna jumps every time you hit Space | ||
| 29 | |||
| 30 | |||
| 31 | Learn how to adopt a keyboard pet here | ||
| 32 | https://www.youtube.com/watch?v=HgIQRazCAjo | ||
diff --git a/keyboards/sofle/keymaps/helltm/rules.mk b/keyboards/sofle/keymaps/helltm/rules.mk new file mode 100644 index 000000000..9601ec40b --- /dev/null +++ b/keyboards/sofle/keymaps/helltm/rules.mk | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | OLED_DRIVER_ENABLE = yes | ||
| 2 | ENCODER_ENABLE = yes | ||
| 3 | CONSOLE_ENABLE = yes | ||
| 4 | EXTRAKEY_ENABLE = yes | ||
| 5 | |||
| 6 | WPM_ENABLE = yes | ||
