307 lines
22 KiB
C
307 lines
22 KiB
C
/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "drashna.h"
|
|
|
|
enum crkbd_keycodes {
|
|
RGBRST = USER_SAFE_RANGE,
|
|
};
|
|
|
|
/*
|
|
* The `LAYOUT_crkbd_base` macro is a template to allow the use of identical
|
|
* modifiers for the default layouts (eg QWERTY, Colemak, Dvorak, etc), so
|
|
* that there is no need to set them up for each layout, and modify all of
|
|
* them if I want to change them. This helps to keep consistency and ease
|
|
* of use. K## is a placeholder to pass through the individual keycodes
|
|
*/
|
|
|
|
#ifdef CONVERT_TO_PROTON_C
|
|
# define MID_TMB ET_RAIS
|
|
#else
|
|
# define MID_TMB KC_ENT
|
|
#endif
|
|
|
|
// clang-format off
|
|
#define LAYOUT_split_3x6_3_wrapper(...) LAYOUT_split_3x6_3(__VA_ARGS__)
|
|
#define LAYOUT_split_3x6_3_base( \
|
|
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
|
|
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
|
|
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
|
|
) \
|
|
LAYOUT_split_3x6_3_wrapper( \
|
|
KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \
|
|
ALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \
|
|
OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \
|
|
OS_LGUI, KC_SPC, BK_LWER, DL_RAIS, MID_TMB, OS_RGUI \
|
|
)
|
|
#define LAYOUT_base_wrapper(...) LAYOUT_split_3x6_3_base(__VA_ARGS__)
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
[_DEFAULT_LAYER_1] = LAYOUT_base_wrapper(
|
|
_________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
|
|
_________________QWERTY_L2_________________, _________________QWERTY_R2_________________,
|
|
_________________QWERTY_L3_________________, _________________QWERTY_R3_________________
|
|
),
|
|
|
|
[_DEFAULT_LAYER_2] = LAYOUT_base_wrapper(
|
|
______________COLEMAK_MOD_DH_L1____________, ______________COLEMAK_MOD_DH_R1____________,
|
|
______________COLEMAK_MOD_DH_L2____________, ______________COLEMAK_MOD_DH_R2____________,
|
|
______________COLEMAK_MOD_DH_L3____________, ______________COLEMAK_MOD_DH_R3____________
|
|
),
|
|
|
|
[_DEFAULT_LAYER_3] = LAYOUT_base_wrapper(
|
|
_________________COLEMAK_L1________________, _________________COLEMAK_R1________________,
|
|
_________________COLEMAK_L2________________, _________________COLEMAK_R2________________,
|
|
_________________COLEMAK_L3________________, _________________COLEMAK_R3________________
|
|
),
|
|
|
|
[_DEFAULT_LAYER_4] = LAYOUT_base_wrapper(
|
|
_________________DVORAK_L1_________________, _________________DVORAK_R1_________________,
|
|
_________________DVORAK_L2_________________, _________________DVORAK_R2_________________,
|
|
_________________DVORAK_L3_________________, _________________DVORAK_R3_________________
|
|
),
|
|
|
|
[_LOWER] = LAYOUT_split_3x6_3_wrapper(
|
|
KC_F11, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_F11,
|
|
KC_F12, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE,
|
|
_______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______,
|
|
_______, _______, _______, _______, _______, _______
|
|
),
|
|
|
|
[_RAISE] = LAYOUT_split_3x6_3_wrapper(
|
|
_______, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______,
|
|
_______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS,
|
|
_______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______,
|
|
_______, _______, _______, _______, _______, _______
|
|
),
|
|
|
|
[_ADJUST] = LAYOUT_split_3x6_3_wrapper(
|
|
QK_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, QK_BOOT,
|
|
VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EE_CLR,
|
|
KEYLOCK, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, RGB_IDL,
|
|
QK_RBT, KC_NUKE, _______, _______, TG_MODS, AUTO_CTN
|
|
)
|
|
};
|
|
// clang-format on
|
|
|
|
#ifdef OLED_ENABLE
|
|
oled_rotation_t oled_init_keymap(oled_rotation_t rotation) {
|
|
return OLED_ROTATION_270;
|
|
}
|
|
|
|
# ifdef CONVERT_TO_PROTON_C
|
|
// WPM-responsive animation stuff here
|
|
# define SLEEP_FRAMES 2
|
|
# define SLEEP_SPEED 10 // below this wpm value your animation will idle
|
|
|
|
# define WAKE_FRAMES 2 // uncomment if >1
|
|
|
|
# define KAKI_FRAMES 3
|
|
# define KAKI_SPEED 40 // above this wpm value typing animation to triggere
|
|
|
|
# define RTOGI_FRAMES 2
|
|
// #define LTOGI_FRAMES 2
|
|
|
|
// #define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms
|
|
// #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing
|
|
# define ANIM_SIZE 512 // number of bytes in array, minimize for adequate firmware size, max is 1024
|
|
|
|
uint32_t anim_timer = 0;
|
|
uint32_t anim_frame_duration = 500;
|
|
uint8_t current_sleep_frame = 0;
|
|
uint8_t current_wake_frame = 0; // uncomment if WAKE_FRAMES >1
|
|
uint8_t current_kaki_frame = 0;
|
|
# ifdef SWAP_HANDS_ENABLE
|
|
uint8_t current_rtogi_frame = 0;
|
|
# endif
|
|
// uint8_t current_ltogi_frame = 0;
|
|
// clang-format off
|
|
void render_small_kitty(void) {
|
|
// Images credit j-inc(/James Incandenza) and pixelbenny. Credit to obosob for initial animation approach.
|
|
static const char PROGMEM sleep[SLEEP_FRAMES][ANIM_SIZE] = {{
|
|
// 'sleep1', 32x32px
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
},
|
|
{// 'sleep2', 32x32px
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
}};
|
|
static const char PROGMEM wake[WAKE_FRAMES][ANIM_SIZE] = {{
|
|
// 'mati2', 32x32px
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
},
|
|
{// 'mati3', 32x32px
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
}};
|
|
static const char PROGMEM kaki[KAKI_FRAMES][ANIM_SIZE] = {{
|
|
// 'jare2', 32x32px
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
},
|
|
{
|
|
// 'kaki1', 32x32px
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
},
|
|
{// 'kaki2', 32x32px
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
}};
|
|
#ifdef SWAP_HANDS_ENABLE
|
|
static const char PROGMEM rtogi[KAKI_FRAMES][ANIM_SIZE] = {{
|
|
// 'rtogi1', 32x32px
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
},
|
|
{// 'rtogi2', 32x32px
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
}};
|
|
#endif
|
|
// assumes 1 frame prep stage
|
|
#ifdef SWAP_HANDS_ENABLE
|
|
extern bool swap_hands;
|
|
#endif
|
|
void animation_phase(void) {
|
|
#ifdef SWAP_HANDS_ENABLE
|
|
if (swap_hands) {
|
|
anim_frame_duration = 300;
|
|
current_rtogi_frame = (current_rtogi_frame + 1) % RTOGI_FRAMES;
|
|
oled_write_raw_P(rtogi[abs((RTOGI_FRAMES - 1) - current_rtogi_frame)], ANIM_SIZE);
|
|
} else
|
|
#endif
|
|
{
|
|
if (get_current_wpm() <= SLEEP_SPEED) {
|
|
anim_frame_duration = 500;
|
|
current_sleep_frame = (current_sleep_frame + 1) % SLEEP_FRAMES;
|
|
oled_write_raw_P(sleep[abs((SLEEP_FRAMES - 1) - current_sleep_frame)], ANIM_SIZE);
|
|
}
|
|
// if(get_current_wpm() >IDLE_SPEED && get_current_wpm() <TAP_SPEED){
|
|
if (get_current_wpm() > SLEEP_SPEED) {
|
|
anim_frame_duration = 800;
|
|
current_wake_frame = (current_wake_frame + 1) % WAKE_FRAMES;
|
|
oled_write_raw_P(wake[abs((WAKE_FRAMES - 1) - current_wake_frame)], ANIM_SIZE);
|
|
// oled_write_raw_P(wake[0], ANIM_SIZE); // remove if IDLE_FRAMES >1
|
|
}
|
|
if (get_current_wpm() >= KAKI_SPEED) {
|
|
anim_frame_duration = 500;
|
|
current_kaki_frame = (current_kaki_frame + 1) % KAKI_FRAMES;
|
|
oled_write_raw_P(kaki[abs((KAKI_FRAMES - 1) - current_kaki_frame)], ANIM_SIZE);
|
|
}
|
|
}
|
|
}
|
|
if (get_current_wpm() != 000) {
|
|
// if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
|
|
if (timer_elapsed32(anim_timer) > anim_frame_duration) {
|
|
anim_timer = timer_read32();
|
|
animation_phase();
|
|
}
|
|
} else {
|
|
// if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
|
|
if (timer_elapsed32(anim_timer) > anim_frame_duration) {
|
|
anim_timer = timer_read32();
|
|
animation_phase();
|
|
}
|
|
}
|
|
}
|
|
|
|
void oled_driver_render_logo_right(void) {
|
|
render_small_kitty();
|
|
|
|
render_default_layer_state(0, 4);
|
|
}
|
|
# endif
|
|
#endif
|
|
|
|
#ifdef TAPPING_TERM_PER_KEY
|
|
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
|
|
switch (keycode) {
|
|
case ALT_T(KC_A):
|
|
return TAPPING_TERM + 100;
|
|
default:
|
|
return TAPPING_TERM;
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#ifdef RGB_MATRIX_ENABLE
|
|
void check_default_layer(uint8_t mode, uint8_t type, uint8_t led_min, uint8_t led_max) {
|
|
switch (get_highest_layer(default_layer_state)) {
|
|
case _QWERTY:
|
|
rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
|
|
break;
|
|
case _COLEMAK_DH:
|
|
rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
|
|
break;
|
|
case _COLEMAK:
|
|
rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
|
|
break;
|
|
case _DVORAK:
|
|
rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
|
|
break;
|
|
}
|
|
}
|
|
|
|
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
|
|
if (userspace_config.rgb_layer_change) {
|
|
switch (get_highest_layer(layer_state)) {
|
|
case _GAMEPAD:
|
|
rgb_matrix_layer_helper(HSV_ORANGE, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
|
break;
|
|
case _DIABLO:
|
|
rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
|
break;
|
|
case _RAISE:
|
|
rgb_matrix_layer_helper(HSV_YELLOW, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
|
break;
|
|
case _LOWER:
|
|
rgb_matrix_layer_helper(HSV_GREEN, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
|
break;
|
|
case _ADJUST:
|
|
rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
|
break;
|
|
default:
|
|
{
|
|
check_default_layer(0, LED_FLAG_UNDERGLOW, led_min, led_max);
|
|
break;
|
|
}
|
|
}
|
|
check_default_layer(0, LED_FLAG_MODIFIER, led_min, led_max);
|
|
}
|
|
return false;
|
|
}
|
|
#endif
|