diff options
author | QMK Bot <hello@qmk.fm> | 2022-05-18 17:33:52 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2022-05-18 17:33:52 +0000 |
commit | 3904a6afbe41e35c231dc449e3e2fa839d7b35a9 (patch) | |
tree | e8df23b2fd6eb582c0f71e077b349d32557487cc | |
parent | 6503987c84994b2c6b5229db8b91c14d8bd11e41 (diff) | |
parent | 33d568e29b454e5ead83b9e7216bd807549cc9b6 (diff) | |
download | qmk_firmware-3904a6afbe41e35c231dc449e3e2fa839d7b35a9.tar.gz qmk_firmware-3904a6afbe41e35c231dc449e3e2fa839d7b35a9.zip |
Merge remote-tracking branch 'origin/master' into develop
23 files changed, 609 insertions, 679 deletions
diff --git a/keyboards/helix/pico/keymaps/mtei/config.h b/keyboards/helix/pico/keymaps/mtei/config.h index c5812de8d7..1a4dc2c842 100644 --- a/keyboards/helix/pico/keymaps/mtei/config.h +++ b/keyboards/helix/pico/keymaps/mtei/config.h @@ -1,25 +1,7 @@ -/* -This is the c configuration file for the keymap +// Copyright (c) 2022 Takeshi Ishii (mtei@github) +// SPDX-License-Identifier: GPL-2.0-or-later -Copyright 2012 Jun Wako <wakojun@gmail.com> -Copyright 2015 Jack Humbert - -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/>. -*/ - -#ifndef CONFIG_USER_H -#define CONFIG_USER_H +#pragma once // place overrides here @@ -36,17 +18,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // If you need more program area, try select and reduce rgblight modes to use. -// Selection of RGBLIGHT MODE to use. -#if defined(LED_ANIMATIONS) - #define RGBLIGHT_EFFECT_BREATHING - #define RGBLIGHT_EFFECT_RAINBOW_MOOD - #define RGBLIGHT_EFFECT_RAINBOW_SWIRL - //#define RGBLIGHT_EFFECT_SNAKE - //#define RGBLIGHT_EFFECT_KNIGHT - #define RGBLIGHT_EFFECT_CHRISTMAS - #define RGBLIGHT_EFFECT_STATIC_GRADIENT - //#define RGBLIGHT_EFFECT_RGB_TEST - //#define RGBLIGHT_EFFECT_ALTERNATING -#endif - -#endif /* CONFIG_USER_H */ diff --git a/keyboards/helix/pico/keymaps/mtei/keymap.c b/keyboards/helix/pico/keymaps/mtei/keymap.c index 58684be497..b703ca376d 100644 --- a/keyboards/helix/pico/keymaps/mtei/keymap.c +++ b/keyboards/helix/pico/keymaps/mtei/keymap.c @@ -14,6 +14,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include QMK_KEYBOARD_H +#include "key_blocks.h" #define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) #define kc5(a,b,c,d,e) KC_##a, KC_##b, KC_##c, KC_##d, KC_##e @@ -59,12 +60,6 @@ enum custom_keycodes { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Qwerty */ -#define Q_____W_____E_____R_____T kc5( Q, W, E, R, T ) -#define Y_____U_____I_____O_____P kc5( Y, U, I, O, P ) -#define A_____S_____D_____F_____G kc5( A, S, D, F, G ) -#define H_____J_____K_____L__SCLN kc5( H, J, K, L, SCLN ) -#define Z_____X_____C_____V_____B kc5( Z, X, C, V, B ) -#define N_____M__COMM___DOT__SLSH kc5( N, M, COMM, DOT, SLSH ) #define LOWER___LOWER__CAPS__LALT__LGUI__NUML__RABS MO(_LOWER), MO(_LOWER), KC_CAPS, KC_LALT, KC_LGUI, LT_NUML_SP, LT_RA_BSPC #define RAEN_NUMR__RGUI__RALT___APP_LOWER__LOWER LT_RA_ENT, LT_NUMR_SP, KC_RGUI, KC_RALT, KC_APP, MO(_LOWER), MO(_LOWER) /* ,-----------------------------------------. ,-----------------------------------------. @@ -78,18 +73,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-------------------------------------------------------------------------------------------------' */ [_QWERTY] = LAYOUT_wrapper( - KC_ESC, Q_____W_____E_____R_____T, Y_____U_____I_____O_____P, KC_BSLS, - KC_LCTL, A_____S_____D_____F_____G, H_____J_____K_____L__SCLN, KC_RCTL, - KC_LSFT, Z_____X_____C_____V_____B, N_____M__COMM___DOT__SLSH, KC_RSFT, + KC_ESC, Q_____W_____E_____R_____T, Y_____U_____I_____O_____P, KC_BSLS, + KC_LCTL, A_____S_____D_____F_____G, H_____J_____K_____L____SCLN, KC_RCTL, + KC_LSFT, Z_____X_____C_____V_____B, N_____M____COMM__DOT___SLSH, KC_RSFT, LOWER___LOWER__CAPS__LALT__LGUI__NUML__RABS, RAEN_NUMR__RGUI__RALT___APP_LOWER__LOWER ), /* Colemak */ -#define Q_____W_____F_____P_____G kc5( Q, W, F, P, G ) -#define J_____L_____U_____Y__SCLN kc5( J, L, U, Y, SCLN ) -#define A_____R_____S_____T_____D kc5( A, R, S, T, D ) -#define H_____N_____E_____I_____O kc5( H, N, E, I, O ) -#define K_____M__COMM___DOT__SLSH kc5( K, M, COMM, DOT, SLSH ) /* ,-----------------------------------------. ,-----------------------------------------. * | ESC | Q | W | F | P | G | | J | L | U | Y | ; | \ | * |------+------+------+------+------+------| |------+------+------+------+------+------| @@ -101,19 +91,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-------------------------------------------------------------------------------------------------' */ [_COLEMAK] = LAYOUT_wrapper( - KC_ESC, Q_____W_____F_____P_____G, J_____L_____U_____Y__SCLN, KC_BSLS, - KC_LCTL, A_____R_____S_____T_____D, H_____N_____E_____I_____O, KC_RCTL, - KC_LSFT, Z_____X_____C_____V_____B, K_____M__COMM___DOT__SLSH, KC_RSFT, + KC_ESC, Q_____W_____F_____P_____G, J_____L_____U_____Y____SCLN, KC_BSLS, + KC_LCTL, A_____R_____S_____T_____D, H_____N_____E_____I_____O, KC_RCTL, + KC_LSFT, Z_____X_____C_____V_____B, K_____M____COMM__DOT___SLSH, KC_RSFT, LOWER___LOWER__CAPS__LALT__LGUI__NUML__RABS, RAEN_NUMR__RGUI__RALT___APP_LOWER__LOWER ), /* Dvorak */ -#define QUOT__COMM___DOT_____P_____Y kc5( QUOT, COMM, DOT, P, Y ) -#define F_____G_____C_____R_____L kc5( F, G, C, R, L ) -#define A_____O_____E_____U_____I kc5( A, O, E, U, I ) -#define D_____H_____T_____N_____S kc5( D, H, T, N, S ) -#define SCLN_____Q_____J_____K_____X kc5( SCLN, Q, J, K, X ) -#define B_____M_____W_____V_____Z kc5( B, M, W, V, Z ) /* ,-----------------------------------------. ,-----------------------------------------. * | ESC | ' | , | . | P | Y | | F | G | C | R | L | \ | * |------+------+------+------+------+------| |------+------+------+------+------+------| @@ -125,19 +109,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-------------------------------------------------------------------------------------------------' */ [_DVORAK] = LAYOUT_wrapper( - KC_ESC, QUOT__COMM___DOT_____P_____Y, F_____G_____C_____R_____L, KC_BSLS, - KC_LCTL, A_____O_____E_____U_____I, D_____H_____T_____N_____S, KC_RCTL, - KC_LSFT, SCLN_____Q_____J_____K_____X, B_____M_____W_____V_____Z, KC_RSFT, + KC_ESC, QUOT_COMM___DOT____P_____Y, F_____G_____C_____R_____L, KC_BSLS, + KC_LCTL, A_____O_____E_____U_____I, D_____H_____T_____N_____S, KC_RCTL, + KC_LSFT, SCLN___Q_____J_____K_____X, B_____M_____W_____V_____Z, KC_RSFT, LOWER___LOWER__CAPS__LALT__LGUI__NUML__RABS, RAEN_NUMR__RGUI__RALT___APP_LOWER__LOWER ), /* Eucalyn (http://eucalyn.hatenadiary.jp/entry/about-eucalyn-layout) */ -#define Q_____W__COMM___DOT__SCLN kc5( Q, W, COMM, DOT, SCLN ) -#define M_____R_____D_____Y_____P kc5( M, R, D, Y, P ) -#define A_____O_____E_____I_____U kc5( A, O, E, I, U ) -#define G_____T_____K_____S_____N kc5( G, T, K, S, N ) -#define Z_____X_____C_____V_____F kc5( Z, X, C, V, F ) -#define B_____H_____J_____L__SLSH kc5( B, H, J, L, SLSH ) /* ,-----------------------------------------. ,-----------------------------------------. * | ESC | Q | W | , | . | ; | | M | R | D | Y | P | \ | * |------+------+------+------+------+------| |------+------+------+------+------+------| @@ -149,19 +127,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-------------------------------------------------------------------------------------------------' */ [_EUCALYN] = LAYOUT_wrapper( - KC_ESC, Q_____W__COMM___DOT__SCLN, M_____R_____D_____Y_____P, KC_BSLS, - KC_LCTL, A_____O_____E_____I_____U, G_____T_____K_____S_____N, KC_RCTL, - KC_LSFT, Z_____X_____C_____V_____F, B_____H_____J_____L__SLSH, KC_RSFT, + KC_ESC, Q_____W___COMM___DOT__SCLN, M_____R_____D_____Y_____P, KC_BSLS, + KC_LCTL, A_____O_____E_____I_____U, G_____T_____K_____S_____N, KC_RCTL, + KC_LSFT, Z_____X_____C_____V_____F, B_____H_____J_____L____SLSH, KC_RSFT, LOWER___LOWER__CAPS__LALT__LGUI__NUML__RABS, RAEN_NUMR__RGUI__RALT___APP_LOWER__LOWER ), /* Num */ #define EXLM__AT__HASH___DLR__PERC kc5( EXLM, AT, HASH, DLR, PERC ) #define CIRC_AMPR_ASTR__LPRN__RPRN kc5( CIRC, AMPR, ASTR, LPRN, RPRN ) -#define _1_____2_____3_____4_____5 kc5( 1, 2, 3, 4, 5 ) -#define _6_____7_____8_____9_____0 kc5( 6, 7, 8, 9, 0 ) -#define F1____F2____F3____F4____F5 kc5( F1, F2, F3, F4, F5 ) -#define F6____F7____F8____F9___F10 kc5( F6, F7, F8, F9, F10 ) #define ____z_____z_____z_____z _______, _______, _______, _______ #define ____z_____z_____z _______, _______, _______ #define ____z_____z _______, _______ @@ -178,13 +152,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_NUML] = LAYOUT_wrapper( _______, EXLM__AT__HASH___DLR__PERC, CIRC_AMPR_ASTR__LPRN__RPRN, _______, _______, _1_____2_____3_____4_____5, _6_____7_____8_____9_____0, KC_F12, - _______, F1____F2____F3____F4____F5, F6____F7____F8____F9___F10, KC_F11, + _______, F1____F2____F3____F4____F5, F6____F7____F8____F9____F10, KC_F11, _______, ____z_____z_____z_____z,____z_____z_____z,KC_SPC, ____z_____z_____z_____z, _______ ), [_NUMR] = LAYOUT_wrapper( _______, EXLM__AT__HASH___DLR__PERC, CIRC_AMPR_ASTR__LPRN__RPRN, _______, _______, _1_____2_____3_____4_____5, _6_____7_____8_____9_____0, KC_F12, - _______, F1____F2____F3____F4____F5, F6____F7____F8____F9___F10, KC_F11, + _______, F1____F2____F3____F4____F5, F6____F7____F8____F9____F10, KC_F11, _______, ____z_____z_____z_____z,KC_SPC, ____z_____z_____z,____z_____z_____z_____z, _______ ), /* Lower */ diff --git a/keyboards/helix/rev2/keymaps/five_rows/config.h b/keyboards/helix/rev2/keymaps/five_rows/config.h index e1c124f419..4aae9b5cac 100644 --- a/keyboards/helix/rev2/keymaps/five_rows/config.h +++ b/keyboards/helix/rev2/keymaps/five_rows/config.h @@ -1,26 +1,7 @@ -/* -This is the c configuration file for the keymap +// Copyright (c) 2022 Takeshi Ishii (mtei@github) +// SPDX-License-Identifier: GPL-2.0-or-later -Copyright 2012 Jun Wako <wakojun@gmail.com> -Copyright 2015 Jack Humbert -Copyright 2020 mtei - -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/>. -*/ - -#ifndef CONFIG_USER_H -#define CONFIG_USER_H +#pragma once #undef TAPPING_TERM #define TAPPING_TERM 300 @@ -35,50 +16,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define OLED_UPDATE_INTERVAL 50 #endif -// place overrides here - -// If you need more program area, try select and reduce rgblight modes to use. - -#define DISABLE_SYNC_TIMER - -// Selection of RGBLIGHT MODE to use. -#undef RGBLIGHT_ANIMATIONS -#undef RGBLIGHT_EFFECT_BREATHING -#undef RGBLIGHT_EFFECT_RAINBOW_MOOD -#undef RGBLIGHT_EFFECT_RAINBOW_SWIRL -#undef RGBLIGHT_EFFECT_SNAKE -#undef RGBLIGHT_EFFECT_KNIGHT -#undef RGBLIGHT_EFFECT_CHRISTMAS -#undef RGBLIGHT_EFFECT_STATIC_GRADIENT -#undef RGBLIGHT_EFFECT_RGB_TEST -#undef RGBLIGHT_EFFECT_ALTERNATING - -#if defined(LED_ANIMATIONS) -# if LED_ANIMATIONS_LEVEL > 1 - #define RGBLIGHT_EFFECT_BREATHING - #define RGBLIGHT_EFFECT_RAINBOW_MOOD - #define RGBLIGHT_EFFECT_RAINBOW_SWIRL - //#define RGBLIGHT_EFFECT_SNAKE - //#define RGBLIGHT_EFFECT_KNIGHT - #define RGBLIGHT_EFFECT_CHRISTMAS - #define RGBLIGHT_EFFECT_STATIC_GRADIENT - //#define RGBLIGHT_EFFECT_RGB_TEST - //#define RGBLIGHT_EFFECT_ALTERNATING -# else - #define RGBLIGHT_EFFECT_BREATHING - #define RGBLIGHT_EFFECT_RAINBOW_MOOD - //#define RGBLIGHT_EFFECT_RAINBOW_SWIRL - //#define RGBLIGHT_EFFECT_SNAKE - //#define RGBLIGHT_EFFECT_KNIGHT - //#define RGBLIGHT_EFFECT_CHRISTMAS - #define RGBLIGHT_EFFECT_STATIC_GRADIENT - //#define RGBLIGHT_EFFECT_RGB_TEST - //#define RGBLIGHT_EFFECT_ALTERNATING -# endif -#endif - -#endif /* CONFIG_USER_H */ - -#ifdef DEBUG_CONFIG -# include "debug_config.h" -#endif diff --git a/keyboards/helix/rev2/keymaps/five_rows/keymap.c b/keyboards/helix/rev2/keymaps/five_rows/keymap.c index 2b3f6233c1..d992425de7 100644 --- a/keyboards/helix/rev2/keymaps/five_rows/keymap.c +++ b/keyboards/helix/rev2/keymaps/five_rows/keymap.c @@ -16,7 +16,54 @@ #include QMK_KEYBOARD_H -#include "layer_number.h" +#include "key_blocks.h" +#include "layer_number_util.h" + +#ifdef ENABLE_COLEMAK +# define COLEMAK_Colemak (COLEMAK, " Colemak"), +#else +# define COLEMAK_Colemak +#endif +#ifdef ENABLE_DVORAK +# define DVORAK_Dvorak (DVORAK, " Dvorak"), +#else +# define DVORAK_Dvorak +#endif +#ifdef ENABLE_EUCALYN +# define EUCALYN_Eucalyn (EUCALYN, " Eucalyn"), +#else +# define EUCALYN_Eucalyn +#endif + +#define LAYER_NAME_LIST \ + (QWERTY, " Qwerty"), \ + COLEMAK_Colemak \ + DVORAK_Dvorak \ + EUCALYN_Eucalyn \ + (KEYPAD, " Keypad"), \ + (AUX, ":AUX"), \ + (KAUX, ":00"), \ + (LOWER, ":Func"), \ + (RAISE, ":Extra"), \ + (PADFUNC, ":PadFunc"), \ + (ADJUST, ":Adjust") + +enum layer_number { + // _QWERTY, _COLEMAK, ... + MAP(BUILD_LAYER_ENUM_NUMBER, LAYER_NAME_LIST) +}; + +#ifdef OLED_ENABLE +// static const char QWERTY_name[] PROGMEM = " Qwerty"; ... +MAP(BUILD_LAYER_NAME_STR, LAYER_NAME_LIST) + +const char *layer_names[] = { + // [_QWERTY] = QWERTY_name, ... + MAP(BUILD_LAYER_NAME_TABLE, LAYER_NAME_LIST) +}; +#endif + +const size_t num_of_layer_names = GET_ITEM_COUNT(LAYER_NAME_LIST); extern keymap_config_t keymap_config; @@ -44,8 +91,6 @@ enum custom_keycodes { #define ____ _______ #define KC_ADJ MO(_ADJUST) -#define _1_____2_____3_____4_____5 KC_1, KC_2, KC_3, KC_4, KC_5 -#define _6_____7_____8_____9_____0 KC_6, KC_7, KC_8, KC_9, KC_0 #define LOWER__LOWER__CAPS__LALT__LGUI__SPC__RABS \ KC_LOWER, KC_LOWER, KC_CAPS, KC_LALT, KC_LGUI, KC_SPC, LT(_RAISE,KC_BSPC) #define RAEN___SPC___RGUI__RALT__APP___LOWER__LOWER \ @@ -56,12 +101,6 @@ enum custom_keycodes { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Qwerty */ -#define Q_____W_____E_____R_____T KC_Q, KC_W, KC_E, KC_R, KC_T -#define Y_____U_____I_____O_____P KC_Y, KC_U, KC_I, KC_O, KC_P -#define A_____S_____D_____F_____G KC_A, KC_S, KC_D, KC_F, KC_G -#define H_____J_____K_____L____SCLN KC_H, KC_J, KC_K, KC_L, KC_SCLN -#define Z_____X_____C_____V_____B KC_Z, KC_X, KC_C, KC_V, KC_B -#define N_____M____COMM__DOT___SLSH KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH /* ,-----------------------------------. ,-----------------------------------. * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BS | * |-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| @@ -83,12 +122,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), /* Colemak */ -#define Q_____W_____F_____P_____G KC_Q, KC_W, KC_F, KC_P, KC_G -#define J_____L_____U_____Y____SCLN KC_J, KC_L, KC_U, KC_Y, KC_SCLN -#define A_____R_____S_____T_____D KC_A, KC_R, KC_S, KC_T, KC_D -#define H_____N_____E_____I_____O KC_H, KC_N, KC_E, KC_I, KC_O -#define Z_____X_____C_____V_____B KC_Z, KC_X, KC_C, KC_V, KC_B -#define K_____M____COMM__DOT___SLSH KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH /* ,-----------------------------------. ,-----------------------------------. * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BS | * |-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| @@ -101,6 +134,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Lower|Lower|Caps | Alt | GUI |Space| BS |Enter|Space| GUI | Alt |Menu |Lower|Lower| * `-----------------------------------------------------------------------------------' */ +#ifdef ENABLE_COLEMAK [_COLEMAK] = LAYOUT_wrapper( KC_ESC, _1_____2_____3_____4_____5, _6_____7_____8_____9_____0, KC_BSPC, KC_TAB, Q_____W_____F_____P_____G, J_____L_____U_____Y____SCLN, KC_BSLS, @@ -108,14 +142,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, Z_____X_____C_____V_____B, GRV__QUOT, K_____M____COMM__DOT___SLSH, KC_RSFT, LOWER__LOWER__CAPS__LALT__LGUI__SPC__RABS, RAEN___SPC___RGUI__RALT__APP___LOWER__LOWER ), +#endif /* Dvorak */ -#define QUOT_COMM___DOT____P_____Y KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y -#define F_____G_____C_____R_____L KC_F, KC_G, KC_C, KC_R, KC_L -#define A_____O_____E_____U_____I KC_A, KC_O, KC_E, KC_U, KC_I -#define D_____H_____T_____N_____S KC_D, KC_H, KC_T, KC_N, KC_S -#define SCLN___Q_____J_____K_____X KC_SCLN, KC_Q, KC_J, KC_K, KC_X -#define B_____M_____W_____V_____Z KC_B, KC_M, KC_W, KC_V, KC_Z #define GRV__SLSH KC_GRV, KC_SLSH /* ,-----------------------------------. ,-----------------------------------. * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BS | @@ -129,6 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Lower|Lower|Caps | Alt | GUI |Space| BS |Enter|Space| GUI | Alt |Menu |Lower|Lower| * `-----------------------------------------------------------------------------------' */ +#ifdef ENABLE_DVORAK [_DVORAK] = LAYOUT_wrapper( KC_ESC, _1_____2_____3_____4_____5, _6_____7_____8_____9_____0, KC_BSPC, KC_TAB, QUOT_COMM___DOT____P_____Y, F_____G_____C_____R_____L, KC_BSLS, @@ -136,14 +166,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, SCLN___Q_____J_____K_____X, GRV__SLSH, B_____M_____W_____V_____Z, KC_RSFT, LOWER__LOWER__CAPS__LALT__LGUI__SPC__RABS, RAEN___SPC___RGUI__RALT__APP___LOWER__LOWER ), +#endif /* Eucalyn (http://eucalyn.hatenadiary.jp/entry/about-eucalyn-layout) */ -#define Q_____W___COMM___DOT__SCLN KC_Q, KC_W, KC_COMM, KC_DOT, KC_SCLN -#define M_____R_____D_____Y_____P KC_M, KC_R, KC_D, KC_Y, KC_P -#define A_____O_____E_____I_____U KC_A, KC_O, KC_E, KC_I, KC_U -#define G_____T_____K_____S_____N KC_G, KC_T, KC_K, KC_S, KC_N -#define Z_____X_____C_____V_____F KC_Z, KC_X, KC_C, KC_V, KC_F -#define B_____H_____J_____L____SLSH KC_B, KC_H, KC_J, KC_L, KC_SLSH /* ,-----------------------------------. ,-----------------------------------. * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BS | * |-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| @@ -156,6 +181,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Lower|Lower|Caps | Alt | GUI |Space| BS |Enter|Space| GUI | Alt |Menu |Lower|Lower| * `-----------------------------------------------------------------------------------' */ +#ifdef ENABLE_EUCALYN [_EUCALYN] = LAYOUT_wrapper( KC_ESC, _1_____2_____3_____4_____5, _6_____7_____8_____9_____0, KC_BSPC, KC_TAB, Q_____W___COMM___DOT__SCLN, M_____R_____D_____Y_____P, KC_BSLS, @@ -163,6 +189,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, Z_____X_____C_____V_____F, GRV__QUOT, B_____H_____J_____L____SLSH, KC_RSFT, LOWER__LOWER__CAPS__LALT__LGUI__SPC__RABS, RAEN___SPC___RGUI__RALT__APP___LOWER__LOWER ), +#endif /* Keypad */ #define KP_TAB__PSLS_PAST KC_TAB, KC_PSLS, KC_PAST @@ -246,8 +273,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), /* Lower */ -#define F1____F2____F3____F4____F5 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 -#define F6____F7____F8____F9____F10 KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 #define XXXX__PAUS__SLCK___INS XXXX, KC_PAUS, KC_SLCK, KC_INS #define XXXX___INS__SLCK__PAUS__XXXX XXXX, KC_INS, KC_SLCK, KC_PAUS, XXXX #define ADJ___ADJ KC_ADJ, KC_ADJ @@ -383,21 +408,27 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; break; case COLEMAK: +#ifdef ENABLE_COLEMAK if (record->event.pressed) { update_base_layer(_COLEMAK); } +#endif return false; break; case DVORAK: +#ifdef ENABLE_DVORAK if (record->event.pressed) { update_base_layer(_DVORAK); } +#endif return false; break; case EUCALYN: +#ifdef ENABLE_EUCALYN if (record->event.pressed) { update_base_layer(_EUCALYN); } +#endif return false; break; case KEYPAD: @@ -447,7 +478,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - INIT_HELIX_OLED(); /* define in layer_number.h */ -} diff --git a/keyboards/helix/rev2/keymaps/five_rows/layer_number.h b/keyboards/helix/rev2/keymaps/five_rows/layer_number.h deleted file mode 100644 index 1272feba4f..0000000000 --- a/keyboards/helix/rev2/keymaps/five_rows/layer_number.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -// Each layer gets a name for readability, which is then used in the keymap matrix below. -// The underscores don't mean anything - you can have a layer called STUFF or any other name. -// Layer names don't all need to be of the same length, obviously, and you can also skip them -// entirely and just use numbers. -enum layer_number { - _QWERTY = 0, - _COLEMAK, - _DVORAK, - _EUCALYN, - _KEYPAD, - _AUX, - _KAUX, - _LOWER, - _RAISE, - _PADFUNC, - _ADJUST, -}; - -#if defined(SSD1306OLED) -extern void init_helix_oled(void); -# define INIT_HELIX_OLED() init_helix_oled(); -#else -# define INIT_HELIX_OLED() -#endif diff --git a/keyboards/helix/rev2/keymaps/five_rows/matrix_output_unselect_delay.c b/keyboards/helix/rev2/keymaps/five_rows/matrix_output_unselect_delay.c deleted file mode 100644 index a093afe0a4..0000000000 --- a/keyboards/helix/rev2/keymaps/five_rows/matrix_output_unselect_delay.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2021 mtei - * - * 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 QMK_KEYBOARD_H - -void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { - /* If none of the keys are pressed, - * there is no need to wait for time for the next line. */ - if (key_pressed) { -# ifdef MATRIX_IO_DELAY -# if MATRIX_IO_DELAY > 0 - wait_us(MATRIX_IO_DELAY); -# endif -# else - wait_us(30); -# endif - } -} diff --git a/keyboards/helix/rev2/keymaps/five_rows/rules.mk b/keyboards/helix/rev2/keymaps/five_rows/rules.mk index 6604f6309b..8f31c0bd06 100644 --- a/keyboards/helix/rev2/keymaps/five_rows/rules.mk +++ b/keyboards/helix/rev2/keymaps/five_rows/rules.mk @@ -22,84 +22,4 @@ HELIX_ROWS = 5 # Helix Rows is 4 or 5 # IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) OLED_SELECT = core -CUSTOM_DELAY = yes - -ifneq ($(strip $(HELIX)),) - define KEYMAP_OPTION_PARSE - # parse 'dispoff', 'consloe', 'na', 'ani', 'mini-ani', 'scan-api', - $(if $(SHOW_PARCE),$(info parse -$1-)) #debug - ifeq ($(strip $1),dispoff) - OLED_ENABLE = no - LED_BACK_ENABLE = no - LED_UNDERGLOW_ENABLE = no - endif - ifneq ($(filter nooled no-oled,$(strip $1)),) - OLED_ENABLE = no - endif - ifeq ($(strip $1),oled) - OLED_ENABLE = yes - endif - ifneq ($(filter core-oled core_oled newoled new-oled olednew oled-new,$(strip $1)),) - OLED_ENABLE = yes - OLED_SELECT = core - endif - ifneq ($(filter local-oled local_oled oldoled old-oled oledold oled-old,$(strip $1)),) - OLED_ENABLE = yes - OLED_SELECT = local - endif - ifeq ($(strip $1),console) - CONSOLE_ENABLE = yes - endif - ifeq ($(strip $1),debug) - DEBUG_CONFIG = yes - endif - ifneq ($(filter nodebug no-debug no_debug,$(strip $1)),) - DEBUG_CONFIG = no - endif - ifneq ($(filter na no_ani no-ani,$(strip $1)),) - LED_ANIMATIONS = no - endif - ifneq ($(filter mini-ani mini_ani,$(strip $1)),) - LED_ANIMATIONS = mini - endif - ifneq ($(filter ani animation,$(strip $1)),) - LED_ANIMATIONS = yes - endif - ifeq ($(strip $1),lto) - LTO_ENABLE = yes - endif - ifneq ($(filter nolto no-lto no_lto,$(strip $1)),) - LTO_ENABLE = no - endif - ifeq ($(strip $1),scan-api) - # use DEBUG_MATRIX_SCAN_RATE - # see docs/newbs_testing_debugging.md - DEBUG_MATRIX_SCAN_RATE_ENABLE = api - endif - endef # end of KEYMAP_OPTION_PARSE - - COMMA=, - $(eval $(foreach A_OPTION_NAME,$(subst $(COMMA), ,$(HELIX)), \ - $(call KEYMAP_OPTION_PARSE,$(A_OPTION_NAME)))) -endif - -ifeq ($(strip $(LED_ANIMATIONS)), yes) - OPT_DEFS += -DLED_ANIMATIONS_LEVEL=2 -endif - -ifeq ($(strip $(LED_ANIMATIONS)), mini) - OPT_DEFS += -DLED_ANIMATIONS_LEVEL=1 - LED_ANIMATIONS = yes -endif - -ifeq ($(strip $(DEBUG_CONFIG)), yes) - OPT_DEFS += -DDEBUG_CONFIG -endif - -ifeq ($(strip $(OLED_ENABLE)), yes) - SRC += oled_display.c -endif - -ifeq ($(strip $(CUSTOM_DELAY)),yes) - SRC += matrix_output_unselect_delay.c -endif +SRC += oled_display.c diff --git a/keyboards/helix/rev3_5rows/keymaps/five_rows/config.h b/keyboards/helix/rev3_5rows/keymaps/five_rows/config.h index 02d4425d62..ab679d14b9 100644 --- a/keyboards/helix/rev3_5rows/keymaps/five_rows/config.h +++ b/keyboards/helix/rev3_5rows/keymaps/five_rows/config.h @@ -1,26 +1,7 @@ -/* -This is the c configuration file for the keymap +// Copyright (c) 2022 Takeshi Ishii (mtei@github) +// SPDX-License-Identifier: GPL-2.0-or-later -Copyright 2012 Jun Wako <wakojun@gmail.com> -Copyright 2015 Jack Humbert -Copyright 2020 mtei - -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/>. -*/ - -#ifndef CONFIG_USER_H -#define CONFIG_USER_H +#pragma once #undef TAPPING_TERM #define TAPPING_TERM 300 @@ -37,50 +18,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PSEUDO_SPRINTF_DEFINED -// place overrides here - -// If you need more program area, try select and reduce rgblight modes to use. - -#define DISABLE_SYNC_TIMER - -// Selection of RGBLIGHT MODE to use. -#undef RGBLIGHT_ANIMATIONS -#undef RGBLIGHT_EFFECT_BREATHING -#undef RGBLIGHT_EFFECT_RAINBOW_MOOD -#undef RGBLIGHT_EFFECT_RAINBOW_SWIRL -#undef RGBLIGHT_EFFECT_SNAKE -#undef RGBLIGHT_EFFECT_KNIGHT -#undef RGBLIGHT_EFFECT_CHRISTMAS -#undef RGBLIGHT_EFFECT_STATIC_GRADIENT -#undef RGBLIGHT_EFFECT_RGB_TEST -#undef RGBLIGHT_EFFECT_ALTERNATING - -#if defined(LED_ANIMATIONS) -# if LED_ANIMATIONS_LEVEL > 1 - #define RGBLIGHT_EFFECT_BREATHING - #define RGBLIGHT_EFFECT_RAINBOW_MOOD - #define RGBLIGHT_EFFECT_RAINBOW_SWIRL - //#define RGBLIGHT_EFFECT_SNAKE - //#define RGBLIGHT_EFFECT_KNIGHT - #define RGBLIGHT_EFFECT_CHRISTMAS - #define RGBLIGHT_EFFECT_STATIC_GRADIENT - //#define RGBLIGHT_EFFECT_RGB_TEST - //#define RGBLIGHT_EFFECT_ALTERNATING -# else - #define RGBLIGHT_EFFECT_BREATHING - #define RGBLIGHT_EFFECT_RAINBOW_MOOD - //#define RGBLIGHT_EFFECT_RAINBOW_SWIRL - //#define RGBLIGHT_EFFECT_SNAKE - //#define RGBLIGHT_EFFECT_KNIGHT - //#define RGBLIGHT_EFFECT_CHRISTMAS - #define RGBLIGHT_EFFECT_STATIC_GRADIENT - //#define RGBLIGHT_EFFECT_RGB_TEST - //#define RGBLIGHT_EFFECT_ALTERNATING -# endif -#endif - -#endif /* CONFIG_USER_H */ - -#ifdef DEBUG_CONFIG -# include "debug_config.h" -#endif diff --git a/keyboards/helix/rev3_5rows/keymaps/five_rows/keymap.c b/keyboards/helix/rev3_5rows/keymaps/five_rows/keymap.c index 16eff49244..d992425de7 100644 --- a/keyboards/helix/rev3_5rows/keymaps/five_rows/keymap.c +++ b/keyboards/helix/rev3_5rows/keymaps/five_rows/keymap.c @@ -15,16 +15,55 @@ */ #include QMK_KEYBOARD_H -#include "util.h" -#include "bootloader.h" -#ifdef PROTOCOL_LUFA -#include "lufa.h" -#include "split_util.h" + +#include "key_blocks.h" +#include "layer_number_util.h" + +#ifdef ENABLE_COLEMAK +# define COLEMAK_Colemak (COLEMAK, " Colemak"), +#else +# define COLEMAK_Colemak #endif -#ifdef CONSOLE_ENABLE - #include <print.h> +#ifdef ENABLE_DVORAK +# define DVORAK_Dvorak (DVORAK, " Dvorak"), +#else +# define DVORAK_Dvorak +#endif +#ifdef ENABLE_EUCALYN +# define EUCALYN_Eucalyn (EUCALYN, " Eucalyn"), +#else +# define EUCALYN_Eucalyn +#endif + +#define LAYER_NAME_LIST \ + (QWERTY, " Qwerty"), \ + COLEMAK_Colemak \ + DVORAK_Dvorak \ + EUCALYN_Eucalyn \ + (KEYPAD, " Keypad"), \ + (AUX, ":AUX"), \ + (KAUX, ":00"), \ + (LOWER, ":Func"), \ + (RAISE, ":Extra"), \ + (PADFUNC, ":PadFunc"), \ + (ADJUST, ":Adjust") + +enum layer_number { + // _QWERTY, _COLEMAK, ... + MAP(BUILD_LAYER_ENUM_NUMBER, LAYER_NAME_LIST) +}; + +#ifdef OLED_ENABLE +// static const char QWERTY_name[] PROGMEM = " Qwerty"; ... +MAP(BUILD_LAYER_NAME_STR, LAYER_NAME_LIST) + +const char *layer_names[] = { + // [_QWERTY] = QWERTY_name, ... + MAP(BUILD_LAYER_NAME_TABLE, LAYER_NAME_LIST) +}; #endif -#include "layer_number.h" + +const size_t num_of_layer_names = GET_ITEM_COUNT(LAYER_NAME_LIST); extern keymap_config_t keymap_config; @@ -52,8 +91,6 @@ enum custom_keycodes { #define ____ _______ #define KC_ADJ MO(_ADJUST) -#define _1_____2_____3_____4_____5 KC_1, KC_2, KC_3, KC_4, KC_5 -#define _6_____7_____8_____9_____0 KC_6, KC_7, KC_8, KC_9, KC_0 #define LOWER__LOWER__CAPS__LALT__LGUI__SPC__RABS \ KC_LOWER, KC_LOWER, KC_CAPS, KC_LALT, KC_LGUI, KC_SPC, LT(_RAISE,KC_BSPC) #define RAEN___SPC___RGUI__RALT__APP___LOWER__LOWER \ @@ -64,12 +101,6 @@ enum custom_keycodes { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Qwerty */ -#define Q_____W_____E_____R_____T KC_Q, KC_W, KC_E, KC_R, KC_T -#define Y_____U_____I_____O_____P KC_Y, KC_U, KC_I, KC_O, KC_P -#define A_____S_____D_____F_____G KC_A, KC_S, KC_D, KC_F, KC_G -#define H_____J_____K_____L____SCLN KC_H, KC_J, KC_K, KC_L, KC_SCLN -#define Z_____X_____C_____V_____B KC_Z, KC_X, KC_C, KC_V, KC_B -#define N_____M____COMM__DOT___SLSH KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH /* ,-----------------------------------. ,-----------------------------------. * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BS | * |-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| @@ -91,12 +122,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), /* Colemak */ -#define Q_____W_____F_____P_____G KC_Q, KC_W, KC_F, KC_P, KC_G -#define J_____L_____U_____Y____SCLN KC_J, KC_L, KC_U, KC_Y, KC_SCLN -#define A_____R_____S_____T_____D KC_A, KC_R, KC_S, KC_T, KC_D -#define H_____N_____E_____I_____O KC_H, KC_N, KC_E, KC_I, KC_O -#define Z_____X_____C_____V_____B KC_Z, KC_X, KC_C, KC_V, KC_B -#define K_____M____COMM__DOT___SLSH KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH /* ,-----------------------------------. ,-----------------------------------. * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BS | * |-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| @@ -109,6 +134,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Lower|Lower|Caps | Alt | GUI |Space| BS |Enter|Space| GUI | Alt |Menu |Lower|Lower| * `-----------------------------------------------------------------------------------' */ +#ifdef ENABLE_COLEMAK [_COLEMAK] = LAYOUT_wrapper( KC_ESC, _1_____2_____3_____4_____5, _6_____7_____8_____9_____0, KC_BSPC, KC_TAB, Q_____W_____F_____P_____G, J_____L_____U_____Y____SCLN, KC_BSLS, @@ -116,14 +142,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, Z_____X_____C_____V_____B, GRV__QUOT, K_____M____COMM__DOT___SLSH, KC_RSFT, LOWER__LOWER__CAPS__LALT__LGUI__SPC__RABS, RAEN___SPC___RGUI__RALT__APP___LOWER__LOWER ), +#endif /* Dvorak */ -#define QUOT_COMM___DOT____P_____Y KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y -#define F_____G_____C_____R_____L KC_F, KC_G, KC_C, KC_R, KC_L -#define A_____O_____E_____U_____I KC_A, KC_O, KC_E, KC_U, KC_I -#define D_____H_____T_____N_____S KC_D, KC_H, KC_T, KC_N, KC_S -#define SCLN___Q_____J_____K_____X KC_SCLN, KC_Q, KC_J, KC_K, KC_X -#define B_____M_____W_____V_____Z KC_B, KC_M, KC_W, KC_V, KC_Z #define GRV__SLSH KC_GRV, KC_SLSH /* ,-----------------------------------. ,-----------------------------------. * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BS | @@ -137,6 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Lower|Lower|Caps | Alt | GUI |Space| BS |Enter|Space| GUI | Alt |Menu |Lower|Lower| * `-----------------------------------------------------------------------------------' */ +#ifdef ENABLE_DVORAK [_DVORAK] = LAYOUT_wrapper( KC_ESC, _1_____2_____3_____4_____5, _6_____7_____8_____9_____0, KC_BSPC, KC_TAB, QUOT_COMM___DOT____P_____Y, F_____G_____C_____R_____L, KC_BSLS, @@ -144,14 +166,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, SCLN___Q_____J_____K_____X, GRV__SLSH, B_____M_____W_____V_____Z, KC_RSFT, LOWER__LOWER__CAPS__LALT__LGUI__SPC__RABS, RAEN___SPC___RGUI__RALT__APP___LOWER__LOWER ), +#endif /* Eucalyn (http://eucalyn.hatenadiary.jp/entry/about-eucalyn-layout) */ -#define Q_____W___COMM___DOT__SCLN KC_Q, KC_W, KC_COMM, KC_DOT, KC_SCLN -#define M_____R_____D_____Y_____P KC_M, KC_R, KC_D, KC_Y, KC_P -#define A_____O_____E_____I_____U KC_A, KC_O, KC_E, KC_I, KC_U -#define G_____T_____K_____S_____N KC_G, KC_T, KC_K, KC_S, KC_N -#define Z_____X_____C_____V_____F KC_Z, KC_X, KC_C, KC_V, KC_F -#define B_____H_____J_____L____SLSH KC_B, KC_H, KC_J, KC_L, KC_SLSH /* ,-----------------------------------. ,-----------------------------------. * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BS | * |-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| @@ -164,6 +181,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Lower|Lower|Caps | Alt | GUI |Space| BS |Enter|Space| GUI | Alt |Menu |Lower|Lower| * `-----------------------------------------------------------------------------------' */ +#ifdef ENABLE_EUCALYN [_EUCALYN] = LAYOUT_wrapper( KC_ESC, _1_____2_____3_____4_____5, _6_____7_____8_____9_____0, KC_BSPC, KC_TAB, Q_____W___COMM___DOT__SCLN, M_____R_____D_____Y_____P, KC_BSLS, @@ -171,6 +189,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, Z_____X_____C_____V_____F, GRV__QUOT, B_____H_____J_____L____SLSH, KC_RSFT, LOWER__LOWER__CAPS__LALT__LGUI__SPC__RABS, RAEN___SPC___RGUI__RALT__APP___LOWER__LOWER ), +#endif /* Keypad */ #define KP_TAB__PSLS_PAST KC_TAB, KC_PSLS, KC_PAST @@ -254,8 +273,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), /* Lower */ -#define F1____F2____F3____F4____F5 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 -#define F6____F7____F8____F9____F10 KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 #define XXXX__PAUS__SLCK___INS XXXX, KC_PAUS, KC_SLCK, KC_INS #define XXXX___INS__SLCK__PAUS__XXXX XXXX, KC_INS, KC_SLCK, KC_PAUS, XXXX #define ADJ___ADJ KC_ADJ, KC_ADJ @@ -391,21 +408,27 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; break; case COLEMAK: +#ifdef ENABLE_COLEMAK if (record->event.pressed) { update_base_layer(_COLEMAK); } +#endif return false; break; case DVORAK: +#ifdef ENABLE_DVORAK if (record->event.pressed) { update_base_layer(_DVORAK); } +#endif return false; break; case EUCALYN: +#ifdef ENABLE_EUCALYN if (record->event.pressed) { update_base_layer(_EUCALYN); } +#endif return false; break; case KEYPAD: @@ -455,7 +478,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - -void matrix_init_user(void) { - INIT_HELIX_OLED(); /* define in layer_number.h */ -} diff --git a/keyboards/helix/rev3_5rows/keymaps/five_rows/layer_number.h b/keyboards/helix/rev3_5rows/keymaps/five_rows/layer_number.h deleted file mode 100644 index 1272feba4f..0000000000 --- a/keyboards/helix/rev3_5rows/keymaps/five_rows/layer_number.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -// Each layer gets a name for readability, which is then used in the keymap matrix below. -// The underscores don't mean anything - you can have a layer called STUFF or any other name. -// Layer names don't all need to be of the same length, obviously, and you can also skip them -// entirely and just use numbers. -enum layer_number { - _QWERTY = 0, - _COLEMAK, - _DVORAK, - _EUCALYN, - _KEYPAD, - _AUX, - _KAUX, - _LOWER, - _RAISE, - _PADFUNC, - _ADJUST, -}; - -#if defined(SSD1306OLED) -extern void init_helix_oled(void); -# define INIT_HELIX_OLED() init_helix_oled(); -#else -# define INIT_HELIX_OLED() -#endif diff --git a/keyboards/helix/rev3_5rows/keymaps/five_rows/matrix_output_unselect_delay.c b/keyboards/helix/rev3_5rows/keymaps/five_rows/matrix_output_unselect_delay.c deleted file mode 100644 index a093afe0a4..0000000000 --- a/keyboards/helix/rev3_5rows/keymaps/five_rows/matrix_output_unselect_delay.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2021 mtei - * - * 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 QMK_KEYBOARD_H - -void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { - /* If none of the keys are pressed, - * there is no need to wait for time for the next line. */ - if (key_pressed) { -# ifdef MATRIX_IO_DELAY -# if MATRIX_IO_DELAY > 0 - wait_us(MATRIX_IO_DELAY); -# endif -# else - wait_us(30); -# endif - } -} diff --git a/keyboards/helix/rev3_5rows/keymaps/five_rows/rules.mk b/keyboards/helix/rev3_5rows/keymaps/five_rows/rules.mk index 1d7f2f2744..a6ce7de118 100644 --- a/keyboards/helix/rev3_5rows/keymaps/five_rows/rules.mk +++ b/keyboards/helix/rev3_5rows/keymaps/five_rows/rules.mk @@ -9,84 +9,3 @@ USER_NAME := mtei ENCODER_ENABLE = no LTO_ENABLE = no # if firmware size over limit, try this option LED_ANIMATIONS = yes - -CUSTOM_DELAY = yes - -ifneq ($(strip $(HELIX)),) - define KEYMAP_OPTION_PARSE - # parse 'dispoff', 'consle', 'back', 'oled', 'no-ani', 'mini-ani', 'lto', 'no-lto', 'no-enc', 'scan', 'scan-api' - $(if $(SHOW_PARCE),$(info parse .$1.)) #debug - ifeq ($(strip $1),dispoff) - OLED_ENABLE = no - RGBLIGHT_ENABLE = no - endif - ifeq ($(strip $1),console) - CONSOLE_ENABLE = yes - endif - ifeq ($(strip $1),debug) - DEBUG_CONFIG = yes - endif - ifneq ($(filter nodebug no-debug no_debug,$(strip $1)),) - DEBUG_CONFIG = no - endif - ifneq ($(filter enc,$(strip $1)),) - ENCODER_ENABLE = yes - endif - ifneq ($(filter noenc no-enc no_enc,$(strip $1)),) - ENCODER_ENABLE = no - endif - ifeq ($(strip $1),oled) - OLED_ENABLE = yes - endif - ifeq ($(strip $1),back) - RGBLIGHT_ENABLE = yes - endif - ifneq ($(filter na no_ani no-ani,$(strip $1)),) - LED_ANIMATIONS = no - endif - ifneq ($(filter mini-ani mini_ani,$(strip $1)),) - LED_ANIMATIONS = mini - endif - ifneq ($(filter ani animation,$(strip $1)),) - LED_ANIMATIONS = yes - endif - ifeq ($(strip $1),lto) - LTO_ENABLE = yes - endif - ifneq ($(filter nolto no-lto no_lto,$(strip $1)),) - LTO_ENABLE = no - endif - ifeq ($(strip $1),scan) - # use DEBUG_MATRIX_SCAN_RATE - # see docs/newbs_testing_debugging.md - DEBUG_MATRIX_SCAN_RATE_ENABLE = yes - endif - ifeq ($(strip $1),scan-api) - # use DEBUG_MATRIX_SCAN_RATE - # see docs/newbs_testing_debugging.md - DEBUG_MATRIX_SCAN_RATE_ENABLE = api - endif - endef # end of KEYMAP_OPTION_PARSE - - COMMA=, - $(eval $(foreach A_OPTION_NAME,$(subst $(COMMA), ,$(HELIX)), \ - $(call KEYMAP_OPTION_PARSE,$(A_OPTION_NAME)))) -endif - -ifeq ($(strip $(LED_ANIMATIONS)), yes) - OPT_DEFS += -DLED_ANIMATIONS - OPT_DEFS += -DLED_ANIMATIONS_LEVEL=2 -endif - -ifeq ($(strip $(LED_ANIMATIONS)), mini) - OPT_DEFS += -DLED_ANIMATIONS - OPT_DEFS += -DLED_ANIMATIONS_LEVEL=1 -endif - -ifeq ($(strip $(CUSTOM_DELAY)),yes) - SRC += matrix_output_unselect_delay.c -endif - -ifeq ($(strip $(DEBUG_CONFIG)), yes) - OPT_DEFS += -DDEBUG_CONFIG -endif diff --git a/users/mtei/config.h b/users/mtei/config.h new file mode 100644 index 0000000000..b245d7cff2 --- /dev/null +++ b/users/mtei/config.h @@ -0,0 +1,46 @@ +// Copyright (c) 2022 Takeshi Ishii (mtei@github) +// SPDX-License-Identifier: GPL-2.0-or-later + +// clang-format off + +#pragma once + +// Selection of RGBLIGHT MODE to use. +#undef RGBLIGHT_ANIMATIONS +#undef RGBLIGHT_EFFECT_BREATHING +#undef RGBLIGHT_EFFECT_RAINBOW_MOOD +#undef RGBLIGHT_EFFECT_RAINBOW_SWIRL +#undef RGBLIGHT_EFFECT_SNAKE +#undef RGBLIGHT_EFFECT_KNIGHT +#undef RGBLIGHT_EFFECT_CHRISTMAS +#undef RGBLIGHT_EFFECT_STATIC_GRADIENT +#undef RGBLIGHT_EFFECT_RGB_TEST +#undef RGBLIGHT_EFFECT_ALTERNATING + +#if defined(LED_ANIMATIONS) +# if LED_ANIMATIONS_LEVEL > 1 +# define RGBLIGHT_EFFECT_BREATHING +# define RGBLIGHT_EFFECT_RAINBOW_MOOD +# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# define RGBLIGHT_EFFECT_SNAKE +//# define RGBLIGHT_EFFECT_KNIGHT +# define RGBLIGHT_EFFECT_CHRISTMAS +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +//# define RGBLIGHT_EFFECT_RGB_TEST +//# define RGBLIGHT_EFFECT_ALTERNATING +# else +# define RGBLIGHT_EFFECT_BREATHING +# define RGBLIGHT_EFFECT_RAINBOW_MOOD +//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# define RGBLIGHT_EFFECT_SNAKE +//# define RGBLIGHT_EFFECT_KNIGHT +//# define RGBLIGHT_EFFECT_CHRISTMAS +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +//# define RGBLIGHT_EFFECT_RGB_TEST +//# define RGBLIGHT_EFFECT_ALTERNATING +# endif +#endif + +#ifdef DEBUG_CONFIG +# include "debug_config.h" +#endif diff --git a/users/mtei/cpp_map.h b/users/mtei/cpp_map.h new file mode 100644 index 0000000000..3b95d0a82a --- /dev/null +++ b/users/mtei/cpp_map.h @@ -0,0 +1,84 @@ +// Copyright (c) 2021 Takeshi Ishii (mtei@github) +// SPDX-License-Identifier: MIT + +// See here for how to use this. (https://github.com/mtei/bare_metal_parts/tree/master/cpp/map) + +#pragma once +// clang-format off + +#define _MAP1(E,ET, _1) ET(_1) +#define _MAP2(E,ET, _1,_2) E(_1) ET(_2) +#define _MAP3(E,ET, _1,_2,_3) E(_1) E(_2) ET(_3) +#define _MAP4(E,ET, _1,_2,_3,_4) E(_1) E(_2) E(_3) ET(_4) +#define _MAP5(E,ET, _1,_2,_3,_4,_5) E(_1) E(_2) E(_3) E(_4) ET(_5) +#define _MAP6(E,ET, _1,_2,_3,_4,_5,_6) E(_1) E(_2) E(_3) E(_4) E(_5) ET(_6) +#define _MAP7(E,ET, _1,_2,_3,_4,_5,_6,_7) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) ET(_7) +#define _MAP8(E,ET, _1,_2,_3,_4,_5,_6,_7,_8) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) ET(_8) +#define _MAP9(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) ET(_9) +#define _MAP10(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) ET(_10) +#define _MAP11(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) ET(_11) +#define _MAP12(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) ET(_12) +#define _MAP13(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) ET(_13) +#define _MAP14(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) ET(_14) +#define _MAP15(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) ET(_15) +#define _MAP16(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) ET(_16) +#define _MAP17(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) ET(_17) +#define _MAP18(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) ET(_18) +#define _MAP19(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) ET(_19) +#define _MAP20(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) ET(_20) +#define _MAP21(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) ET(_21) +#define _MAP22(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) ET(_22) +#define _MAP23(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) ET(_23) +#define _MAP24(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) ET(_24) +#define _MAP25(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) ET(_25) +#define _MAP26(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) ET(_26) +#define _MAP27(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26) ET(_27) +#define _MAP28(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26) E(_27) ET(_28) +#define _MAP29(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26) E(_27) E(_28) ET(_29) +#define _MAP30(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26) E(_27) E(_28) E(_29) ET(_30) +#define _MAP31(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26) E(_27) E(_28) E(_29) E(_30) ET(_31) +#define _MAP32(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26) E(_27) E(_28) E(_29) E(_30) E(_31) ET(_32) + +#define SELECT_MAP(e,et,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,NAME,...) NAME +#define MAPT(E,ET,...) SELECT_MAP(E,ET,__VA_ARGS__,_MAP32,_MAP31,_MAP30,_MAP29,_MAP28,_MAP27,_MAP26,_MAP25,_MAP24,_MAP23,_MAP22,_MAP21,_MAP20,_MAP19,_MAP18,_MAP17,_MAP16,_MAP15,_MAP14,_MAP13,_MAP12,_MAP11,_MAP10,_MAP9,_MAP8,_MAP7,_MAP6,_MAP5,_MAP4,_MAP3,_MAP2,_MAP1)(E,ET,__VA_ARGS__) +#define MAP(E,...) MAPT(E,E,__VA_ARGS__) + +#define _MAP_INDEX1(E,ET, _1) ET(0,_1) +#define _MAP_INDEX2(E,ET, _1,_2) E(0,_1) ET(1,_2) +#define _MAP_INDEX3(E,ET, _1,_2,_3) E(0,_1) E(1,_2) ET(2,_3) +#define _MAP_INDEX4(E,ET, _1,_2,_3,_4) E(0,_1) E(1,_2) E(2,_3) ET(3,_4) +#define _MAP_INDEX5(E,ET, _1,_2,_3,_4,_5) E(0,_1) E(1,_2) E(2,_3) E(3,_4) ET(4,_5) +#define _MAP_INDEX6(E,ET, _1,_2,_3,_4,_5,_6) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) ET(5,_6) +#define _MAP_INDEX7(E,ET, _1,_2,_3,_4,_5,_6,_7) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) ET(6,_7) +#define _MAP_INDEX8(E,ET, _1,_2,_3,_4,_5,_6,_7,_8) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) ET(7,_8) +#define _MAP_INDEX9(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) ET(8,_9) +#define _MAP_INDEX10(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) ET(9,_10) +#define _MAP_INDEX11(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) ET(10,_11) +#define _MAP_INDEX12(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) ET(11,_12) +#define _MAP_INDEX13(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) ET(12,_13) +#define _MAP_INDEX14(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) ET(13,_14) +#define _MAP_INDEX15(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) ET(14,_15) +#define _MAP_INDEX16(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) ET(15,_16) +#define _MAP_INDEX17(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) ET(16,_17) +#define _MAP_INDEX18(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) ET(17,_18) +#define _MAP_INDEX19(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) ET(18,_19) +#define _MAP_INDEX20(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) ET(19,_20) +#define _MAP_INDEX21(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) E(19,_20) ET(20,_21) +#define _MAP_INDEX22(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) E(19,_20) E(20,_21) ET(21,_22) +#define _MAP_INDEX23(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) E(19,_20) E(20,_21) E(21,_22) ET(22,_23) +#define _MAP_INDEX24(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) E(19,_20) E(20,_21) E(21,_22) E(22,_23) ET(23,_24) +#define _MAP_INDEX25(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) E(19,_20) E(20,_21) E(21,_22) E(22,_23) E(23,_24) ET(24,_25) +#define _MAP_INDEX26(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) E(19,_20) E(20,_21) E(21,_22) E(22,_23) E(23,_24) E(24,_25) ET(25,_26) +#define _MAP_INDEX27(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) E(19,_20) E(20,_21) E(21,_22) E(22,_23) E(23,_24) E(24,_25) E(25,_26) ET(26,_27) +#define _MAP_INDEX28(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) E(19,_20) E(20,_21) E(21,_22) E(22,_23) E(23,_24) E(24,_25) E(25,_26) E(26,_27) ET(27,_28) +#define _MAP_INDEX29(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) E(19,_20) E(20,_21) E(21,_22) E(22,_23) E(23,_24) E(24,_25) E(25,_26) E(26,_27) E(27,_28) ET(28,_29) +#define _MAP_INDEX30(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) E(19,_20) E(20,_21) E(21,_22) E(22,_23) E(23,_24) E(24,_25) E(25,_26) E(26,_27) E(27,_28) E(28,_29) ET(29,_30) +#define _MAP_INDEX31(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) E(19,_20) E(20,_21) E(21,_22) E(22,_23) E(23,_24) E(24,_25) E(25,_26) E(26,_27) E(27,_28) E(28,_29) E(29,_30) ET(30,_31) +#define _MAP_INDEX32(E,ET, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32) E(0,_1) E(1,_2) E(2,_3) E(3,_4) E(4,_5) E(5,_6) E(6,_7) E(7,_8) E(8,_9) E(9,_10) E(10,_11) E(11,_12) E(12,_13) E(13,_14) E(14,_15) E(15,_16) E(16,_17) E(17,_18) E(18,_19) E(19,_20) E(20,_21) E(21,_22) E(22,_23) E(23,_24) E(24,_25) E(25,_26) E(26,_27) E(27,_28) E(28,_29) E(29,_30) E(30,_31) ET(31,_32) + +#define SELECT_MAP_INDEX(e,et,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,NAME,...) NAME +#define MAPT_INDEX(E,ET,...) SELECT_MAP_INDEX(E,ET,__VA_ARGS__,_MAP_INDEX32,_MAP_INDEX31,_MAP_INDEX30,_MAP_INDEX29,_MAP_INDEX28,_MAP_INDEX27,_MAP_INDEX26,_MAP_INDEX25,_MAP_INDEX24,_MAP_INDEX23,_MAP_INDEX22,_MAP_INDEX21,_MAP_INDEX20,_MAP_INDEX19,_MAP_INDEX18,_MAP_INDEX17,_MAP_INDEX16,_MAP_INDEX15,_MAP_INDEX14,_MAP_INDEX13,_MAP_INDEX12,_MAP_INDEX11,_MAP_INDEX10,_MAP_INDEX9,_MAP_INDEX8,_MAP_INDEX7,_MAP_INDEX6,_MAP_INDEX5,_MAP_INDEX4,_MAP_INDEX3,_MAP_INDEX2,_MAP_INDEX1)(E,ET,__VA_ARGS__) +#define MAP_INDEX(E,...) MAPT_INDEX(E,E,__VA_ARGS__) + +#define SELECT_ITEM_COUNT(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,NAME,...) NAME +#define GET_ITEM_COUNT(...) SELECT_ITEM_COUNT(__VA_ARGS__,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1) diff --git a/users/mtei/debug_config.h b/users/mtei/debug_config.h new file mode 100644 index 0000000000..edcc1ad41b --- /dev/null +++ b/users/mtei/debug_config.h @@ -0,0 +1,6 @@ +// Copyright (c) 2022 Takeshi Ishii (mtei@github) +// SPDX-License-Identifier: GPL-2.0-or-later + +// clang-format off + +#pragma once diff --git a/users/mtei/encoder_update_user.c b/users/mtei/encoder_update_user.c new file mode 100644 index 0000000000..67585e0345 --- /dev/null +++ b/users/mtei/encoder_update_user.c @@ -0,0 +1,33 @@ +// Copyright (c) 2022 Takeshi Ishii (mtei@github) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +/* weak reference */ __attribute__((weak)) +int get_encoder_over_count(void); + +bool encoder_update_user(uint8_t index, bool clockwise) { +#ifndef ENCODER_DETECT_OVER_SPEED + switch (index) { + /* Left side encoder */ + case 0: tap_code(clockwise ? KC_LEFT : KC_RGHT); break; + /* Right side encoder */ + case 1: tap_code(clockwise ? KC_DOWN : KC_UP); break; + } +#else + // Is there a get_encoder_over_count() in quantum/encoder.c + if (get_encoder_over_count != NULL) { + int enc_over = get_encoder_over_count(); + for (; enc_over > 0; enc_over--) { + tap_code(KC_MINUS); + } + } + switch (index) { + case 0: tap_code(clockwise ? KC_A : KC_B); break; + case 1: tap_code(clockwise ? KC_C : KC_D); break; + case 2: tap_code(clockwise ? KC_E : KC_F); break; + case 3: tap_code(clockwise ? KC_G : KC_H); break; + } +#endif + return true; +} diff --git a/users/mtei/key_blocks.h b/users/mtei/key_blocks.h new file mode 100644 index 0000000000..9a62e5ccff --- /dev/null +++ b/users/mtei/key_blocks.h @@ -0,0 +1,40 @@ +// Copyright (c) 2022 Takeshi Ishii (mtei@github) +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + +#define _1_____2_____3_____4_____5 KC_1, KC_2, KC_3, KC_4, KC_5 +#define _6_____7_____8_____9_____0 KC_6, KC_7, KC_8, KC_9, KC_0 +#define F1____F2____F3____F4____F5 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 +#define F6____F7____F8____F9____F10 KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 + +/* Qwerty */ +#define Q_____W_____E_____R_____T KC_Q, KC_W, KC_E, KC_R, KC_T +#define Y_____U_____I_____O_____P KC_Y, KC_U, KC_I, KC_O, KC_P +#define A_____S_____D_____F_____G KC_A, KC_S, KC_D, KC_F, KC_G +#define H_____J_____K_____L____SCLN KC_H, KC_J, KC_K, KC_L, KC_SCLN +#define Z_____X_____C_____V_____B KC_Z, KC_X, KC_C, KC_V, KC_B +#define N_____M____COMM__DOT___SLSH KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH + +/* Colemak */ +#define Q_____W_____F_____P_____G KC_Q, KC_W, KC_F, KC_P, KC_G +#define J_____L_____U_____Y____SCLN KC_J, KC_L, KC_U, KC_Y, KC_SCLN +#define A_____R_____S_____T_____D KC_A, KC_R, KC_S, KC_T, KC_D +#define H_____N_____E_____I_____O KC_H, KC_N, KC_E, KC_I, KC_O +// Z_____X_____C_____V_____B KC_Z, KC_X, KC_C, KC_V, KC_B +#define K_____M____COMM__DOT___SLSH KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH + +/* Dvorak */ +#define QUOT_COMM___DOT____P_____Y KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y +#define F_____G_____C_____R_____L KC_F, KC_G, KC_C, KC_R, KC_L +#define A_____O_____E_____U_____I KC_A, KC_O, KC_E, KC_U, KC_I +#define D_____H_____T_____N_____S KC_D, KC_H, KC_T, KC_N, KC_S +#define SCLN___Q_____J_____K_____X KC_SCLN, KC_Q, KC_J, KC_K, KC_X +#define B_____M_____W_____V_____Z KC_B, KC_M, KC_W, KC_V, KC_Z + +/* Eucalyn rev3 (http://eucalyn.hatenadiary.jp/entry/about-eucalyn-layout) */ +#define Q_____W___COMM___DOT__SCLN KC_Q, KC_W, KC_COMM, KC_DOT, KC_SCLN +#define M_____R_____D_____Y_____P KC_M, KC_R, KC_D, KC_Y, KC_P +#define A_____O_____E_____I_____U KC_A, KC_O, KC_E, KC_I, KC_U +#define G_____T_____K_____S_____N KC_G, KC_T, KC_K, KC_S, KC_N +#define Z_____X_____C_____V_____F KC_Z, KC_X, KC_C, KC_V, KC_F +#define B_____H_____J_____L____SLSH KC_B, KC_H, KC_J, KC_L, KC_SLSH diff --git a/users/mtei/layer_number_util.h b/users/mtei/layer_number_util.h new file mode 100644 index 0000000000..2147b9db05 --- /dev/null +++ b/users/mtei/layer_number_util.h @@ -0,0 +1,17 @@ +// Copyright (c) 2022 Takeshi Ishii (mtei@github) +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + +#include "cpp_map.h" + +//build -> _<sym>, +#define _BUILD_LAYER_ENUM_NUMBER(sym, str) _ ## sym, +#define BUILD_LAYER_ENUM_NUMBER(ent) _BUILD_LAYER_ENUM_NUMBER ent + +//build -> static const char <sym>_name[] PROGMEM = str; +#define _BUILD_LAYER_NAME_STR(sym, str) static const char sym ## _name[] PROGMEM = str; +#define BUILD_LAYER_NAME_STR(ent) _BUILD_LAYER_NAME_STR ent + +//build -> [_<sym>] = <sym>_name, +#define _BUILD_LAYER_NAME_TABLE(sym, str) [_##sym] = sym ## _name, +#define BUILD_LAYER_NAME_TABLE(ent) _BUILD_LAYER_NAME_TABLE ent diff --git a/users/mtei/matrix_output_unselect_delay_ondemand.c b/users/mtei/matrix_output_unselect_delay_ondemand.c new file mode 100644 index 0000000000..362d8a1303 --- /dev/null +++ b/users/mtei/matrix_output_unselect_delay_ondemand.c @@ -0,0 +1,18 @@ +// Copyright (c) 2021 Takeshi Ishii (mtei@github) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { + /* If none of the keys are pressed, + * there is no need to wait for time for the next line. */ + if (key_pressed) { +# ifdef MATRIX_IO_DELAY +# if MATRIX_IO_DELAY > 0 + wait_us(MATRIX_IO_DELAY); +# endif +# else + wait_us(30); +# endif + } +} diff --git a/users/mtei/oled_display.c b/users/mtei/oled_display.c index 6a16b23b0e..878dd29e6f 100644 --- a/users/mtei/oled_display.c +++ b/users/mtei/oled_display.c @@ -14,32 +14,17 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include QMK_KEYBOARD_H #include <stdio.h> -#ifdef CONSOLE_ENABLE - #include "print.h" -#endif -#ifdef SSD1306OLED - #include "ssd1306.h" -#endif #include <string.h> -#include "layer_number.h" +#include QMK_KEYBOARD_H #include "pseudo_sprintf.h" extern int current_default_layer; -void init_helix_oled(void) { -#ifdef SSD1306OLED - //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h - iota_gfx_init(!has_usb()); // turns on the display -#endif -} - -//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h -#if defined(SSD1306OLED) || defined(OLED_ENABLE) +//OLED update loop +#if defined(OLED_ENABLE) -# if defined(OLED_ENABLE) oled_rotation_t oled_init_user(oled_rotation_t rotation) { if (is_keyboard_master()) { return OLED_ROTATION_0; @@ -47,35 +32,12 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; } } -# else -# define oled_write(data,flag) matrix_write(matrix, data) -# define oled_write_P(data,flag) matrix_write_P(matrix, data) -# endif - -# ifdef SSD1306OLED -void matrix_scan_user(void) { - iota_gfx_task(); // this is what updates the display continuously -} - -void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } -} -# endif #ifndef PSEUDO_SPRINTF_DEFINED #include "pseudo_sprintf.c" #endif -# ifdef SSD1306OLED -static void render_logo(struct CharacterMatrix *matrix) { -# else static void render_logo(void) { -# endif - static const char helix_logo[] PROGMEM = { 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, @@ -98,57 +60,26 @@ static void render_logo(void) { bufp = sprints(bufp, " "); # endif oled_write(buf, false); -# ifndef SSD1306OLED } else { # ifdef DEBUG_MATRIX_SCAN_RATE bufp = sprintd(buf, " scan:", get_matrix_scan_rate()); oled_write(buf, false); -# endif +# endif // DEBUG_MATRIX_SCAN_RATE oled_write_P( PSTR("\n"), false); -# endif } -# else +# else // ifndef RGBLIGHT_ENABLE # ifdef DEBUG_MATRIX_SCAN_RATE bufp = sprintd(buf, " scan:", get_matrix_scan_rate()); bufp = sprints(bufp, " "); oled_write(buf, false); # endif -# endif +# endif // RGBLIGHT_ENABLE } -static const char Qwerty_name[] PROGMEM = " Qwerty"; -static const char Colemak_name[] PROGMEM = " Colemak"; -static const char Dvorak_name[] PROGMEM = " Dvorak"; -static const char Eucalyn_name[] PROGMEM = " Eucalyn"; -static const char Keypad_name[] PROGMEM = " Keypad"; - -static const char AUX_name[] PROGMEM = ":AUX"; -static const char KAUX_name[] PROGMEM = ":00"; -static const char Padfunc_name[] PROGMEM = ":PadFunc"; -static const char Lower_name[] PROGMEM = ":Func"; -static const char Raise_name[] PROGMEM = ":Extra"; -static const char Adjust_name[] PROGMEM = ":Adjust"; - -static const char *layer_names[] = { - [_QWERTY] = Qwerty_name, - [_COLEMAK] = Colemak_name, - [_DVORAK] = Dvorak_name, - [_EUCALYN]= Eucalyn_name, - [_KEYPAD] = Keypad_name, - [_AUX] = AUX_name, - [_KAUX] = KAUX_name, - [_LOWER] = Lower_name, - [_RAISE] = Raise_name, - [_PADFUNC]= Padfunc_name, - [_ADJUST] = Adjust_name -}; +/* weak reference */ __attribute__((weak)) extern const char *layer_names[]; +/* weak reference */ __attribute__((weak)) extern const size_t num_of_layer_names; -# ifdef SSD1306OLED -void render_status(struct CharacterMatrix *matrix) { -# else void render_status(void) { -# endif - // Render to mode icon static const char os_logo[][2][3] PROGMEM ={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; if(keymap_config.swap_lalt_lgui==false){ @@ -162,21 +93,29 @@ void render_status(void) { } // 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 - int name_num; + int name_num, max_name_num; uint32_t lstate; - oled_write_P(layer_names[current_default_layer], false); -# ifdef DEBUG_MATRIX_SCAN_RATE char buf[16]; + max_name_num = 0; + if (layer_names != NULL) { + max_name_num = num_of_layer_names; + oled_write_P(layer_names[current_default_layer], false); + } else { + sprintd(buf, " layer:", current_default_layer); + oled_write(buf, false); + } +# ifdef DEBUG_MATRIX_SCAN_RATE sprintd(buf, " scan:", get_matrix_scan_rate()); oled_write(buf, false); # endif oled_write_P(PSTR("\n"), false); - for (lstate = layer_state, name_num = 0; - lstate && name_num < sizeof(layer_names)/sizeof(char *); - lstate >>=1, name_num++) { + for (lstate = layer_state, name_num = 0; lstate; lstate >>=1, name_num++) { if ((lstate & 1) != 0) { - if (layer_names[name_num]) { + if (name_num < max_name_num && layer_names[name_num]) { oled_write_P(layer_names[name_num], false); + } else { + sprintd(buf, ":", name_num); + oled_write(buf, false); } } } @@ -189,42 +128,13 @@ void render_status(void) { oled_write_P(led_state.scroll_lock ? PSTR("SCLK ") : PSTR(" "), false); } -# ifdef SSD1306OLED -# if OLED_UPDATE_INTERVAL > 0 -uint16_t oled_update_timeout; -# endif - -void iota_gfx_task_user(void) { - struct CharacterMatrix matrix; - -# if DEBUG_TO_SCREEN - if (debug_enable) { - return; - } -# endif - -#if OLED_UPDATE_INTERVAL > 0 - if (timer_elapsed(oled_update_timeout) < OLED_UPDATE_INTERVAL) { - return; - } - oled_update_timeout = timer_read(); -#endif - matrix_clear(&matrix); - if (is_keyboard_master()) { - render_status(&matrix); - } else { - render_logo(&matrix); - } - matrix_update(&display, &matrix); -} -# else bool oled_task_user(void) { -# if DEBUG_TO_SCREEN +# if DEBUG_TO_SCREEN if (debug_enable) { return; } -# endif +# endif if(is_keyboard_master()){ render_status(); @@ -233,6 +143,5 @@ bool oled_task_user(void) { } return false; } -# endif #endif diff --git a/users/mtei/rules.mk b/users/mtei/rules.mk new file mode 100644 index 0000000000..780393ba12 --- /dev/null +++ b/users/mtei/rules.mk @@ -0,0 +1,9 @@ +VPATH += $(USER_PATH)/$(PLATFORM_PATH) +VPATH += $(USER_PATH)/$(PLATFORM_PATH)/$(PLATFORM_KEY) + +CUSTOM_MATRIX_DELAY = on-demand + +ifneq ($(strip $(USROPT)),) + include $(USER_PATH)/user_options.mk +endif +include $(USER_PATH)/user_featues.mk diff --git a/users/mtei/user_featues.mk b/users/mtei/user_featues.mk new file mode 100644 index 0000000000..243e80dde9 --- /dev/null +++ b/users/mtei/user_featues.mk @@ -0,0 +1,60 @@ +# Copyright (c) 2022 Takeshi Ishii (mtei@github) +# SPDX-License-Identifier: GPL-2.0-or-later + +ifeq ($(strip $(LED_ANIMATIONS)), yes) + OPT_DEFS += -DLED_ANIMATIONS + OPT_DEFS += -DLED_ANIMATIONS_LEVEL=2 +endif + +ifeq ($(strip $(LED_ANIMATIONS)), mini) + OPT_DEFS += -DLED_ANIMATIONS + OPT_DEFS += -DLED_ANIMATIONS_LEVEL=1 +endif + +ifeq ($(strip $(DEBUG_CONFIG)), yes) + OPT_DEFS += -DDEBUG_CONFIG +endif + +ifeq ($(strip $(CUSTOM_MATRIX_DELAY)),on-demand) + SRC += matrix_output_unselect_delay_ondemand.c +endif + +ifneq ($(strip $(MDELAY)),) + OPT_DEFS += -DMATRIX_IO_DELAY=$(strip $(MDELAY)) +endif + +ifeq ($(strip $(ENABLE_COLEMAK)),yes) + OPT_DEFS += -DENABLE_COLEMAK +endif + +ifeq ($(strip $(ENABLE_DVORAK)),yes) + OPT_DEFS += -DENABLE_DVORAK +endif + +ifeq ($(strip $(ENABLE_EUCALYN)),yes) + OPT_DEFS += -DENABLE_EUCALYN +endif + +ifeq ($(strip $(ENCODER_ENABLE)),yes) + SRC += encoder_update_user.c +endif + +ifeq ($(strip $(DEBUG_ENCODER)),yes) + OPT_DEFS += -DENCODER_DETECT_OVER_SPEED +endif + +ifneq ($(strip $(SYNC_TIMER_ENABLE)),yes) + OPT_DEFS += -DDISABLE_SYNC_TIMER +endif + +ifneq ($(strip $(USROPT)),) + $(info -) + $(info - CONSOLE_ENABLE = $(CONSOLE_ENABLE)) + $(info - OLED_ENABLE = $(OLED_ENABLE)) + $(info - RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE)) + $(info - ENCODER_ENABLE = $(ENCODER_ENABLE)) + $(info - MDELAY = $(MDELAY)) + $(info - CUSTOM_MATRIX_DELAY = $(CUSTOM_MATRIX_DELAY)) + $(info - DEBUG_MATRIX_SCAN_RATE_ENABLE = $(DEBUG_MATRIX_SCAN_RATE_ENABLE)) + $(info - OPT_DEFS = $(OPT_DEFS)) +endif diff --git a/users/mtei/user_options.mk b/users/mtei/user_options.mk new file mode 100644 index 0000000000..a3cf2196f9 --- /dev/null +++ b/users/mtei/user_options.mk @@ -0,0 +1,127 @@ +# Copyright (c) 2022 Takeshi Ishii (mtei@github) +# SPDX-License-Identifier: GPL-2.0-or-later + +# +# make USROPT=<option>,<option>,... <KEYBOARD>:<KEYMAP> +# options: +# dispoff: OLED, RGBLIGHT disable +# oled: OLED enable +# no-oled: OLED disable +# rgblight: RGBLIGHT enable +# no-rgblight: RGBLIGHT disable +# no_ani: RGBLIGHT ANIMATIONS disable +# mini-ani: RGBLIGHT ANIMATIONS mini set +# ani: RGBLIGHT ANIMATIONS enable +# scan: DEBUG_MATRIX_SCAN_RATE enable +# scan-api: DEBUG_MATRIX_SCAN_RATE api enable +# mdelay=<num> MATRIX_IO_DELAY set <num> +# mdelay_type=<type> use custom matrix_output_unselect_delay() +# type=no,ondemand +# enc: ENCODER enable +# no-enc: ENCODER disable +# +ifneq ($(strip $(USROPT)),) + define USER_OPTION_PARSE + # parse 'debug', 'no-debug', 'dispoff', 'consle', 'scan', 'no-scan', 'scan-api', + # 'mdelay=?', 'mdelay0', 'colemak', 'dvorak', 'eucalyn', 'lto', 'no-lto' + $(if $(SHOW_PARSE),$(info parse .$1.)) #for debug 'make SHOW_PARSE=y ...' + ifeq ($(strip $1),debug) + DEBUG_CONFIG = yes + endif + ifneq ($(filter nodebug no-debug no_debug,$(strip $1)),) + DEBUG_CONFIG = no + endif + ifeq ($(strip $1),dispoff) + OLED_ENABLE = no + RGBLIGHT_ENABLE = no + LED_BACK_ENABLE = no + LED_UNDERGLOW_ENABLE = no + endif + ifneq ($(filter rgblight,$(strip $1)),) + RGBLIGHT_ENABLE = yes + LED_BACK_ENABLE = yes + endif + ifneq ($(filter norgblight no-rgblight,$(strip $1)),) + RGBLIGHT_ENABLE = no + LED_BACK_ENABLE = no + LED_UNDERGLOW_ENABLE = no + endif + ifneq ($(filter na no_ani no-ani,$(strip $1)),) + LED_ANIMATIONS = no + endif + ifneq ($(filter mini-ani mini_ani,$(strip $1)),) + LED_ANIMATIONS = mini + endif + ifneq ($(filter ani animation,$(strip $1)),) + LED_ANIMATIONS = yes + endif + ifneq ($(filter nooled no-oled,$(strip $1)),) + OLED_ENABLE = no + endif + ifeq ($(strip $1),oled) + OLED_ENABLE = yes + endif + ifeq ($(strip $1),console) + CONSOLE_ENABLE = yes + endif + ifeq ($(strip $1),scan) + # use DEBUG_MATRIX_SCAN_RATE + # see docs/newbs_testing_debugging.md + DEBUG_MATRIX_SCAN_RATE_ENABLE = yes + endif + ifeq ($(strip $1),no-scan) + DEBUG_MATRIX_SCAN_RATE_ENABLE = no + endif + ifeq ($(strip $1),scan-api) + # use DEBUG_MATRIX_SCAN_RATE + # see docs/newbs_testing_debugging.md + DEBUG_MATRIX_SCAN_RATE_ENABLE = api + endif + ifneq ($(filter stimer sync-timer,$(strip $1)),) + SYNC_TIMER_ENABLE = yes + endif + ifneq ($(filter nostimer no-sync-timer,$(strip $1)),) + SYNC_TIMER_ENABLE = no + endif + ifeq ($(filter mdelay_type=%,$1),mdelay_type=no) + CUSTOM_MATRIX_DELAY = no + endif + ifeq ($(filter mdelay_type=%,$1),mdelay_type=demand) + CUSTOM_MATRIX_DELAY = on-demand + endif + ifneq ($(filter mdelay=%,$1),) + MDELAY = $(patsubst mdelay=%,%,$1) + endif + ifeq ($(strip $1),mdelay0) + MDELAY = 0 + endif + ifeq ($(strip $1),colemak) + ENABLE_COLEMAK = yes + endif + ifeq ($(strip $1),dvorak) + ENABLE_DVORAK = yes + endif + ifeq ($(strip $1),eucalyn) + ENABLE_EUCALYN = yes + endif + ifeq ($(strip $1),lto) + LTO_ENABLE = yes + endif + ifneq ($(filter nolto no-lto no_lto,$(strip $1)),) + LTO_ENABLE = no + endif + ifneq ($(filter enc,$(strip $1)),) + ENCODER_ENABLE = yes + endif + ifneq ($(filter noenc no-enc no_enc,$(strip $1)),) + ENCODER_ENABLE = no + endif + ifneq ($(filter debugenc debug-enc debug_enc,$(strip $1)),) + DEBUG_ENCODER = yes + endif + endef # end of USER_OPTION_PARSE + + COMMA=, + $(eval $(foreach A_OPTION_NAME,$(subst $(COMMA), ,$(USROPT)), \ + $(call USER_OPTION_PARSE,$(A_OPTION_NAME)))) +endif |