diff options
Diffstat (limited to 'keyboards/helix/rev2')
35 files changed, 1308 insertions, 227 deletions
diff --git a/keyboards/helix/rev2/config.h b/keyboards/helix/rev2/config.h index 058236122f..f7d35b3714 100644 --- a/keyboards/helix/rev2/config.h +++ b/keyboards/helix/rev2/config.h @@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define DESCRIPTION A split keyboard for the cheap makers -#define PREVENT_STUCK_MODIFIERS #define TAPPING_FORCE_HOLD #define TAPPING_TERM 100 @@ -88,10 +87,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* ws2812 RGB LED */ #define RGB_DI_PIN D3 -#define RGBLIGHT_TIMER + //#define RGBLED_NUM 12 // Number of LEDs. see ./keymaps/default/config.h -#define ws2812_PORTREG PORTD -#define ws2812_DDRREG DDRD // Helix keyboard RGB LED support //#define RGBLIGHT_ANIMATIONS : see ./rules.mk: LED_ANIMATIONS = yes or no diff --git a/keyboards/helix/rev2/keymaps/default/config.h b/keyboards/helix/rev2/keymaps/default/config.h index 6da6849a1d..ed37675794 100644 --- a/keyboards/helix/rev2/keymaps/default/config.h +++ b/keyboards/helix/rev2/keymaps/default/config.h @@ -23,4 +23,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // 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/default/keymap.c b/keyboards/helix/rev2/keymaps/default/keymap.c index dca9be9a47..0fb821affb 100644 --- a/keyboards/helix/rev2/keymaps/default/keymap.c +++ b/keyboards/helix/rev2/keymaps/default/keymap.c @@ -183,7 +183,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, RESET, RGBRST, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD \ ) }; @@ -296,7 +296,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD \ ) }; @@ -373,7 +373,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } else { TOG_STATUS = !TOG_STATUS; #ifdef RGBLIGHT_ENABLE - //rgblight_mode(16); + //rgblight_mode(RGBLIGHT_MODE_SNAKE + 1); #endif } layer_on(_LOWER); @@ -396,7 +396,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } else { TOG_STATUS = !TOG_STATUS; #ifdef RGBLIGHT_ENABLE - //rgblight_mode(15); + //rgblight_mode(RGBLIGHT_MODE_SNAKE); #endif } layer_on(_RAISE); @@ -512,7 +512,7 @@ void music_scale_user(void) // hook point for 'led_test' keymap // 'default' keymap's led_test_init() is empty function, do nothing -// 'led_test' keymap's led_test_init() force rgblight_mode_noeeprom(35); +// 'led_test' keymap's led_test_init() force rgblight_mode_noeeprom(RGBLIGHT_MODE_RGB_TEST); __attribute__ ((weak)) void led_test_init(void) {} diff --git a/keyboards/helix/rev2/keymaps/default/rules.mk b/keyboards/helix/rev2/keymaps/default/rules.mk index 5340a74ba2..3f84b895aa 100644 --- a/keyboards/helix/rev2/keymaps/default/rules.mk +++ b/keyboards/helix/rev2/keymaps/default/rules.mk @@ -14,7 +14,7 @@ MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. SWAP_HANDS_ENABLE = no # Enable one-hand typing define HELIX_CUSTOMISE_MSG @@ -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) diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/config.h b/keyboards/helix/rev2/keymaps/edvorakjp/config.h index a7a5f83600..769988cdb5 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/config.h +++ b/keyboards/helix/rev2/keymaps/edvorakjp/config.h @@ -4,5 +4,21 @@ #undef TAPPING_FORCE_HOLD #undef TAPPING_TERM #define TAPPING_TERM 120 +#define SWAP_SCLN + +// 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/edvorakjp/keymap.c b/keyboards/helix/rev2/keymaps/edvorakjp/keymap.c index 650a39115a..fd324a859a 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/keymap.c +++ b/keyboards/helix/rev2/keymaps/edvorakjp/keymap.c @@ -11,7 +11,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { switch(keycode) { case KC_LOCK: if (record->event.pressed) { - if (edvorakjp_config.enable_kc_lang) { + if (get_enable_kc_lang()) { SEND_STRING( SS_LCTRL(SS_LSFT(SS_TAP(X_POWER))) ); } else { SEND_STRING( SS_LGUI("l") ); @@ -35,7 +35,7 @@ void matrix_scan_user(void) { #ifdef RGBLIGHT_ENABLE uint32_t layer_state_set_keymap(uint32_t state) { - rgblight_mode_noeeprom(1); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); switch (biton32(state)) { case _EDVORAKJ1: case _EDVORAKJ2: @@ -52,7 +52,7 @@ uint32_t layer_state_set_keymap(uint32_t state) { rgblight_sethsv_noeeprom_green(); break; default: // for any other layers, or the default layer - rgblight_mode_noeeprom(28); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_GRADIENT + 3); rgblight_sethsv_noeeprom_red(); break; } diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/keymap_4rows.c b/keyboards/helix/rev2/keymaps/edvorakjp/keymap_4rows.c index d8257d81f8..805e6b17b7 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/keymap_4rows.c +++ b/keyboards/helix/rev2/keymaps/edvorakjp/keymap_4rows.c @@ -5,7 +5,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_EDVORAK] = LAYOUT_kc( //,----+----+----+----+----+----. ,----+----+----+----+----+----. - LBRC,RBRC,COMM,DOT , P , Y , F , G , R , W , Q ,BSLS, + LBRC,RBRC,COMM,DOT , Y , P , F , G , R , W , Q ,BSLS, //|----+----+----+----+----+----| |----+----+----+----+----+----| EQL , A , O , E , I , U , D , T , N , S , M ,MINS, //|----+----+----+----+----+----| |----+----+----+----+----+----| diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/keymap_5rows.c b/keyboards/helix/rev2/keymaps/edvorakjp/keymap_5rows.c index 9116b39665..ef1b9d358c 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/keymap_5rows.c +++ b/keyboards/helix/rev2/keymaps/edvorakjp/keymap_5rows.c @@ -7,7 +7,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //,----+----+----+----+----+----. ,----+----+----+----+----+----. GRV ,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,BSPC, //|----+----+----+----+----+----| |----+----+----+----+----+----| - LBRC,RBRC,COMM,DOT , P , Y , F , G , R , W , Q ,BSLS, + LBRC,RBRC,COMM,DOT , Y , P , F , G , R , W , Q ,BSLS, //|----+----+----+----+----+----| |----+----+----+----+----+----| EQL , A , O , E , I , U , D , T , N , S , M ,MINS, //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/oled.c b/keyboards/helix/rev2/keymaps/edvorakjp/oled.c index 5ced1d4fad..227e2c56f8 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/oled.c +++ b/keyboards/helix/rev2/keymaps/edvorakjp/oled.c @@ -23,15 +23,10 @@ void render_status(struct CharacterMatrix *matrix) { // Render to mode icon static char logo[][2][3] = {{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; - if (edvorakjp_config.enable_kc_lang) { - matrix_write(matrix, logo[0][0]); - matrix_write_P(matrix, PSTR("\n")); - matrix_write(matrix, logo[0][1]); - } else { - matrix_write(matrix, logo[1][0]); - matrix_write_P(matrix, PSTR("\n")); - matrix_write(matrix, logo[1][1]); - } + int mode_number = get_enable_kc_lang() ? 0 : 1; + matrix_write(matrix, logo[mode_number][0]); + matrix_write(matrix, "\n"); + matrix_write(matrix, logo[mode_number][1]); // 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 char buf[40]; @@ -63,7 +58,7 @@ void render_status(struct CharacterMatrix *matrix) { // Host Keyboard LED Status char led[40]; snprintf(led, sizeof(led), "\n%s %s %s %s", - edvorakjp_config.enable_jp_extra_layer && japanese_mode ? "EXT" : " ", + get_enable_jp_extra_layer() && get_japanese_mode() ? "EXT" : " ", (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NMLK" : " ", (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); diff --git a/keyboards/helix/rev2/keymaps/edvorakjp/rules.mk b/keyboards/helix/rev2/keymaps/edvorakjp/rules.mk index 67da9c370b..4257d004da 100644 --- a/keyboards/helix/rev2/keymaps/edvorakjp/rules.mk +++ b/keyboards/helix/rev2/keymaps/edvorakjp/rules.mk @@ -13,7 +13,7 @@ MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. SWAP_HANDS_ENABLE = no # Enable one-hand typing define HELIX_CUSTOMISE_MSG @@ -102,7 +102,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) diff --git a/keyboards/helix/rev2/keymaps/five_rows/README.md b/keyboards/helix/rev2/keymaps/five_rows/README.md index 4feaac2efb..10a4fa942c 100644 --- a/keyboards/helix/rev2/keymaps/five_rows/README.md +++ b/keyboards/helix/rev2/keymaps/five_rows/README.md @@ -46,7 +46,7 @@ Mac mode swap Alt/Win(GUI) key. | ---- | ---- | --- | |on/off|Adjust + e(Qwerty)|RGB_TOG| | |Adjust + i(Qwerty)| | -|change mode|Adjust + d(Qwerty) |RGB_SMOD| +|change mode|Adjust + d(Qwerty) |RGB_MOD| | |Adjust + k(Qwerty)| | |HUE +|Adjust + Left Control|RGB_HUI| | |Adjust + Right Control| | diff --git a/keyboards/helix/rev2/keymaps/five_rows/README_jp.md b/keyboards/helix/rev2/keymaps/five_rows/README_jp.md index 932e200a56..317ffdd71d 100644 --- a/keyboards/helix/rev2/keymaps/five_rows/README_jp.md +++ b/keyboards/helix/rev2/keymaps/five_rows/README_jp.md @@ -68,7 +68,7 @@ Winモードでは、該当のキーはどちらも共に Alt + `(日本語IME | ---- | ---- | --- | |オン/オフ|Adjust + e(Qwerty)|RGB_TOG| | |Adjust + i(Qwerty)| | -|モード切り替え|Adjust + d(Qwerty) |RGB_SMOD| +|モード切り替え|Adjust + d(Qwerty) |RGB_MOD| | |Adjust + k(Qwerty)| | |色相 +|Adjust + Left Control|RGB_HUI| | |Adjust + Right Control| | diff --git a/keyboards/helix/rev2/keymaps/five_rows/config.h b/keyboards/helix/rev2/keymaps/five_rows/config.h index 6da6849a1d..538859bc3c 100644 --- a/keyboards/helix/rev2/keymaps/five_rows/config.h +++ b/keyboards/helix/rev2/keymaps/five_rows/config.h @@ -21,6 +21,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef CONFIG_USER_H #define CONFIG_USER_H +#undef TAPPING_TERM +#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..7b7d573d6a 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 <print.h> +#endif extern keymap_config_t keymap_config; @@ -28,6 +31,7 @@ enum layer_number { _QWERTY = 0, _COLEMAK, _DVORAK, + _EUCALYN, _KEYPAD, _AUX, _KAUX, @@ -41,23 +45,27 @@ enum custom_keycodes { QWERTY = SAFE_RANGE, COLEMAK, DVORAK, + EUCALYN, KEYPAD, - EISU, - KANA, - ZERO2, + KC_xEISU, + KC_xKANA, + KC_ZERO2, RGBRST }; -enum macro_keycodes { - KC_SAMPLEMACRO, -}; - - -// Fillers to make layering more clear -#define _______ KC_TRNS -#define XXXXXXX KC_NO //Macros -#define M_SAMPLE M(KC_SAMPLEMACRO) +#define KC_LOWER MO(_LOWER) +#define KC_RABS LT(_RAISE,KC_BSPC) +#define KC_RAEN LT(_RAISE,KC_ENT) +#define KC_FF12 LT(_PADFUNC,KC_F12) +#define KC_____ _______ +#define KC_XXXX XXXXXXX +#define KC_ADJ MO(_ADJUST) +#define KC_LSMI LSFT(KC_MINS) +#define KC_LSEQ LSFT(KC_EQL) +#define KC_LSRB LSFT(KC_RBRC) +#define KC_LSLB LSFT(KC_LBRC) +#define ___ _______ #if HELIX_ROWS == 5 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -72,16 +80,15 @@ 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( \ - 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_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, \ - KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_RCTL, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_GRV, KC_QUOT, KC_N, KC_M, KC_COMM, KC_DOT, 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) \ + [_QWERTY] = LAYOUT_kc( \ + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSPC, \ + TAB, Q, W, E, R, T, Y, U, I, O, P, BSLS, \ + LCTL, A, S, D, F, G, H, J, K, L, SCLN, RCTL, \ + LSFT, Z, X, C, V, B, GRV, QUOT, N, M, COMM, DOT, SLSH, RSFT, \ + LOWER, LOWER, CAPS, LALT, LGUI, SPC, RABS, RAEN, SPC, RGUI, RALT, APP,LOWER, LOWER \ ), /* Colemak @@ -94,16 +101,15 @@ 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( \ - 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_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, \ - KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_RCTL, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_GRV, KC_QUOT, KC_K, KC_M, KC_COMM, KC_DOT, 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) \ + [_COLEMAK] = LAYOUT_kc( \ + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSPC, \ + TAB, Q, W, F, P, G, J, L, U, Y, SCLN, BSLS, \ + LCTL, A, R, S, T, D, H, N, E, I, O, RCTL, \ + LSFT, Z, X, C, V, B, GRV, QUOT, K, M, COMM, DOT, SLSH, RSFT, \ + LOWER, LOWER, CAPS, LALT, LGUI, SPC, RABS, RAEN, SPC, RGUI, RALT, APP,LOWER, LOWER \ ), /* Dvorak @@ -116,16 +122,36 @@ 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( \ - 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_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSLS, \ - KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_RCTL, \ - KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_GRV, KC_SLSH, KC_B, KC_M, KC_W, KC_V, KC_Z, 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) \ + [_DVORAK] = LAYOUT_kc( \ + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSPC, \ + TAB, QUOT, COMM, DOT, P, Y, F, G, C, R, L, BSLS, \ + LCTL, A, O, E, U, I, D, H, T, N, S, RCTL, \ + LSFT, SCLN, Q, J, K, X, GRV, SLSH, B, M, W, V, Z, RSFT, \ + LOWER, LOWER, CAPS, LALT, LGUI, SPC, RABS, RAEN, SPC, RGUI, RALT, APP,LOWER, 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, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSPC, \ + TAB, Q, W, COMM, DOT, SCLN, M, R, D, Y, P, BSLS, \ + LCTL, A, O, E, I, U, G, T, K, S, N, RCTL, \ + LSFT, Z, X, C, V, F, GRV, QUOT, B, H, J, L, SLSH, RSFT, \ + LOWER, LOWER, CAPS, LALT, LGUI, SPC, RABS, RAEN, SPC, RGUI, RALT, APP,LOWER, LOWER \ ), /* Keypad @@ -141,13 +167,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | 0 | , | . | Enter| F5 | F10 | F12 | F12 | F5 | F10 | Enter| 0 | , | . | * `-------------------------------------------------------------------------------------------------' */ - [_KEYPAD] = LAYOUT( \ - KC_TAB, KC_PSLS, KC_PAST, KC_DEL, KC_F1, KC_F6, KC_F1, KC_F6, KC_DEL, KC_TAB, KC_PSLS, KC_PAST, \ - KC_KP_7, KC_KP_8, KC_KP_9, KC_BSPC, KC_F2, KC_F7, KC_F2, KC_F7, KC_BSPC, KC_KP_7, KC_KP_8, KC_KP_9, \ - KC_KP_4, KC_KP_5, KC_KP_6, KC_PMNS, KC_F3, KC_F8, KC_F3, KC_F8, KC_PMNS, KC_KP_4, KC_KP_5, KC_KP_6, \ - KC_KP_1, KC_KP_2, KC_KP_3, KC_PPLS, KC_F4, KC_F9, KC_F11, KC_F11, KC_F4, KC_F9, KC_PPLS, KC_KP_1, KC_KP_2, KC_KP_3, \ - KC_KP_0, KC_COMM, KC_PDOT, KC_PENT, KC_F5, KC_F10, LT(_PADFUNC,KC_F12), - LT(_PADFUNC,KC_F12),KC_F5, KC_F10, KC_PENT, KC_KP_0, KC_COMM, KC_PDOT \ + [_KEYPAD] = LAYOUT_kc( \ + TAB, PSLS, PAST, DEL, F1, F6, F1, F6, DEL, TAB, PSLS, PAST, \ + KP_7, KP_8, KP_9, BSPC, F2, F7, F2, F7, BSPC, KP_7, KP_8, KP_9, \ + KP_4, KP_5, KP_6, PMNS, F3, F8, F3, F8, PMNS, KP_4, KP_5, KP_6, \ + KP_1, KP_2, KP_3, PPLS, F4, F9, F11, F11, F4, F9, PPLS, KP_1, KP_2, KP_3, \ + KP_0, COMM, PDOT, PENT, F5, F10, FF12, FF12, F5, F10, PENT, KP_0, COMM, PDOT \ ), /* AUX modifier key layer @@ -163,12 +188,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | 00 | | | | | | | | | | | 00 | | * `-------------------------------------------------------------------------------------------------' */ - [_KAUX] = LAYOUT( \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, ZERO2, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ZERO2, _______ \ + [_KAUX] = LAYOUT_kc( \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____,ZERO2, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ZERO2,____ \ ), /* Keypad function layer @@ -184,13 +209,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | | | | | | | | * `-------------------------------------------------------------------------------------------------' */ - [_PADFUNC] = LAYOUT( \ - XXXXXXX, XXXXXXX, XXXXXXX, KC_PAUS, KC_SLCK, KC_PSCR, KC_PSCR, KC_SLCK, KC_PAUS, XXXXXXX, XXXXXXX, XXXXXXX, \ - XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_UP, KC_PGUP, KC_PGUP, KC_UP, KC_HOME, XXXXXXX, XXXXXXX, XXXXXXX, \ - XXXXXXX, KC_DEL, KC_INS, KC_LEFT, KC_DOWN, KC_RGHT, KC_LEFT, KC_DOWN, KC_RGHT, KC_INS, KC_DEL, XXXXXXX, \ - XXXXXXX, XXXXXXX, XXXXXXX, KC_END, XXXXXXX, KC_PGDN,MO(_ADJUST), - MO(_ADJUST), KC_PGDN, XXXXXXX, KC_END, XXXXXXX, XXXXXXX, XXXXXXX, \ - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \ + [_PADFUNC] = LAYOUT_kc( \ + XXXX, XXXX, XXXX, PAUS, SLCK, PSCR, PSCR, SLCK, PAUS, XXXX, XXXX, XXXX, \ + XXXX, XXXX, XXXX, HOME, UP, PGUP, PGUP, UP, HOME, XXXX, XXXX, XXXX, \ + XXXX, DEL, INS, LEFT, DOWN, RGHT, LEFT, DOWN, RGHT, INS, DEL, XXXX, \ + XXXX, XXXX, XXXX, END, XXXX, PGDN, ADJ, ADJ, PGDN, XXXX, END, XXXX, XXXX, XXXX, \ + XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, ____, ____, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX \ ), /* Lower @@ -206,13 +230,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | PrtSc| | | | | | | | | PrtSc| | | * `-------------------------------------------------------------------------------------------------' */ - [_LOWER] = LAYOUT( \ - XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, \ - XXXXXXX, XXXXXXX, KC_PAUS, KC_SLCK, KC_INS, XXXXXXX, XXXXXXX, KC_INS, KC_SLCK, KC_PAUS, XXXXXXX, KC_F12, \ - _______, KC_HOME, XXXXXXX, KC_UP, KC_DEL, KC_PGUP, KC_PGUP, KC_DEL, KC_UP, XXXXXXX, KC_HOME, _______, \ - _______, KC_END, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, XXXXXXX, XXXXXXX,KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, _______, \ - _______, _______, KC_PSCR, _______, _______, _______, MO(_ADJUST), - MO(_ADJUST), _______, _______, _______, KC_PSCR, _______, _______ \ + [_LOWER] = LAYOUT_kc( \ + XXXX, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, \ + XXXX, XXXX, PAUS, SLCK, INS, XXXX, XXXX, INS, SLCK, PAUS, XXXX, F12, \ + ____, HOME, XXXX, UP, DEL, PGUP, PGUP, DEL, UP, XXXX, HOME, ____, \ + ____, END, LEFT, DOWN, RGHT, PGDN, XXXX, XXXX, PGDN, LEFT, DOWN, RGHT, END, ____, \ + ____, ____, PSCR, ____, ____, ____, ADJ, ADJ, ____, ____, ____, PSCR, ____, ____ \ ), /* Raise @@ -228,18 +251,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | | | | | | | | * `-------------------------------------------------------------------------------------------------' */ - [_RAISE] = LAYOUT( \ - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LSFT(KC_MINS), KC_MINS, KC_EQL, LSFT(KC_EQL), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ - _______, XXXXXXX, XXXXXXX, XXXXXXX, LSFT(KC_LBRC), KC_LBRC, KC_RBRC, LSFT(KC_RBRC), XXXXXXX, XXXXXXX, XXXXXXX, _______, \ - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, EISU, EISU, KANA, KANA, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, \ - MO(_ADJUST),MO(_ADJUST),XXXXXXX, _______, _______, XXXXXXX, _______, - _______, XXXXXXX, _______, _______, XXXXXXX,MO(_ADJUST),MO(_ADJUST) \ + [_RAISE] = LAYOUT_kc( \ + XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, \ + XXXX, XXXX, XXXX, XXXX, LSMI, MINS, EQL, LSEQ, XXXX, XXXX, XXXX, XXXX, \ + ____, XXXX, XXXX, XXXX, LSLB, LBRC, RBRC, LSRB, XXXX, XXXX, XXXX, ____, \ + ____, XXXX, XXXX, XXXX, XXXX,xEISU,xEISU, xKANA,xKANA,MNXT, VOLD, VOLU, MPLY, ____, \ + ADJ, ADJ, XXXX, ____, ____, XXXX, ____, ____, XXXX, ____, ____, XXXX, ADJ, ADJ \ ), /* 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,11 +273,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-------------------------------------------------------------------------------------------------' */ [_ADJUST] = LAYOUT( \ - XXXXXXX, XXXXXXX, KEYPAD, DVORAK, COLEMAK, QWERTY, QWERTY, COLEMAK, DVORAK, KEYPAD, XXXXXXX, 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, \ - _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, 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_MOD, AU_OFF, AG_NORM, AG_NORM, AU_OFF, RGB_MOD, RGB_VAI, RGB_SAI, RGB_HUI, \ + RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, ___,___, XXXXXXX, XXXXXXX, XXXXXXX, RGB_VAD, RGB_SAD, RGB_HUD, \ + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, ___,___, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______ \ ), /* AUX modifier key layer @@ -271,13 +293,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | BS | Enter| | | | | | | | * `-------------------------------------------------------------------------------------------------' */ - [_AUX] = LAYOUT( \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, KC_BSPC, LT(_RAISE,KC_ENT), \ - _______, _______, _______, _______, _______, _______, _______ \ + [_AUX] = LAYOUT_kc( \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, BSPC, RAEN, ____, ____, ____, ____, ____, ____, ____ \ ) }; @@ -304,23 +325,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<<base); - default_layer_set(1UL<<base); - layer_off(_AUX); - layer_off(_KAUX); + eeconfig_update_default_layer(1UL<<base); + default_layer_set(1UL<<base); + layer_off(_AUX); + layer_off(_KAUX); } else { - if( base < _KEYPAD ) - layer_invert(_AUX); - else - layer_invert(_KAUX); + if( base < _KEYPAD ) + layer_invert(_AUX); + else + layer_invert(_KAUX); } } @@ -331,7 +354,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef AUDIO_ENABLE PLAY_SONG(tone_qwerty); #endif - update_base_layer(_QWERTY); + update_base_layer(_QWERTY); } return false; break; @@ -340,7 +363,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef AUDIO_ENABLE PLAY_SONG(tone_colemak); #endif - update_base_layer(_COLEMAK); + update_base_layer(_COLEMAK); } return false; break; @@ -349,7 +372,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef AUDIO_ENABLE PLAY_SONG(tone_dvorak); #endif - update_base_layer(_DVORAK); + update_base_layer(_DVORAK); + } + return false; + break; + case EUCALYN: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_dvorak); + #endif + update_base_layer(_EUCALYN); } return false; break; @@ -358,17 +390,17 @@ 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; - case ZERO2: + case KC_ZERO2: if (record->event.pressed) { SEND_STRING("00"); } return false; break; - case EISU: + case KC_xEISU: if (record->event.pressed) { if(keymap_config.swap_lalt_lgui==false){ register_code(KC_LANG2); @@ -380,7 +412,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; - case KANA: + case KC_xKANA: if (record->event.pressed) { if(keymap_config.swap_lalt_lgui==false){ register_code(KC_LANG1); @@ -468,10 +500,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 +513,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 +527,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 +560,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<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", - (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", - (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); + (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", + (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", + (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); matrix_write(matrix, led); } diff --git a/keyboards/helix/rev2/keymaps/five_rows/rules.mk b/keyboards/helix/rev2/keymaps/five_rows/rules.mk index 402f855ae1..bd7130cfc6 100644 --- a/keyboards/helix/rev2/keymaps/five_rows/rules.mk +++ b/keyboards/helix/rev2/keymaps/five_rows/rules.mk @@ -6,15 +6,19 @@ BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = no # Mouse keys(+4700) EXTRAKEY_ENABLE = no # Audio control and System control(+450) -CONSOLE_ENABLE = no # Console for debug(+400) +CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration +# CONSOLE_ENABLE and COMMAND_ENABLE +# yes, no +1500 +# yes, yes +3200 +# no, yes +400 NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. SWAP_HANDS_ENABLE = no # Enable one-hand typing define HELIX_CUSTOMISE_MSG @@ -66,6 +70,9 @@ ifneq ($(strip $(HELIX)),) ifeq ($(findstring ios,$(HELIX)), ios) IOS_DEVICE_ENABLE = yes endif + ifeq ($(findstring console,$(HELIX)), console) + CONSOLE_ENABLE = yes + endif $(eval $(call HELIX_CUSTOMISE_MSG)) $(info ) endif @@ -100,7 +107,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) diff --git a/keyboards/helix/rev2/keymaps/five_rows_jis/config.h b/keyboards/helix/rev2/keymaps/five_rows_jis/config.h index 34650b99a6..97494c937f 100644 --- a/keyboards/helix/rev2/keymaps/five_rows_jis/config.h +++ b/keyboards/helix/rev2/keymaps/five_rows_jis/config.h @@ -40,4 +40,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MOUSEKEY_DELAY 0 #endif +// 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_jis/keymap.c b/keyboards/helix/rev2/keymaps/five_rows_jis/keymap.c index 141b222753..8c2040d5be 100644 --- a/keyboards/helix/rev2/keymaps/five_rows_jis/keymap.c +++ b/keyboards/helix/rev2/keymaps/five_rows_jis/keymap.c @@ -204,7 +204,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { XXXXXXX, RESET, RGBRST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET, RGBRST, XXXXXXX, XXXXXXX, XXXXXXX, \ XXXXXXX, DL_BAS, DL_BASE, AG_NORM, AG_SWAP, XXXXXXX, XXXXXXX, DL_BAS, DL_BASE, AG_NORM, AG_SWAP, XXXXXXX, \ XXXXXXX, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, \ - XXXXXXX, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, \ + XXXXXXX, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ), }; @@ -214,7 +214,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { #endif #ifdef SSD1306OLED -char keylog[20] = {}; +char keylog[24] = {}; const char code_to_name[60] = { ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', @@ -223,7 +223,7 @@ const char code_to_name[60] = { 'R', 'E', 'B', 'T', ' ', '-', ' ', '@', ' ', ' ', ' ', ';', ':', ' ', ',', '.', '/', ' ', ' ', ' '}; -inline void set_keylog(uint16_t keycode, keyrecord_t *record) +static inline void set_keylog(uint16_t keycode, keyrecord_t *record) { char name = ' '; uint8_t leds = host_keyboard_leds(); @@ -246,6 +246,12 @@ inline void set_keylog(uint16_t keycode, keyrecord_t *record) } #endif +#ifdef RGBLIGHT_ENABLE +#define RGBLIGHT(mode) rgblight_mode(mode) +#else +#define RGBLIGHT(mode) +#endif + // define variables for reactive RGB int RGB_current_mode; #ifdef ADJUST_MACRO_ENABLE @@ -263,12 +269,6 @@ void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { #define ADJUST_MACRO(layer1, layer2, layer3) #endif -#ifdef RGBLIGHT_ENABLE -#define RGBLIGHT(mode) rgblight_mode(mode) -#else -#define RGBLIGHT(mode) -#endif - bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef SSD1306OLED if (record->event.pressed) { @@ -344,7 +344,7 @@ void matrix_scan_user(void) { iota_gfx_task(); // this is what updates the display continuously } -inline void matrix_update(struct CharacterMatrix *dest, +static inline 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)); @@ -367,13 +367,15 @@ const char helix_logo[]={ 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, 0}; -inline void render_logo(struct CharacterMatrix *matrix) { + +static inline void render_logo(struct CharacterMatrix *matrix) { matrix_write(matrix, helix_logo); } const char mac_win_logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; -inline void render_status(struct CharacterMatrix *matrix) { + +static inline void render_status(struct CharacterMatrix *matrix) { char buf[20]; // Render to mode icon diff --git a/keyboards/helix/rev2/keymaps/five_rows_jis/rules.mk b/keyboards/helix/rev2/keymaps/five_rows_jis/rules.mk index 5340a74ba2..3f84b895aa 100644 --- a/keyboards/helix/rev2/keymaps/five_rows_jis/rules.mk +++ b/keyboards/helix/rev2/keymaps/five_rows_jis/rules.mk @@ -14,7 +14,7 @@ MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. SWAP_HANDS_ENABLE = no # Enable one-hand typing define HELIX_CUSTOMISE_MSG @@ -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) diff --git a/keyboards/helix/rev2/keymaps/froggy/config.h b/keyboards/helix/rev2/keymaps/froggy/config.h index df72aef123..517368ae94 100644 --- a/keyboards/helix/rev2/keymaps/froggy/config.h +++ b/keyboards/helix/rev2/keymaps/froggy/config.h @@ -26,4 +26,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped this number of times again. */ #define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */ +// 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/froggy/keymap.c b/keyboards/helix/rev2/keymaps/froggy/keymap.c index 5ac927af3e..efd8a29160 100644 --- a/keyboards/helix/rev2/keymaps/froggy/keymap.c +++ b/keyboards/helix/rev2/keymaps/froggy/keymap.c @@ -81,7 +81,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| * | Shift| Y | S | N | I | U |Space | | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | Alt | win | Sym | Num | OPT | Ent | | | | | | | | + * | Ctrl | Alt | Gui | Sym | Num | OPT | Ent | | | | | | | | * `-------------------------------------------------------------------------------------------------' */ [_BASE] = LAYOUT( \ @@ -256,8 +256,31 @@ void register_delay_code(uint8_t layer){ } } +#ifdef RGBLIGHT_ENABLE +struct keybuf { + char col, row; + char frame; +}; +struct keybuf keybufs[256]; +unsigned char keybuf_begin, keybuf_end; + +int col, row; +#endif + bool process_record_user(uint16_t keycode, keyrecord_t *record) { + #ifdef RGBLIGHT_ENABLE + col = record->event.key.col; + row = record->event.key.row; + if (record->event.pressed && ((row < 5 && is_master) || (row >= 5 && !is_master))) { + int end = keybuf_end; + keybufs[end].col = col; + keybufs[end].row = row % 5; + keybufs[end].frame = 0; + keybuf_end ++; + } + #endif + if(tap_timer&&keycode!=OPT_TAP_SP){ tapping_key = true; } @@ -376,7 +399,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef RGBLIGHT_ENABLE if (record->event.pressed) { RGBAnimation = true; - rgblight_mode(6); + rgblight_mode(RGBLIGHT_MODE_RAINBOW_MOOD); RGB_current_mode = rgblight_config.mode; } #endif @@ -385,7 +408,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef RGBLIGHT_ENABLE if (record->event.pressed) { RGBAnimation = true; - rgblight_mode(10); + rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL + 1); RGB_current_mode = rgblight_config.mode; } #endif @@ -394,7 +417,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef RGBLIGHT_ENABLE if (record->event.pressed) { RGBAnimation = true; - rgblight_mode(21); + rgblight_mode(RGBLIGHT_MODE_KNIGHT); RGB_current_mode = rgblight_config.mode; } #endif @@ -475,6 +498,61 @@ void music_scale_user(void) #define L_NFNLAYER 192 #define L_MOUSECURSOR 256 +// LED Effect +#ifdef RGBLIGHT_ENABLE +unsigned char rgb[7][5][3]; +void led_ripple_effect(char r, char g, char b) { + static int scan_count = -10; + static int keys[] = { 6, 6, 6, 7, 7 }; + static int keys_sum[] = { 0, 6, 12, 18, 25 }; + + if (scan_count == -1) { + rgblight_enable_noeeprom(); + rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT); + } else if (scan_count >= 0 && scan_count < 5) { + for (unsigned char c=keybuf_begin; c!=keybuf_end; c++) { + int i = c; + // FIXME: + + int y = scan_count; + int dist_y = abs(y - keybufs[i].row); + for (int x=0; x<keys[y]; x++) { + int dist = abs(x - keybufs[i].col) + dist_y; + if (dist <= keybufs[i].frame) { + int elevation = MAX(0, (8 + dist - keybufs[i].frame)) << 2; + if (elevation) { + if ((rgb[x][y][0] != 255) && r) { rgb[x][y][0] = MIN(255, elevation + rgb[x][y][0]); } + if ((rgb[x][y][1] != 255) && g) { rgb[x][y][1] = MIN(255, elevation + rgb[x][y][1]); } + if ((rgb[x][y][2] != 255) && b) { rgb[x][y][2] = MIN(255, elevation + rgb[x][y][2]); } + } + } + } + } + } else if (scan_count == 5) { + for (unsigned char c=keybuf_begin; c!=keybuf_end; c++) { + int i = c; + if (keybufs[i].frame < 18) { + keybufs[i].frame ++; + } else { + keybuf_begin ++; + } + } + } else if (scan_count >= 6 && scan_count <= 10) { + int y = scan_count - 6; + for (int x=0; x<keys[y]; x++) { + int at = keys_sum[y] + ((y & 1) ? x : (keys[y] - x - 1)); + led[at].r = rgb[x][y][0]; + led[at].g = rgb[x][y][1]; + led[at].b = rgb[x][y][2]; + } + rgblight_set(); + } else if (scan_count == 11) { + memset(rgb, 0, sizeof(rgb)); + } + scan_count++; + if (scan_count >= 12) { scan_count = 0; } +} +#endif uint8_t layer_state_old; @@ -494,42 +572,64 @@ void matrix_scan_user(void) { if(layer_state_old != layer_state){ switch (layer_state) { case L_BASE: - #ifdef RGBLIGHT_ENABLE - if (!RGBAnimation){ - rgblight_sethsv(187,255,255); - rgblight_mode(1); - }else{ - rgblight_mode(RGB_current_mode); - } - #endif break; case L_OPT: register_delay_code(_OPT); break; case L_NUM: register_delay_code(_NUM); - #ifdef RGBLIGHT_ENABLE - rgblight_sethsv(25,255,255); - rgblight_mode(1); - #endif break; case L_SYM: register_delay_code(_SYM); - #ifdef RGBLIGHT_ENABLE - rgblight_sethsv(96,255,255); - rgblight_mode(1); - #endif break; case L_FUNC: register_delay_code(_FUNC); - #ifdef RGBLIGHT_ENABLE - rgblight_sethsv(331,255,255); - rgblight_mode(1); - #endif break; } layer_state_old = layer_state; } + + #ifdef RGBLIGHT_ENABLE + if(!RGBAnimation){ + switch (layer_state) { + case L_BASE: + #ifdef RGBLED_BACK + led_ripple_effect(0,112,127); + #else + rgblight_setrgb(0,112,127); + #endif + break; + case L_OPT: + #ifdef RGBLED_BACK + led_ripple_effect(127,0,100); + #else + rgblight_setrgb(127,0,100); + #endif + break; + case L_NUM: + #ifdef RGBLED_BACK + led_ripple_effect(127,23,0); + #else + rgblight_setrgb(127,23,0); + #endif + break; + case L_SYM: + #ifdef RGBLED_BACK + led_ripple_effect(0,127,0); + #else + rgblight_setrgb(0,127,0); + #endif + break; + case L_FUNC: + #ifdef RGBLED_BACK + led_ripple_effect(127,0,61); + #else + rgblight_setrgb(127,0,61); + #endif + break; + } + } + #endif } //SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h diff --git a/keyboards/helix/rev2/keymaps/froggy/rules.mk b/keyboards/helix/rev2/keymaps/froggy/rules.mk index aa97964134..f460170711 100644 --- a/keyboards/helix/rev2/keymaps/froggy/rules.mk +++ b/keyboards/helix/rev2/keymaps/froggy/rules.mk @@ -14,7 +14,7 @@ MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. SWAP_HANDS_ENABLE = no # Enable one-hand typing define HELIX_CUSTOMISE_MSG @@ -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) diff --git a/keyboards/helix/rev2/keymaps/led_test/config.h b/keyboards/helix/rev2/keymaps/led_test/config.h index 6da6849a1d..e2bdf2f329 100644 --- a/keyboards/helix/rev2/keymaps/led_test/config.h +++ b/keyboards/helix/rev2/keymaps/led_test/config.h @@ -23,4 +23,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // 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 // led_test keymap need only this. + //#define RGBLIGHT_EFFECT_ALTERNATING +#endif + #endif /* CONFIG_USER_H */ diff --git a/keyboards/helix/rev2/keymaps/led_test/led_test_init.c b/keyboards/helix/rev2/keymaps/led_test/led_test_init.c index 1d9cb4ebde..85f5d1aa7e 100644 --- a/keyboards/helix/rev2/keymaps/led_test/led_test_init.c +++ b/keyboards/helix/rev2/keymaps/led_test/led_test_init.c @@ -5,7 +5,7 @@ void led_test_init(void) { static int scan_count = 0; if( scan_count == 2 ) { rgblight_enable_noeeprom(); - rgblight_mode_noeeprom(35); + rgblight_mode_noeeprom(RGBLIGHT_MODE_RGB_TEST); } if( scan_count < 3 ) scan_count ++; } @@ -15,6 +15,6 @@ void led_test_init(void) { // can use this? void startup_user(void) { rgblight_enable_noeeprom(); - rgblight_mode_noeeprom(35); + rgblight_mode_noeeprom(RGBLIGHT_MODE_RGB_TEST); } #endif diff --git a/keyboards/helix/rev2/keymaps/led_test/rules.mk b/keyboards/helix/rev2/keymaps/led_test/rules.mk index c7ee75c36b..a9cd251bc5 100644 --- a/keyboards/helix/rev2/keymaps/led_test/rules.mk +++ b/keyboards/helix/rev2/keymaps/led_test/rules.mk @@ -14,7 +14,7 @@ MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. SWAP_HANDS_ENABLE = no # Enable one-hand typing define HELIX_CUSTOMISE_MSG @@ -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) diff --git a/keyboards/helix/rev2/keymaps/yshrsmz/config.h b/keyboards/helix/rev2/keymaps/yshrsmz/config.h new file mode 100644 index 0000000000..d70f23c3e3 --- /dev/null +++ b/keyboards/helix/rev2/keymaps/yshrsmz/config.h @@ -0,0 +1,38 @@ +/* +This is the c configuration file for the keymap + +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/>. +*/ +#pragma once + +/* auto shift config */ +#define AUTO_SHIFT_TIMEOUT 150 + +// 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 diff --git a/keyboards/helix/rev2/keymaps/yshrsmz/keymap.c b/keyboards/helix/rev2/keymaps/yshrsmz/keymap.c new file mode 100644 index 0000000000..1bde66e885 --- /dev/null +++ b/keyboards/helix/rev2/keymaps/yshrsmz/keymap.c @@ -0,0 +1,558 @@ +#include QMK_KEYBOARD_H +#include "bootloader.h" +#ifdef PROTOCOL_LUFA +#include "lufa.h" +#include "split_util.h" +#endif +#ifdef AUDIO_ENABLE + #include "audio.h" +#endif +#ifdef SSD1306OLED + #include "ssd1306.h" +#endif + +extern keymap_config_t keymap_config; + +#ifdef RGBLIGHT_ENABLE +//Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; +#endif + +extern uint8_t is_master; + +// 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, + _LOWER, + _RAISE, + _FUNC, + _ADJUST +}; + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + LOWER, + RAISE, + FUNC, + ADJUST, + EISU, + KANA +}; + +enum macro_keycodes { + KC_SAMPLEMACRO, +}; + + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO +//Macros +#define M_SAMPLE M(KC_SAMPLEMACRO) + +#if HELIX_ROWS == 5 +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Qwerty + * ,-----------------------------------------. ,-----------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | = | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | | Y | U | I | O | P | - | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | ESC | A | S | D | F | G | | H | J | K | L | ; | ' | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * |Shift | Z | X | C | V | B | Fn | Fn | N | M | , | . | / |Shift | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | EISU | Ctrl | Alt | GUI |Lower |Space | Bksp |Enter |Space |Raise | GUI | Alt | Ctrl | KANA | + * `-------------------------------------------------------------------------------------------------' + */ + [_QWERTY] = LAYOUT( \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQL, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS, \ + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, FUNC, FUNC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ + EISU, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_BSPC, KC_ENT, KC_SPC, RAISE, KC_RGUI, KC_RALT, KC_RCTL, KANA \ + ), + + /* Lower + * ,-----------------------------------------. ,-----------------------------------------. + * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | | | F12 | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-------------------------------------------------------------------------------------------------' + */ + [_LOWER] = LAYOUT( \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, KC_F12, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Raise + * ,-----------------------------------------. ,-----------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | | | F12 | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-------------------------------------------------------------------------------------------------' + */ + [_RAISE] = LAYOUT( \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, KC_F12, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Func + * ,-----------------------------------------. ,-----------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | LEFT | DOWN | UP |RIGHT | PGUP | | + * |------+------+------+------+------+------|------+------|------+------+------+------+------+------| + * | | | | | | | | | HOME | END |Alt+← |Alt+→ | PGDN | | + * |------+------+------+------+------+------+-------------+------+------+------+------+------+------| + * | | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-------------------------------------------------------------------------------------------------' + */ + [_FUNC] = LAYOUT( \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ + _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_PGUP, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_END, LALT(KC_LEFT), LALT(KC_RGHT), KC_PGDN, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Adjust (Lower + Raise) + * ,-----------------------------------------. ,-----------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | Reset| | | | | | | | | | | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | |Aud on|Audoff| Mac | | Win |Qwerty| | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | |RGB ON| HUE+ | SAT+ | VAL+ | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | MODE | HUE- | SAT- | VAL- | + * `-------------------------------------------------------------------------------------------------' + */ + [_ADJUST] = LAYOUT( \ + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ + _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD \ + ) +}; + +#elif HELIX_ROWS == 4 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Qwerty + * ,-----------------------------------------. ,-----------------------------------------. + * | = | Q | W | E | R | T | | Y | U | I | O | P | - | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Esc | A | S | D | F | G | | H | J | K | L | ; | ' | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+-------------+------+------+------+------+------+------| + * | EISU | Ctrl | Alt | GUI |ESC/Lower | Func | Bksp |Enter |Space |Raise | GUI | Alt | Ctrl | KANA | + * `-------------------------------------------------------------------------------------------------' + */ + [_QWERTY] = LAYOUT( \ + KC_EQL, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS, \ + KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ + EISU, KC_LCTL, KC_LALT, KC_LGUI, LT(_LOWER, KC_ESC), FUNC, KC_BSPC, KC_ENT, KC_SPC, RAISE, KC_RGUI, KC_RALT, KC_RCTL, KANA \ + ), + + /* Lower + * ,-----------------------------------------. ,-----------------------------------------. + * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | | F12 | | | | | | + * |------+------+------+------+------+------+-------------+------+------+------+------+------+------| + * | | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-------------------------------------------------------------------------------------------------' + */ + [_LOWER] = LAYOUT( \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Raise + * ,-----------------------------------------. ,-----------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | | F12 | | | | | | + * |------+------+------+------+------+------+-------------+------+------+------+------+------+------| + * | | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-------------------------------------------------------------------------------------------------' + */ + [_RAISE] = LAYOUT( \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Func + * ,-----------------------------------------. ,-----------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | LEFT | DOWN | UP |RIGHT | PGUP | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | HOME | END |Alt+← |Alt+→ | PGDN | | + * |------+------+------+------+------+------+-------------+------+------+------+------+------+------| + * | | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-------------------------------------------------------------------------------------------------' + */ + [_FUNC] = LAYOUT( \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ + _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_PGUP, _______, \ + _______, _______, _______, _______, _______, _______, KC_HOME, KC_END, LALT(KC_LEFT), LALT(KC_RGHT), KC_PGDN, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Adjust (Lower + Raise) + * ,-----------------------------------------. ,-----------------------------------------. + * | | Reset| | | | | | | | | | | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | |Aud on|Audoff| Mac | | Win |Qwerty| | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | |RGB ON| HUE+ | SAT+ | VAL+ | + * |------+------+------+------+------+------+-------------+------+------+------+------+------+------| + * | | | | | | | | | | | MODE | HUE- | SAT- | VAL- | + * `-------------------------------------------------------------------------------------------------' + */ + [_ADJUST] = LAYOUT( \ + _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD \ + ) +}; + +#else +#error "undefined keymaps" +#endif + + +#ifdef AUDIO_ENABLE + +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +float tone_plover[][2] = SONG(PLOVER_SOUND); +float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); +float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); +#endif + +// define variables for reactive RGB +bool TOG_STATUS = false; +int RGB_current_mode; + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +// Setting ADJUST layer RGB back to default +void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { + #ifdef RGBLIGHT_ENABLE + //rgblight_mode(RGB_current_mode); + #endif + layer_on(layer3); + } else { + layer_off(layer3); + } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + //not sure how to have keyboard check mode and set it to a variable, so my work around + //uses another variable that would be set to true after the first time a reactive key is pressed. + if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false + } else { + TOG_STATUS = !TOG_STATUS; + #ifdef RGBLIGHT_ENABLE + //rgblight_mode(RGBLIGHT_MODE_SNAKE + 1); + #endif + } + layer_on(_LOWER); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } else { + #ifdef RGBLIGHT_ENABLE + //rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change + #endif + TOG_STATUS = false; + layer_off(_LOWER); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + //not sure how to have keyboard check mode and set it to a variable, so my work around + //uses another variable that would be set to true after the first time a reactive key is pressed. + if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false + } else { + TOG_STATUS = !TOG_STATUS; + #ifdef RGBLIGHT_ENABLE + //rgblight_mode(RGBLIGHT_MODE_SNAKE); + #endif + } + layer_on(_RAISE); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } else { + #ifdef RGBLIGHT_ENABLE + //rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change + #endif + layer_off(_RAISE); + TOG_STATUS = false; + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case FUNC: + if (record->event.pressed) { + layer_on(_FUNC); + } else { + layer_off(_FUNC); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released + case RGB_MOD: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + rgblight_mode(RGB_current_mode); + rgblight_step(); + RGB_current_mode = rgblight_config.mode; + } + #endif + return false; + break; + case EISU: + if (record->event.pressed) { + if(keymap_config.swap_lalt_lgui==false){ + register_code(KC_LANG2); + }else{ + SEND_STRING(SS_LALT("`")); + } + } else { + unregister_code(KC_LANG2); + } + return false; + break; + case KANA: + if (record->event.pressed) { + if(keymap_config.swap_lalt_lgui==false){ + register_code(KC_LANG1); + }else{ + SEND_STRING(SS_LALT("`")); + } + } else { + unregister_code(KC_LANG1); + } + return false; + break; + } + return true; +} + +void matrix_init_user(void) { + #ifdef AUDIO_ENABLE + startup_user(); + #endif + #ifdef RGBLIGHT_ENABLE + RGB_current_mode = rgblight_config.mode; + #endif + //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h + #ifdef SSD1306OLED + iota_gfx_init(!has_usb()); // turns on the display + #endif +} + + +#ifdef AUDIO_ENABLE + +void startup_user() +{ + _delay_ms(20); // gets rid of tick +} + +void shutdown_user() +{ + _delay_ms(150); + stop_all_notes(); +} + +void music_on_user(void) +{ + music_scale_user(); +} + +void music_scale_user(void) +{ + PLAY_SONG(music_scale); +} + +#endif + + +//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h +#ifdef SSD1306OLED + +// hook point for 'led_test' keymap +// 'default' keymap's led_test_init() is empty function, do nothing +// 'led_test' keymap's led_test_init() force rgblight_mode_noeeprom(RGBLIGHT_MODE_RGB_TEST); +__attribute__ ((weak)) +void led_test_init(void) {} + +void matrix_scan_user(void) { + led_test_init(); + 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; + } +} + +//assign the right code to your layers for OLED display +#define L_BASE 0 +#define L_LOWER (1<<_LOWER) +#define L_RAISE (1<<_RAISE) +#define L_FUNC (1<<_FUNC) +#define L_ADJUST (1<<_ADJUST) +#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER) + +static void render_logo(struct CharacterMatrix *matrix) { + + static char logo[]={ + 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, + 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, + 0}; + matrix_write(matrix, logo); + //matrix_write_P(&matrix, PSTR(" Split keyboard kit")); +} + + + +void render_status(struct CharacterMatrix *matrix) { + + // Render to mode icon + static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; + if(keymap_config.swap_lalt_lgui==false){ + matrix_write(matrix, logo[0][0]); + matrix_write_P(matrix, PSTR("\n")); + matrix_write(matrix, logo[0][1]); + }else{ + matrix_write(matrix, logo[1][0]); + matrix_write_P(matrix, PSTR("\n")); + matrix_write(matrix, logo[1][1]); + } + + // 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 + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); + matrix_write_P(matrix, PSTR("\nLayer: ")); + switch (layer_state) { + case L_BASE: + matrix_write_P(matrix, PSTR("Default")); + break; + case L_RAISE: + matrix_write_P(matrix, PSTR("Raise")); + break; + case L_LOWER: + matrix_write_P(matrix, PSTR("Lower")); + break; + case L_FUNC: + matrix_write_P(matrix, PSTR("Func")); + break; + case L_ADJUST: + case L_ADJUST_TRI: + matrix_write_P(matrix, PSTR("Adjust")); + break; + default: + matrix_write(matrix, buf); + } + + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n%s %s %s", + (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", + (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", + (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); + matrix_write(matrix, led); +} + + +void iota_gfx_task_user(void) { + struct CharacterMatrix matrix; + +#if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } +#endif + + matrix_clear(&matrix); + if(is_master){ + render_status(&matrix); + }else{ + render_logo(&matrix); + } + matrix_update(&display, &matrix); +} + +#endif diff --git a/keyboards/helix/rev2/keymaps/yshrsmz/rules.mk b/keyboards/helix/rev2/keymaps/yshrsmz/rules.mk new file mode 100644 index 0000000000..3f390b48f8 --- /dev/null +++ b/keyboards/helix/rev2/keymaps/yshrsmz/rules.mk @@ -0,0 +1,121 @@ + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = no # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. +SWAP_HANDS_ENABLE = no # Enable one-hand typing + +define HELIX_CUSTOMISE_MSG + $(info Helix customize) + $(info - OLED_ENABLE=$(OLED_ENABLE)) + $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE)) + $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE)) + $(info - LED_ANIMATION=$(LED_ANIMATIONS)) + $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE)) +endef + +# Helix keyboard customize +# you can edit follows 7 Variables +# jp: 以下の7つの変数を必要に応じて編集します。 +HELIX_ROWS = 4 # Helix Rows is 4 or 5 +OLED_ENABLE = yes # OLED_ENABLE +LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c" +LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) +LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) +LED_ANIMATIONS = no # LED animations +IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) + +#### LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE. +#### Do not enable these with audio at the same time. + +### Helix keyboard 'default' keymap: convenient command line option +## make HELIX=<options> helix:defualt +## option= oled | back | under | na | ios +## ex. +## make HELIX=oled helix:defualt +## make HELIX=oled,back helix:defualt +## make HELIX=oled,under helix:defualt +## make HELIX=oled,back,na helix:defualt +## make HELIX=oled,back,ios helix:defualt +## +ifneq ($(strip $(HELIX)),) + ifeq ($(findstring oled,$(HELIX)), oled) + OLED_ENABLE = yes + endif + ifeq ($(findstring back,$(HELIX)), back) + LED_BACK_ENABLE = yes + else ifeq ($(findstring under,$(HELIX)), under) + LED_UNDERGLOW_ENABLE = yes + endif + ifeq ($(findstring na,$(HELIX)), na) + LED_ANIMATIONS = no + endif + ifeq ($(findstring ios,$(HELIX)), ios) + IOS_DEVICE_ENABLE = yes + endif + $(eval $(call HELIX_CUSTOMISE_MSG)) + $(info ) +endif + +# Uncomment these for checking +# jp: コンパイル時にカスタマイズの状態を表示したい時はコメントをはずします。 +# $(eval $(call HELIX_CUSTOMISE_MSG)) +# $(info ) + +ifneq ($(strip $(HELIX_ROWS)), 4) + ifneq ($(strip $(HELIX_ROWS)), 5) + $(error HELIX_ROWS = $(strip $(HELIX_ROWS)) is unexpected value) + endif +endif +OPT_DEFS += -DHELIX_ROWS=$(strip $(HELIX_ROWS)) + +ifeq ($(strip $(LED_BACK_ENABLE)), yes) + RGBLIGHT_ENABLE = yes + OPT_DEFS += -DRGBLED_BACK + ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) + $(eval $(call HELIX_CUSTOMISE_MSG)) + $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes') + endif +else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) + RGBLIGHT_ENABLE = yes +else + RGBLIGHT_ENABLE = no +endif + +ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) + OPT_DEFS += -DIOS_DEVICE_ENABLE +endif + +ifeq ($(strip $(LED_ANIMATIONS)), yes) + OPT_DEFS += -DLED_ANIMATIONS +endif + +ifeq ($(strip $(OLED_ENABLE)), yes) + OPT_DEFS += -DOLED_ENABLE +endif + +ifeq ($(strip $(LOCAL_GLCDFONT)), yes) + OPT_DEFS += -DLOCAL_GLCDFONT +endif + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +AUTO_SHIFT_ENABLE = yes + +# Uncomment these for debugging +# $(info -- RGBLIGHT_ENABLE=$(RGBLIGHT_ENABLE)) +# $(info -- OPT_DEFS=$(OPT_DEFS)) +# $(info ) diff --git a/keyboards/helix/rev2/matrix.c b/keyboards/helix/rev2/matrix.c index 8a1ce3af1e..322959dbbb 100644 --- a/keyboards/helix/rev2/matrix.c +++ b/keyboards/helix/rev2/matrix.c @@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdint.h> #include <stdbool.h> +#include <string.h> #include <avr/io.h> #include <avr/wdt.h> #include <avr/interrupt.h> @@ -34,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifdef USE_MATRIX_I2C # include "i2c.h" #else // USE_SERIAL -# include "serial.h" +# include "split_scomm.h" #endif #ifndef DEBOUNCE @@ -102,6 +103,8 @@ void matrix_init(void) init_cols(); TX_RX_LED_INIT; + TXLED0; + RXLED0; // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) { @@ -178,17 +181,20 @@ i2c_error: // the cable is disconnceted, or something else went wrong #else // USE_SERIAL -int serial_transaction(void) { +int serial_transaction(int master_changed) { int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; +#ifdef SERIAL_USE_MULTI_TRANSACTION + int ret=serial_update_buffers(master_changed); +#else int ret=serial_update_buffers(); +#endif if (ret ) { - if(ret==2)RXLED1; + if(ret==2) RXLED1; return 1; } -RXLED0; - for (int i = 0; i < ROWS_PER_HAND; ++i) { - matrix[slaveOffset+i] = serial_slave_buffer[i]; - } + RXLED0; + memcpy(&matrix[slaveOffset], + (void *)serial_slave_buffer, sizeof(serial_slave_buffer)); return 0; } #endif @@ -199,19 +205,9 @@ uint8_t matrix_scan(void) matrix_master_scan(); }else{ matrix_slave_scan(); - -// if(serial_slave_DATA_CORRUPT()){ -// TXLED0; - int offset = (isLeftHand) ? ROWS_PER_HAND : 0; - - for (int i = 0; i < ROWS_PER_HAND; ++i) { - matrix[offset+i] = serial_master_buffer[i]; - } - -// }else{ -// TXLED1; -// } - + int offset = (isLeftHand) ? ROWS_PER_HAND : 0; + memcpy(&matrix[offset], + (void *)serial_master_buffer, sizeof(serial_master_buffer)); matrix_scan_quantum(); } return 1; @@ -221,6 +217,7 @@ uint8_t matrix_scan(void) uint8_t matrix_master_scan(void) { int ret = _matrix_scan(); + int mchanged = 1; #ifndef KEYBOARD_helix_rev1 int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; @@ -231,16 +228,19 @@ uint8_t matrix_master_scan(void) { // i2c_slave_buffer[i] = matrix[offset+i]; // } #else // USE_SERIAL - for (int i = 0; i < ROWS_PER_HAND; ++i) { - serial_master_buffer[i] = matrix[offset+i]; - } + #ifdef SERIAL_USE_MULTI_TRANSACTION + mchanged = memcmp((void *)serial_master_buffer, + &matrix[offset], sizeof(serial_master_buffer)); + #endif + memcpy((void *)serial_master_buffer, + &matrix[offset], sizeof(serial_master_buffer)); #endif #endif #ifdef USE_MATRIX_I2C if( i2c_transaction() ) { #else // USE_SERIAL - if( serial_transaction() ) { + if( serial_transaction(mchanged) ) { #endif // turn on the indicator led when halves are disconnected TXLED1; @@ -274,9 +274,19 @@ void matrix_slave_scan(void) { i2c_slave_buffer[i] = matrix[offset+i]; } #else // USE_SERIAL + #ifdef SERIAL_USE_MULTI_TRANSACTION + int change = 0; + #endif for (int i = 0; i < ROWS_PER_HAND; ++i) { + #ifdef SERIAL_USE_MULTI_TRANSACTION + if( serial_slave_buffer[i] != matrix[offset+i] ) + change = 1; + #endif serial_slave_buffer[i] = matrix[offset+i]; } + #ifdef SERIAL_USE_MULTI_TRANSACTION + slave_buffer_change_count += change; + #endif #endif } diff --git a/keyboards/helix/rev2/rev2.c b/keyboards/helix/rev2/rev2.c index 75765f1d35..abaa02cdb1 100644 --- a/keyboards/helix/rev2/rev2.c +++ b/keyboards/helix/rev2/rev2.c @@ -2,6 +2,12 @@ #ifdef SSD1306OLED +#include "ssd1306.h" + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + return process_record_gfx(keycode,record) && process_record_user(keycode, record); +} + void led_set_kb(uint8_t usb_led) { // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here //led_set_user(usb_led); diff --git a/keyboards/helix/rev2/rules.mk b/keyboards/helix/rev2/rules.mk index 6ab01f44b4..5582a0f9c4 100644 --- a/keyboards/helix/rev2/rules.mk +++ b/keyboards/helix/rev2/rules.mk @@ -1,3 +1,3 @@ -SRC += rev2/matrix.c \ - rev2/split_util.c \ - ws2812.c +SRC += rev2/matrix.c +SRC += rev2/split_util.c +SRC += rev2/split_scomm.c diff --git a/keyboards/helix/rev2/serial_config.h b/keyboards/helix/rev2/serial_config.h index 82c6e4e836..37135213d5 100644 --- a/keyboards/helix/rev2/serial_config.h +++ b/keyboards/helix/rev2/serial_config.h @@ -1,16 +1,8 @@ -#ifndef SOFT_SERIAL_CONFIG_H -#define SOFT_SERIAL_CONFIG_H +//// #error rev2 serial config +#ifndef SOFT_SERIAL_PIN /* Soft Serial defines */ -#define SERIAL_PIN_DDR DDRD -#define SERIAL_PIN_PORT PORTD -#define SERIAL_PIN_INPUT PIND -#define SERIAL_PIN_MASK _BV(PD2) -#define SERIAL_PIN_INTERRUPT INT2_vect - -#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 -#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 - -//// #error rev2 serial config +#define SOFT_SERIAL_PIN D2 -#endif /* SOFT_SERIAL_CONFIG_H */ +#define SERIAL_USE_MULTI_TRANSACTION +#endif diff --git a/keyboards/helix/rev2/serial_config_simpleapi.h b/keyboards/helix/rev2/serial_config_simpleapi.h new file mode 100644 index 0000000000..e2d22a41e7 --- /dev/null +++ b/keyboards/helix/rev2/serial_config_simpleapi.h @@ -0,0 +1,8 @@ +#ifndef SERIAL_CONFIG_SIMPLEAPI_H +#define SERIAL_CONFIG_SIMPLEAPI_H + +#undef SERIAL_USE_MULTI_TRANSACTION +#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 +#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 + +#endif // SERIAL_CONFIG_SIMPLEAPI_H diff --git a/keyboards/helix/rev2/split_scomm.c b/keyboards/helix/rev2/split_scomm.c new file mode 100644 index 0000000000..ada7867960 --- /dev/null +++ b/keyboards/helix/rev2/split_scomm.c @@ -0,0 +1,92 @@ +#ifdef USE_SERIAL +#ifdef SERIAL_USE_MULTI_TRANSACTION +/* --- USE flexible API (using multi-type transaction function) --- */ + +#include <stdbool.h> +#include <stdint.h> +#include <stddef.h> +#include <split_scomm.h> +#include "serial.h" +#ifdef CONSOLE_ENABLE + #include <print.h> +#endif + +uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; +uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; +uint8_t volatile status_com = 0; +uint8_t volatile status1 = 0; +uint8_t slave_buffer_change_count = 0; +uint8_t s_change_old = 0xff; +uint8_t s_change_new = 0xff; + +SSTD_t transactions[] = { +#define GET_SLAVE_STATUS 0 + /* master buffer not changed, only recive slave_buffer_change_count */ + { (uint8_t *)&status_com, + 0, NULL, + sizeof(slave_buffer_change_count), &slave_buffer_change_count, + }, +#define PUT_MASTER_GET_SLAVE_STATUS 1 + /* master buffer changed need send, and recive slave_buffer_change_count */ + { (uint8_t *)&status_com, + sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer, + sizeof(slave_buffer_change_count), &slave_buffer_change_count, + }, +#define GET_SLAVE_BUFFER 2 + /* recive serial_slave_buffer */ + { (uint8_t *)&status1, + 0, NULL, + sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer + } +}; + +void serial_master_init(void) +{ + soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); +} + +void serial_slave_init(void) +{ + soft_serial_target_init(transactions, TID_LIMIT(transactions)); +} + +// 0 => no error +// 1 => slave did not respond +// 2 => checksum error +int serial_update_buffers(int master_update) +{ + int status, smatstatus; + static int need_retry = 0; + + if( s_change_old != s_change_new ) { + smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER); + if( smatstatus == TRANSACTION_END ) { + s_change_old = s_change_new; +#ifdef CONSOLE_ENABLE + uprintf("slave matrix = %b %b %b %b %b\n", + serial_slave_buffer[0], serial_slave_buffer[1], + serial_slave_buffer[2], serial_slave_buffer[3], + serial_slave_buffer[4] ); +#endif + } + } else { + // serial_slave_buffer dosen't change + smatstatus = TRANSACTION_END; // dummy status + } + + if( !master_update && !need_retry) { + status = soft_serial_transaction(GET_SLAVE_STATUS); + } else { + status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS); + } + if( status == TRANSACTION_END ) { + s_change_new = slave_buffer_change_count; + need_retry = 0; + } else { + need_retry = 1; + } + return smatstatus; +} + +#endif // SERIAL_USE_MULTI_TRANSACTION +#endif /* USE_SERIAL */ diff --git a/keyboards/helix/rev2/split_scomm.h b/keyboards/helix/rev2/split_scomm.h new file mode 100644 index 0000000000..873d8939d8 --- /dev/null +++ b/keyboards/helix/rev2/split_scomm.h @@ -0,0 +1,24 @@ +#ifndef SPLIT_COMM_H +#define SPLIT_COMM_H + +#ifndef SERIAL_USE_MULTI_TRANSACTION +/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */ +#include "serial.h" + +#else +/* --- USE flexible API (using multi-type transaction function) --- */ +// Buffers for master - slave communication +#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 +#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 + +extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; +extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; +extern uint8_t slave_buffer_change_count; + +void serial_master_init(void); +void serial_slave_init(void); +int serial_update_buffers(int master_changed); + +#endif + +#endif /* SPLIT_COMM_H */ diff --git a/keyboards/helix/rev2/split_util.c b/keyboards/helix/rev2/split_util.c index beb39fa005..e1ff8b4379 100644 --- a/keyboards/helix/rev2/split_util.c +++ b/keyboards/helix/rev2/split_util.c @@ -11,7 +11,7 @@ #ifdef USE_MATRIX_I2C # include "i2c.h" #else -# include "serial.h" +# include "split_scomm.h" #endif volatile bool isLeftHand = true; |