From f1003aaccfdd4210103e796206e6ac40285dab5b Mon Sep 17 00:00:00 2001
From: Takeshi ISHII <2170248+mtei@users.noreply.github.com>
Date: Sat, 6 Oct 2018 06:51:34 +0900
Subject: [PATCH] Keyboard: Helix five_rows keymap reduced size (#4082)
* add PERMISSIVE_HOLD in helix:five_rows/config.h
* add Eucalyn char layout into helix:five_rows
* Helix five_rows keymap: make rgblight modes selectable.
No change in build result.
* fix keymap.c map comment, add console compile option
No change in build result.
* Helix five_rows keymap: reduced the size.
---
keyboards/helix/config.h | 13 ---
.../helix/rev2/keymaps/five_rows/config.h | 23 ++++-
.../helix/rev2/keymaps/five_rows/keymap.c | 96 +++++++++++++------
.../helix/rev2/keymaps/five_rows/rules.mk | 15 ++-
.../helix/rev2/keymaps/led_test/config.h | 20 ++--
.../helix/rev2/keymaps/led_test/rules.mk | 2 +-
6 files changed, 112 insertions(+), 57 deletions(-)
diff --git a/keyboards/helix/config.h b/keyboards/helix/config.h
index b79093d871..fbfbd32804 100644
--- a/keyboards/helix/config.h
+++ b/keyboards/helix/config.h
@@ -48,17 +48,4 @@ along with this program. If not, see .
#define DISABLE_LEADER
#endif // USE_Link_Time_Optimization
-#if defined(LED_ANIMATIONS) || defined(RGBLIGHT_ANIMATIONS)
- #undef RGBLIGHT_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_H */
diff --git a/keyboards/helix/rev2/keymaps/five_rows/config.h b/keyboards/helix/rev2/keymaps/five_rows/config.h
index 8372194604..538859bc3c 100644
--- a/keyboards/helix/rev2/keymaps/five_rows/config.h
+++ b/keyboards/helix/rev2/keymaps/five_rows/config.h
@@ -21,12 +21,27 @@ along with this program. If not, see .
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
-// if you need more program area, try uncomment follow line
-//#include "serial_config_simpleapi.h"
-
#undef TAPPING_TERM
-#define TAPPING_TERM 140
+#define TAPPING_TERM 300
+#define PERMISSIVE_HOLD
+/* when TAPPING_TERM >= 500 same effect PERMISSIVE_HOLD.
+ see tmk_core/common/action_tapping.c */
// place overrides here
+// 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/rev2/keymaps/five_rows/keymap.c b/keyboards/helix/rev2/keymaps/five_rows/keymap.c
index 548caf8220..983bbe9378 100644
--- a/keyboards/helix/rev2/keymaps/five_rows/keymap.c
+++ b/keyboards/helix/rev2/keymaps/five_rows/keymap.c
@@ -10,6 +10,9 @@
#ifdef SSD1306OLED
#include "ssd1306.h"
#endif
+#ifdef CONSOLE_ENABLE
+ #include
+#endif
extern keymap_config_t keymap_config;
@@ -28,6 +31,7 @@ enum layer_number {
_QWERTY = 0,
_COLEMAK,
_DVORAK,
+ _EUCALYN,
_KEYPAD,
_AUX,
_KAUX,
@@ -41,6 +45,7 @@ enum custom_keycodes {
QWERTY = SAFE_RANGE,
COLEMAK,
DVORAK,
+ EUCALYN,
KEYPAD,
EISU,
KANA,
@@ -72,7 +77,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | ` | ' | N | M | , | . | / | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
- * |Lower | Lower| Caps | GUI | Alt | Space| BS | Enter| Space| Alt | GUI | Menu |Lower |Lower |
+ * |Lower | Lower| Caps | Alt | GUI | Space| BS | Enter| Space| GUI | Alt | Menu |Lower |Lower |
* `-------------------------------------------------------------------------------------------------'
*/
[_QWERTY] = LAYOUT( \
@@ -94,7 +99,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | ` | ' | K | M | , | . | / | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
- * |Lower | Lower| Caps | GUI | Alt | Space| BS | Enter| Space| Alt | GUI | Menu |Lower |Lower |
+ * |Lower | Lower| Caps | Alt | GUI | Space| BS | Enter| Space| GUI | Alt | Menu |Lower |Lower |
* `-------------------------------------------------------------------------------------------------'
*/
[_COLEMAK] = LAYOUT( \
@@ -116,7 +121,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| ; | Q | J | K | X | ` | / | B | M | W | V | Z | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
- * |Lower | Lower| Caps | GUI | Alt | Space| BS | Enter| Space| Alt | GUI | Menu |Lower |Lower |
+ * |Lower | Lower| Caps | Alt | GUI | Space| BS | Enter| Space| GUI | Alt | Menu |Lower |Lower |
* `-------------------------------------------------------------------------------------------------'
*/
[_DVORAK] = LAYOUT( \
@@ -128,6 +133,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LT(_RAISE,KC_ENT), KC_SPC, KC_RGUI, KC_RALT, KC_APP,MO(_LOWER),MO(_LOWER) \
),
+ /* Eucalyn (http://eucalyn.hatenadiary.jp/entry/about-eucalyn-layout)
+ * ,-----------------------------------------. ,-----------------------------------------.
+ * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
+ * |------+------+------+------+------+------| |------+------+------+------+------+------|
+ * | Tab | Q | W | , | . | ; | | M | R | D | Y | P | \ |
+ * |------+------+------+------+------+------| |------+------+------+------+------+------|
+ * | Ctrl | A | O | E | I | U | | G | T | K | S | N | Ctrl |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | Shift| Z | X | C | V | F | ` | ' | B | H | J | L | / | Shift|
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * |Lower | Lower| Caps | Alt | GUI | Space| BS | Enter| Space| GUI | Alt | Menu |Lower |Lower |
+ * `-------------------------------------------------------------------------------------------------'
+ */
+ [_EUCALYN] = LAYOUT( \
+ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
+ KC_TAB, KC_Q, KC_W, KC_COMM, KC_DOT, KC_SCLN, KC_M, KC_R, KC_D, KC_Y, KC_P, KC_BSLS, \
+ KC_LCTL, KC_A, KC_O, KC_E, KC_I, KC_U, KC_G, KC_T, KC_K, KC_S, KC_N, KC_RCTL, \
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_F, KC_GRV, KC_QUOT, KC_B, KC_H, KC_J, KC_L, KC_SLSH, KC_RSFT, \
+ MO(_LOWER),MO(_LOWER), KC_CAPS, KC_LALT, KC_LGUI, KC_SPC, LT(_RAISE,KC_BSPC), \
+ LT(_RAISE,KC_ENT), KC_SPC, KC_RGUI, KC_RALT, KC_APP,MO(_LOWER),MO(_LOWER) \
+ ),
+
/* Keypad
* ,-----------------------------------------. ,-----------------------------------------.
* | Tab | / | * | Del | F1 | F6 | | F1 | F6 | Del | Tab | / | * |
@@ -239,7 +266,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Adjust (Lower + Raise)
* ,-----------------------------------------. ,-----------------------------------------.
- * | | |Keypad|Dvorak|Colemk|Qwerty| |Qwerty|Colemk|Dvorak|Keypad| | |
+ * | |Keypad|Dvorak|Colemk|Euclyn|Qwerty| |Qwerty|Euclyn|Colemk|Dvorak|Keypad| |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | Reset|RGBRST|RGB ON|Aud on| Win | | Win |Aud on|RGB ON|RGBRST| | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
@@ -251,7 +278,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-------------------------------------------------------------------------------------------------'
*/
[_ADJUST] = LAYOUT( \
- XXXXXXX, XXXXXXX, KEYPAD, DVORAK, COLEMAK, QWERTY, QWERTY, COLEMAK, DVORAK, KEYPAD, XXXXXXX, XXXXXXX, \
+ XXXXXXX, KEYPAD, DVORAK, COLEMAK, EUCALYN, QWERTY, QWERTY, EUCALYN, COLEMAK, DVORAK, KEYPAD, XXXXXXX, \
XXXXXXX, RESET, RGBRST, RGB_TOG, AU_ON, AG_SWAP, AG_SWAP, AU_ON, RGB_TOG, RGBRST, XXXXXXX, XXXXXXX, \
RGB_HUI, RGB_SAI, RGB_VAI,RGB_SMOD, AU_OFF, AG_NORM, AG_NORM, AU_OFF,RGB_SMOD, RGB_VAI, RGB_SAI, RGB_HUI, \
RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, RGB_VAD, RGB_SAD, RGB_HUD, \
@@ -304,23 +331,25 @@ uint32_t default_layer_state_set_kb(uint32_t state) {
current_default_layer = state - 1;
// 1<<_DVORAK - 2 == 4 - 2 == _DVORAK (=2)
if ( current_default_layer == 3 ) current_default_layer -= 1;
- // 1<<_KEYPAD - 5 == 8 - 5 == _KEYPAD (=3)
+ // 1<<_EUCALYN - 5 == 8 - 5 == _EUCALYN (=3)
if ( current_default_layer == 7 ) current_default_layer -= 4;
+ // 1<<_KEYPAD - 12 == 16 - 12 == _KEYPAD (=4)
+ if ( current_default_layer == 15 ) current_default_layer -= 11;
return state;
}
void update_base_layer(int base)
{
if( current_default_layer != base ) {
- eeconfig_update_default_layer(1UL<event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(tone_dvorak);
+ #endif
+ update_base_layer(_EUCALYN);
}
return false;
break;
@@ -358,7 +396,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_dvorak);
#endif
- update_base_layer(_KEYPAD);
+ update_base_layer(_KEYPAD);
}
return false;
break;
@@ -468,10 +506,10 @@ static void render_logo(struct CharacterMatrix *matrix) {
char buf[30];
if(rgblight_config.enable) {
snprintf(buf, sizeof(buf), " LED %2d: %d,%d,%d ",
- rgblight_config.mode,
- rgblight_config.hue/RGBLIGHT_HUE_STEP,
- rgblight_config.sat/RGBLIGHT_SAT_STEP,
- rgblight_config.val/RGBLIGHT_VAL_STEP);
+ rgblight_config.mode,
+ rgblight_config.hue/RGBLIGHT_HUE_STEP,
+ rgblight_config.sat/RGBLIGHT_SAT_STEP,
+ rgblight_config.val/RGBLIGHT_VAL_STEP);
matrix_write(matrix, buf);
}
#endif
@@ -481,6 +519,7 @@ static void render_logo(struct CharacterMatrix *matrix) {
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";
@@ -494,6 +533,7 @@ 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,
@@ -526,18 +566,18 @@ void render_status(struct CharacterMatrix *matrix) {
lstate && name_num < sizeof(layer_names)/sizeof(char *);
lstate >>=1, name_num++ ) {
if( (lstate & 1) != 0 ) {
- if( layer_names[name_num] ) {
- matrix_write_P(matrix, layer_names[name_num]);
- }
+ if( layer_names[name_num] ) {
+ matrix_write_P(matrix, layer_names[name_num]);
+ }
}
}
// Host Keyboard LED Status
char led[40];
snprintf(led, sizeof(led), "\n%s %s %s",
- (host_keyboard_leds() & (1<.
// If you need more program area, try select and reduce rgblight modes to use.
// Selection of RGBLIGHT MODE to use.
-#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 // led_test keymap need only this.
-#undef RGBLIGHT_EFFECT_ALTERNATING
+#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 // led_test keymap need only this.
+ //#define RGBLIGHT_EFFECT_ALTERNATING
+#endif
#endif /* CONFIG_USER_H */
diff --git a/keyboards/helix/rev2/keymaps/led_test/rules.mk b/keyboards/helix/rev2/keymaps/led_test/rules.mk
index c7ee75c36b..f599cd4f38 100644
--- a/keyboards/helix/rev2/keymaps/led_test/rules.mk
+++ b/keyboards/helix/rev2/keymaps/led_test/rules.mk
@@ -100,7 +100,7 @@ ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes)
endif
ifeq ($(strip $(LED_ANIMATIONS)), yes)
- OPT_DEFS += -DRGBLIGHT_ANIMATIONS
+ OPT_DEFS += -DLED_ANIMATIONS
endif
ifeq ($(strip $(OLED_ENABLE)), yes)