diff options
| author | Drashna Jaelre <drashna@live.com> | 2021-09-29 11:16:11 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-29 11:16:11 -0700 |
| commit | 1e54796f0cf469e2c1fdd880cc288b04e7b83985 (patch) | |
| tree | bdcc76205faf3e7ec325fd73d36e932cdc0441da /layouts | |
| parent | 929d959ef9e2572b4744930d86e322936e6e1f0e (diff) | |
| download | qmk_firmware-1e54796f0cf469e2c1fdd880cc288b04e7b83985.tar.gz qmk_firmware-1e54796f0cf469e2c1fdd880cc288b04e7b83985.zip | |
[Keymap] Update to Drashna Code (#14644)
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/community/split_3x6_3/drashna/keymap.c | 141 |
1 files changed, 137 insertions, 4 deletions
diff --git a/layouts/community/split_3x6_3/drashna/keymap.c b/layouts/community/split_3x6_3/drashna/keymap.c index 707dd3646..a3145a404 100644 --- a/layouts/community/split_3x6_3/drashna/keymap.c +++ b/layouts/community/split_3x6_3/drashna/keymap.c | |||
| @@ -97,6 +97,143 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 97 | 97 | ||
| 98 | #ifdef OLED_ENABLE | 98 | #ifdef OLED_ENABLE |
| 99 | oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return OLED_ROTATION_270; } | 99 | oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return OLED_ROTATION_270; } |
| 100 | |||
| 101 | # ifdef CONVERT_TO_PROTON_C | ||
| 102 | // WPM-responsive animation stuff here | ||
| 103 | # define SLEEP_FRAMES 2 | ||
| 104 | # define SLEEP_SPEED 10 // below this wpm value your animation will idle | ||
| 105 | |||
| 106 | # define WAKE_FRAMES 2 // uncomment if >1 | ||
| 107 | |||
| 108 | # define KAKI_FRAMES 3 | ||
| 109 | # define KAKI_SPEED 40 // above this wpm value typing animation to triggere | ||
| 110 | |||
| 111 | # define RTOGI_FRAMES 2 | ||
| 112 | //#define LTOGI_FRAMES 2 | ||
| 113 | |||
| 114 | //#define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms | ||
| 115 | // #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing | ||
| 116 | # define ANIM_SIZE 512 // number of bytes in array, minimize for adequate firmware size, max is 1024 | ||
| 117 | |||
| 118 | uint32_t anim_timer = 0; | ||
| 119 | uint32_t anim_frame_duration = 500; | ||
| 120 | uint8_t current_sleep_frame = 0; | ||
| 121 | uint8_t current_wake_frame = 0; // uncomment if WAKE_FRAMES >1 | ||
| 122 | uint8_t current_kaki_frame = 0; | ||
| 123 | uint8_t current_rtogi_frame = 0; | ||
| 124 | // uint8_t current_ltogi_frame = 0; | ||
| 125 | // clang-format off | ||
| 126 | void render_kitty(void) { | ||
| 127 | // Images credit j-inc(/James Incandenza) and pixelbenny. Credit to obosob for initial animation approach. | ||
| 128 | static const char PROGMEM sleep[SLEEP_FRAMES][ANIM_SIZE] = {{ | ||
| 129 | // 'sleep1', 32x32px | ||
| 130 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xa8, 0x48, 0xa8, 0x18, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 131 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x80, 0x44, 0x84, 0x06, 0x05, 0x04, 0x80, 0x40, 0x20, 0x10, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 132 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x18, 0x04, 0x04, 0x02, 0x7a, 0x86, 0x01, 0x80, 0x80, 0x01, 0x03, 0x05, 0x07, 0x01, 0x00, 0x00, 0x80, 0x83, 0x45, 0xfa, 0x3c, 0xe0, 0x00, 0x00, | ||
| 133 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x29, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00, | ||
| 134 | }, | ||
| 135 | {// 'sleep2', 32x32px | ||
| 136 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 137 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x3a, 0x2a, 0x26, 0x22, 0x80, 0xc0, 0x80, 0x00, 0x24, 0x34, 0x2c, 0xe4, 0x60, 0x10, 0x70, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 138 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x38, 0x04, 0x02, 0x02, 0x01, 0x79, 0x87, 0x01, 0x80, 0x81, 0x83, 0x05, 0x05, 0x03, 0x01, 0x00, 0x00, 0x80, 0x43, 0x05, 0xfa, 0x3c, 0xe0, 0x00, 0x00, | ||
| 139 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x28, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00 | ||
| 140 | }}; | ||
| 141 | static const char PROGMEM wake[WAKE_FRAMES][ANIM_SIZE] = {{ | ||
| 142 | // 'mati2', 32x32px | ||
| 143 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 144 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x40, 0x40, 0x5c, 0x00, 0x01, 0x41, 0x01, 0x00, 0x5c, 0x40, 0x40, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 145 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 146 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08 | ||
| 147 | }, | ||
| 148 | {// 'mati3', 32x32px | ||
| 149 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 150 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x90, 0x12, 0x0a, 0x02, 0xf4, 0x09, 0x0d, 0xf1, 0x04, 0x02, 0x0a, 0x12, 0x90, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 151 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x01, 0x81, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 152 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08 | ||
| 153 | }}; | ||
| 154 | static const char PROGMEM kaki[KAKI_FRAMES][ANIM_SIZE] = {{ | ||
| 155 | // 'jare2', 32x32px | ||
| 156 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x80, 0x80, 0x00, 0xfc, 0x84, 0x08, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 157 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1e, 0x60, 0x80, 0x00, 0x00, 0x91, 0xa1, 0x80, 0x00, 0x00, 0x22, 0x84, 0x40, 0x50, 0x48, 0xc1, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 158 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x41, 0x82, 0xe2, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x88, 0x4f, 0x02, 0x22, 0xe2, 0x9f, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 159 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x14, 0x10, 0x10, 0x10, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1a, 0x0a, 0x0a, 0x04, 0x00 | ||
| 160 | }, | ||
| 161 | { | ||
| 162 | // 'kaki1', 32x32px | ||
| 163 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 164 | 0x00, 0x00, 0x06, 0x1a, 0x22, 0xc2, 0x04, 0x04, 0x04, 0x07, 0x00, 0xc0, 0x20, 0x10, 0x80, 0x80, 0x01, 0x01, 0x02, 0xfc, 0xfe, 0x02, 0x3c, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 165 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x09, 0x08, 0x00, 0x80, 0x00, 0x06, 0x09, 0x1b, 0xee, 0x00, 0x00, 0x00, 0x00, 0x81, 0xfe, 0x00, 0x00, 0x00, 0x00, | ||
| 166 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x16, 0x15, 0x14, 0x14, 0x14, 0x14, 0x08 | ||
| 167 | }, | ||
| 168 | {// 'kaki2', 32x32px | ||
| 169 | 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 170 | 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x01, 0x02, 0x04, 0x04, 0x03, 0x80, 0x40, 0x40, 0x20, 0x00, 0x01, 0x02, 0x8c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 171 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x0a, 0x0e, 0x1d, 0x95, 0x24, 0x24, 0x27, 0x13, 0xe1, 0x01, 0x01, 0x01, 0x01, 0x02, 0xfc, 0x00, 0x00, 0x00, 0x00, | ||
| 172 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14, 0x14, 0x08, | ||
| 173 | }}; | ||
| 174 | static const char PROGMEM rtogi[KAKI_FRAMES][ANIM_SIZE] = {{ | ||
| 175 | // 'rtogi1', 32x32px | ||
| 176 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x0f, 0x90, 0x10, 0x20, 0xf0, 0xf8, 0xf8, | ||
| 177 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0xc7, 0xc4, 0x62, 0x23, 0x11, 0x3f, | ||
| 178 | 0x80, 0x40, 0x20, 0x10, 0x88, 0xcc, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 179 | 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 180 | }, | ||
| 181 | {// 'rtogi2', 32x32px | ||
| 182 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f, 0xa0, 0x20, 0x40, 0x80, 0x00, 0xf0, | ||
| 183 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x28, 0x6b, 0x40, 0xa0, 0x99, 0x86, 0xff, | ||
| 184 | 0x0f, 0x11, 0x22, 0x44, 0x48, 0x4c, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x06, 0x06, 0x06, 0x0e, 0x0e, 0x06, 0x01, | ||
| 185 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 186 | }}; | ||
| 187 | |||
| 188 | // assumes 1 frame prep stage | ||
| 189 | extern bool swap_hands; | ||
| 190 | void animation_phase(void) { | ||
| 191 | if (swap_hands) { | ||
| 192 | anim_frame_duration = 300; | ||
| 193 | current_rtogi_frame = (current_rtogi_frame + 1) % RTOGI_FRAMES; | ||
| 194 | oled_write_raw_P(rtogi[abs((RTOGI_FRAMES - 1) - current_rtogi_frame)], ANIM_SIZE); | ||
| 195 | } else { | ||
| 196 | if (get_current_wpm() <= SLEEP_SPEED) { | ||
| 197 | anim_frame_duration = 500; | ||
| 198 | current_sleep_frame = (current_sleep_frame + 1) % SLEEP_FRAMES; | ||
| 199 | oled_write_raw_P(sleep[abs((SLEEP_FRAMES - 1) - current_sleep_frame)], ANIM_SIZE); | ||
| 200 | } | ||
| 201 | // if(get_current_wpm() >IDLE_SPEED && get_current_wpm() <TAP_SPEED){ | ||
| 202 | if (get_current_wpm() > SLEEP_SPEED) { | ||
| 203 | anim_frame_duration = 800; | ||
| 204 | current_wake_frame = (current_wake_frame + 1) % WAKE_FRAMES; | ||
| 205 | oled_write_raw_P(wake[abs((WAKE_FRAMES - 1) - current_wake_frame)], ANIM_SIZE); | ||
| 206 | // oled_write_raw_P(wake[0], ANIM_SIZE); // remove if IDLE_FRAMES >1 | ||
| 207 | } | ||
| 208 | if (get_current_wpm() >= KAKI_SPEED) { | ||
| 209 | anim_frame_duration = 500; | ||
| 210 | current_kaki_frame = (current_kaki_frame + 1) % KAKI_FRAMES; | ||
| 211 | oled_write_raw_P(kaki[abs((KAKI_FRAMES - 1) - current_kaki_frame)], ANIM_SIZE); | ||
| 212 | } | ||
| 213 | } | ||
| 214 | } | ||
| 215 | if (get_current_wpm() != 000) { | ||
| 216 | // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) { | ||
| 217 | if (timer_elapsed32(anim_timer) > anim_frame_duration) { | ||
| 218 | anim_timer = timer_read32(); | ||
| 219 | animation_phase(); | ||
| 220 | } | ||
| 221 | } else { | ||
| 222 | // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) { | ||
| 223 | if (timer_elapsed32(anim_timer) > anim_frame_duration) { | ||
| 224 | anim_timer = timer_read32(); | ||
| 225 | animation_phase(); | ||
| 226 | } | ||
| 227 | } | ||
| 228 | } | ||
| 229 | |||
| 230 | void oled_driver_render_logo_right(void) { | ||
| 231 | render_kitty(); | ||
| 232 | |||
| 233 | oled_set_cursor(0, 4); | ||
| 234 | render_default_layer_state(); | ||
| 235 | } | ||
| 236 | # endif | ||
| 100 | #endif | 237 | #endif |
| 101 | 238 | ||
| 102 | #ifdef TAPPING_TERM_PER_KEY | 239 | #ifdef TAPPING_TERM_PER_KEY |
| @@ -111,10 +248,6 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { | |||
| 111 | #endif | 248 | #endif |
| 112 | 249 | ||
| 113 | #ifdef RGB_MATRIX_ENABLE | 250 | #ifdef RGB_MATRIX_ENABLE |
| 114 | void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); } | ||
| 115 | |||
| 116 | void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); } | ||
| 117 | |||
| 118 | void check_default_layer(uint8_t mode, uint8_t type, uint8_t led_min, uint8_t led_max) { | 251 | void check_default_layer(uint8_t mode, uint8_t type, uint8_t led_min, uint8_t led_max) { |
| 119 | switch (get_highest_layer(default_layer_state)) { | 252 | switch (get_highest_layer(default_layer_state)) { |
| 120 | case _QWERTY: | 253 | case _QWERTY: |
