diff options
Diffstat (limited to 'keyboards/kyria')
-rw-r--r-- | keyboards/kyria/keymaps/ninjonas/config.h | 2 | ||||
-rw-r--r-- | keyboards/kyria/keymaps/ninjonas/encoder.c | 84 | ||||
-rw-r--r-- | keyboards/kyria/keymaps/ninjonas/keymap.c | 6 | ||||
-rw-r--r-- | keyboards/kyria/keymaps/ninjonas/oled.c | 40 | ||||
-rw-r--r-- | keyboards/kyria/keymaps/ninjonas/rules.mk | 3 |
5 files changed, 44 insertions, 91 deletions
diff --git a/keyboards/kyria/keymaps/ninjonas/config.h b/keyboards/kyria/keymaps/ninjonas/config.h index dd919e382f..5673e6c3d8 100644 --- a/keyboards/kyria/keymaps/ninjonas/config.h +++ b/keyboards/kyria/keymaps/ninjonas/config.h @@ -16,7 +16,7 @@ #pragma once -#define TAPPING_TERM 300 +#define TAPPING_TERM 200 #ifdef OLED_DRIVER_ENABLE #define OLED_DISPLAY_128X64 diff --git a/keyboards/kyria/keymaps/ninjonas/encoder.c b/keyboards/kyria/keymaps/ninjonas/encoder.c deleted file mode 100644 index e3a4f26616..0000000000 --- a/keyboards/kyria/keymaps/ninjonas/encoder.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2020 ninjonas - * - * 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 "ninjonas.h" - -#ifdef ENCODER_ENABLE -void encoder_update_user(uint8_t index, bool clockwise) { - if (index == 0) { - switch (get_highest_layer(layer_state)) { - case _LOWER: - if (clockwise) { - tap_code16(SGUI(KC_TAB)); - } else { - tap_code16(LGUI(KC_TAB)); - } - break; - case _RAISE: - if (clockwise) { - tap_code(KC_PGUP); - } else { - tap_code(KC_PGDN); - } - break; - case _ADJUST: - if (clockwise) { - rgblight_increase_hue(); - } else { - rgblight_decrease_hue(); - } - break; - default: - if (clockwise) { - tap_code(KC_BRIU); - } else { - tap_code(KC_BRID); - } - break; - } - } else if (index == 1) { - switch (get_highest_layer(layer_state)) { - case _LOWER: - if (clockwise) { - tap_code(KC_UP); - } else { - tap_code(KC_DOWN); - } - break; - case _RAISE: - if (clockwise) { - tap_code16(LCTL(KC_TAB)); - } else { - tap_code16(LCTL(LSFT(KC_TAB))); - } - break; - case _ADJUST: - if (clockwise) { - rgblight_increase_val(); - } else { - rgblight_decrease_val(); - } - break; - default: - if (clockwise) { - tap_code(KC_VOLU); - } else { - tap_code(KC_VOLD); - } - break; - } - } -} -#endif
\ No newline at end of file diff --git a/keyboards/kyria/keymaps/ninjonas/keymap.c b/keyboards/kyria/keymaps/ninjonas/keymap.c index df492a4661..ae4b3b7ba9 100644 --- a/keyboards/kyria/keymaps/ninjonas/keymap.c +++ b/keyboards/kyria/keymaps/ninjonas/keymap.c @@ -24,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // |--------+-----——-+——------+-——-----+——------+——-----| |------—+——------+——------+——------+——------+--------| _____________________QWERTY_L2______________________, _____________________QWERTY_R2______________________, // |--------+-----——-+——------+-——-----+——------+——-----+———-----------. ,——————————————+------—+——------+——------+——------+——------+--------| - _____________________QWERTY_L3______________________,XXXXXXX,KC_LALT, T_CPNU,XXXXXXX,_____________________QWERTY_R3______________________, + _____________________QWERTY_L3______________________,XXXXXXX,KC_LALT, T_CPAP,XXXXXXX,_____________________QWERTY_R3______________________, // `--------------------------+--------+--------+-------+-------+------| |------+-------+-------+--------+--------+--------+--------+--------' _____________MOD_LEFT_____________,T_LBRC, T_RBRC,________MOD_RIGHT________,KC_MUTE // `----------------------------------------' `----------------------------------------' @@ -36,7 +36,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // |--------+-----——-+——------+-——-----+——------+——-----| |------—+——------+——------+——------+——------+--------| _____________________DVORAK_L2______________________, _____________________DVORAK_R2______________________, // |--------+-----——-+——------+-——-----+——------+——-----+———-----------. ,——————————————+------—+——------+——------+——------+——------+--------| - _____________________DVORAK_L3______________________,XXXXXXX,KC_LALT, T_CPNU,XXXXXXX,_____________________DVORAK_R3______________________, + _____________________DVORAK_L3______________________,XXXXXXX,KC_LALT, T_CPAP,XXXXXXX,_____________________DVORAK_R3______________________, // `--------------------------+--------+--------+-------+-------+------| |------+-------+-------+--------+--------+--------+--------+--------' _____________MOD_LEFT_____________,T_LBRC, T_RBRC,________MOD_RIGHT________,KC_MUTE // `----------------------------------------' `----------------------------------------' @@ -48,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // |--------+-----——-+——------+-——-----+——------+——-----| |------—+——------+——------+——------+——------+--------| _____________________COLEMAK_L2_____________________, _____________________COLEMAK_R2_____________________, // |--------+-----——-+——------+-——-----+——------+——-----+———-----------. ,——————————————+------—+——------+——------+——------+——------+--------| - _____________________COLEMAK_L3_____________________,XXXXXXX,KC_LALT, T_CPNU,XXXXXXX,_____________________COLEMAK_R3_____________________, + _____________________COLEMAK_L3_____________________,XXXXXXX,KC_LALT, T_CPAP,XXXXXXX,_____________________COLEMAK_R3_____________________, // `--------------------------+--------+--------+-------+-------+------| |------+-------+-------+--------+--------+--------+--------+--------' _____________MOD_LEFT_____________,T_LBRC, T_RBRC,________MOD_RIGHT________,KC_MUTE // `----------------------------------------' `----------------------------------------' diff --git a/keyboards/kyria/keymaps/ninjonas/oled.c b/keyboards/kyria/keymaps/ninjonas/oled.c index 419c1b7277..65976205b7 100644 --- a/keyboards/kyria/keymaps/ninjonas/oled.c +++ b/keyboards/kyria/keymaps/ninjonas/oled.c @@ -105,8 +105,12 @@ void oled_white_space(void){ oled_write_P(PSTR(" "), false); } +void oled_slash_separator(void){ + oled_write_P(PSTR(" / "), false); +} + void render_layout_state(void) { - oled_write_P(PSTR("\nLayout: "), false); + oled_write_P(PSTR("Layout: "), false); switch (biton32(default_layer_state)) { case _COLEMAK: oled_write_P(PSTR("Colemak"), false); @@ -121,6 +125,37 @@ void render_layout_state(void) { oled_write_ln_P(PSTR("Undefined"), false); } } +#ifdef ENCODER_ENABLE +static void render_encoder_state(void) { + oled_write_P(PSTR("\nEnc: "), false); + bool lower = layer_state_is(_LOWER) & !layer_state_is(_ADJUST); + bool raise = layer_state_is(_RAISE) & !layer_state_is(_ADJUST); + bool adjust = layer_state_is(_ADJUST); + + if(lower){ + oled_write_P(PSTR("APPSW"), left_encoder_rotated); + oled_slash_separator(); + oled_write_P(PSTR("UPDN"), right_encoder_rotated); + } else if(raise){ + oled_write_P(PSTR("PGUD"), left_encoder_rotated); + oled_slash_separator(); + oled_write_P(PSTR("TABSW"), right_encoder_rotated); + } else if(adjust){ + oled_write_P(PSTR("RHUE"), left_encoder_rotated); + oled_slash_separator(); + oled_write_P(PSTR("RBRI"), right_encoder_rotated); + } else { + oled_write_P(PSTR("BRI"), left_encoder_rotated); + oled_slash_separator(); + oled_write_P(PSTR("VOL"), right_encoder_rotated); + } + + if (timer_elapsed(encoder_rotated_timer) > 200) { + left_encoder_rotated = false; + right_encoder_rotated = false; + } +} +#endif static void render_layer_state(void) { oled_write_P(PSTR("\nLayer:"), false); @@ -156,6 +191,9 @@ void render_mod_state(uint8_t modifiers) { static void render_status(void) { render_qmk_logo(); render_layout_state(); + #ifdef ENCODER_ENABLE + render_encoder_state(); + #endif render_layer_state(); render_mod_state(get_mods()|get_oneshot_mods()); } diff --git a/keyboards/kyria/keymaps/ninjonas/rules.mk b/keyboards/kyria/keymaps/ninjonas/rules.mk index 3b2894a175..e7e4726bac 100644 --- a/keyboards/kyria/keymaps/ninjonas/rules.mk +++ b/keyboards/kyria/keymaps/ninjonas/rules.mk @@ -3,5 +3,4 @@ ENCODER_ENABLE = yes # Enables the use of one or more encoders RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow LINK_TIME_OPTIMIZATION_ENABLE = yes -SRC += encoder.c \ - oled.c
\ No newline at end of file +SRC += oled.c
\ No newline at end of file |