From cf0650e3f0f1f78bea48f9a5c0d9b218a6b662f7 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Mon, 9 Jan 2017 19:35:01 +0700 Subject: [PATCH 1/3] Implement greek layers on my Promethium layout --- .../promethium/keymaps/priyadi/keymap.c | 187 +++++++++++++++++- 1 file changed, 182 insertions(+), 5 deletions(-) diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 7ae269563f..02ff57384f 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -29,6 +29,8 @@ enum layers { _NUM, _FUNC, _EMOJI, + _GREEKU, + _GREEKL, _GUI, }; @@ -44,6 +46,7 @@ enum planck_keycodes { FUNC, EMOJI, GUI, + GREEK, // os switchers LINUX, @@ -106,6 +109,59 @@ enum unicode_name { SUN, // sun MOON, // moon SKULL, // skull + + // greek letters + UALPH, + UBETA, + UGAMM, + UDELT, + UEPSI, + UZETA, + UETA, + UTHET, + UIOTA, + UKAPP, + ULAMB, + UMU, + UNU, + UXI, + UOMIC, + UPI, + URHO, + USIGM, + UTAU, + UUPSI, + UPHI, + UCHI, + UPSI, + UOMEG, + + LALPH, + LBETA, + LGAMM, + LDELT, + LEPSI, + LZETA, + LETA, + LTHET, + LIOTA, + LKAPP, + LLAMB, + LMU, + LNU, + LXI, + LOMIC, + LPI, + LRHO, + LSIGM, + LTAU, + LUPSI, + LPHI, + LCHI, + LPSI, + LOMEG, + + FSIGM, }; const uint32_t PROGMEM unicode_map[] = { @@ -156,6 +212,57 @@ const uint32_t PROGMEM unicode_map[] = { [SUN] = 0x2600, [MOON] = 0x1F314, [SKULL] = 0x1F480, + + // greek letters + [UALPH] = 0x0391, + [UBETA] = 0x0392, + [UGAMM] = 0x0393, + [UDELT] = 0x0394, + [UEPSI] = 0x0395, + [UZETA] = 0x0396, + [UETA] = 0x0397, + [UTHET] = 0x0398, + [UIOTA] = 0x0399, + [UKAPP] = 0x039A, + [ULAMB] = 0x039B, + [UMU] = 0x039C, + [UNU] = 0x039D, + [UXI] = 0x039E, + [UOMIC] = 0x039F, + [UPI] = 0x03A0, + [URHO] = 0x03A1, + [USIGM] = 0x03A3, + [UTAU] = 0x03A4, + [UUPSI] = 0x03A5, + [UPHI] = 0x03A6, + [UCHI] = 0x03A7, + [UPSI] = 0x03A8, + [UOMEG] = 0x03A9, + [LALPH] = 0x03B1, + [LBETA] = 0x03B2, + [LGAMM] = 0x03B3, + [LDELT] = 0x03B4, + [LEPSI] = 0x03B5, + [LZETA] = 0x03B6, + [LETA] = 0x03B7, + [LTHET] = 0x03B8, + [LIOTA] = 0x03B9, + [LKAPP] = 0x03BA, + [LLAMB] = 0x03BB, + [LMU] = 0x03BC, + [LNU] = 0x03BD, + [LXI] = 0x03BE, + [LOMIC] = 0x03BF, + [LPI] = 0x03C0, + [LRHO] = 0x03C1, + [LSIGM] = 0x03C3, + [LTAU] = 0x03C4, + [LUPSI] = 0x03C5, + [LPHI] = 0x03C6, + [LCHI] = 0x03C7, + [LPSI] = 0x03C8, + [LOMEG] = 0x03C9, + [FSIGM] = 0x03C2, }; @@ -165,7 +272,6 @@ const uint32_t PROGMEM unicode_map[] = { // #undef KC_RSFT // #define KC_RSFT MT(MOD_LSFT, KC_EQL) - // hybrid right-gui & scroll lock (mapped to Compose in OS) #undef KC_RCTL #define KC_RCTL MT(MOD_LCTL, KC_SLCK) @@ -420,14 +526,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------|------+------+------+------+------+------| * | Shift| Z | X | C | V | B | N | M | , | . | / |Shift | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl | + * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Emoji |Greek |AltGr | Ctrl | * `-----------------------------------------------------------------------------------' */ [_QWERTY] = KEYMAP( KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, KC_ENT , KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, - KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL + KC_LCTL, KC_LALT, KC_LGUI, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, GREEK, KC_RALT, KC_RCTL ), /* Colemak @@ -466,6 +572,42 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +/* Uppercase Greek + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_GREEKU] = { + _______, _______, _______,X(UEPSI), X(URHO), X(UTAU),X(UUPSI),X(UTHET),X(UIOTA),X(UOMIC), X(UPI), _______, + _______,X(UALPH),X(USIGM),X(UDELT), X(UPHI),X(UGAMM), X(UETA), X(UXI),X(UKAPP),X(ULAMB), _______, _______, + _______,X(UZETA), X(UCHI), X(UPSI),X(UOMEG),X(UBETA), X(UNU), X(UMU), _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +}, + +/* Lowercase Greek + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_GREEKL] = { + _______, _______,X(FSIGM),X(LEPSI), X(LRHO), X(LTAU),X(LUPSI),X(LTHET),X(LIOTA),X(LOMIC), X(LPI), _______, + _______,X(LALPH),X(LSIGM),X(LDELT), X(LPHI),X(LGAMM), X(LETA), X(LXI),X(LKAPP),X(LLAMB), _______, _______, + _______,X(LZETA), X(LCHI), X(LPSI),X(LOMEG),X(LBETA), X(LNU), X(LMU), _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +}, + /* Punc * ,-----------------------------------------------------------------------------------. * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | ` | @@ -581,12 +723,47 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) PLAY_NOTE_ARRAY(tone_click, false, 0); #endif + bool lshifted = keyboard_report->mods & MOD_BIT(KC_LSFT); + bool rshifted = keyboard_report->mods & MOD_BIT(KC_RSFT); + switch (keycode) { + case GREEK: + if (record->event.pressed) { + if (lshifted || rshifted) { + layer_on(_GREEKU); + layer_off(_GREEKL); + } else { + layer_on(_GREEKL); + layer_off(_GREEKU); + } + } else { + layer_off(_GREEKU); + layer_off(_GREEKL); + } + return false; + break; + + case KC_LSFT: + case KC_RSFT: + ; + uint8_t layer = biton32(layer_state); + if (layer == _GREEKU || layer == _GREEKL) { + if (record->event.pressed) { + layer_on(_GREEKU); + layer_off(_GREEKL); + } else { + if (lshifted ^ rshifted) { // if only one shift is pressed + layer_on(_GREEKL); + layer_off(_GREEKU); + } + } + } + return true; + break; + // QWERTZ style comma and dot: semicolon and colon when shifted case KC_COMM: if (record->event.pressed) { - bool lshifted = keyboard_report->mods & MOD_BIT(KC_LSFT); - bool rshifted = keyboard_report->mods & MOD_BIT(KC_RSFT); if (lshifted || rshifted) { if (lshifted) unregister_code(KC_LSFT); if (rshifted) unregister_code(KC_RSFT); From 8c2cc30b0e6705b9fb44305ed9d20fae2bf3a03d Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Mon, 9 Jan 2017 21:24:26 +0700 Subject: [PATCH 2/3] fix greek layers --- keyboards/handwired/promethium/keymaps/priyadi/keymap.c | 8 ++++---- keyboards/handwired/promethium/promethium.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 02ff57384f..4665e32af5 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -583,12 +583,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' */ -[_GREEKU] = { +[_GREEKU] = KEYMAP( _______, _______, _______,X(UEPSI), X(URHO), X(UTAU),X(UUPSI),X(UTHET),X(UIOTA),X(UOMIC), X(UPI), _______, _______,X(UALPH),X(USIGM),X(UDELT), X(UPHI),X(UGAMM), X(UETA), X(UXI),X(UKAPP),X(ULAMB), _______, _______, _______,X(UZETA), X(UCHI), X(UPSI),X(UOMEG),X(UBETA), X(UNU), X(UMU), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ -}, +), /* Lowercase Greek * ,-----------------------------------------------------------------------------------. @@ -601,12 +601,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' */ -[_GREEKL] = { +[_GREEKL] = KEYMAP( _______, _______,X(FSIGM),X(LEPSI), X(LRHO), X(LTAU),X(LUPSI),X(LTHET),X(LIOTA),X(LOMIC), X(LPI), _______, _______,X(LALPH),X(LSIGM),X(LDELT), X(LPHI),X(LGAMM), X(LETA), X(LXI),X(LKAPP),X(LLAMB), _______, _______, _______,X(LZETA), X(LCHI), X(LPSI),X(LOMEG),X(LBETA), X(LNU), X(LMU), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ -}, +), /* Punc * ,-----------------------------------------------------------------------------------. diff --git a/keyboards/handwired/promethium/promethium.h b/keyboards/handwired/promethium/promethium.h index 662eeab990..a2572db2af 100644 --- a/keyboards/handwired/promethium/promethium.h +++ b/keyboards/handwired/promethium/promethium.h @@ -4,6 +4,7 @@ #include "quantum.h" #define PS2_INIT_DELAY 2000 +#define UNICODE_TYPE_DELAY 0 #define KEYMAP( \ k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \ From 87b675241a1cf535feaa7ae3454cab13bb6dba1e Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Mon, 9 Jan 2017 23:19:34 +0700 Subject: [PATCH 3/3] minimize LEDs --- .../promethium/keymaps/priyadi/keymap.c | 136 +++++++++--------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 4665e32af5..99948967be 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -352,15 +352,15 @@ const uint8_t PROGMEM LED_TRACKPOINT[] = { void led_reset(void) { for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) { - rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 15, 6, 0); + rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 0, 0, 0); } for(uint8_t i = 0; i < COUNT(LED_MODS); i++) { - rgbsps_set(pgm_read_byte(&LED_MODS[i]), 15, 0, 0); + rgbsps_set(pgm_read_byte(&LED_MODS[i]), 0, 0, 0); } for(uint8_t i = 0; i < COUNT(LED_FN); i++) { - rgbsps_set(pgm_read_byte(&LED_FN[i]), 15, 15, 15); + rgbsps_set(pgm_read_byte(&LED_FN[i]), 0, 0, 0); } } @@ -385,30 +385,30 @@ void led_layer_func(void) { rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 0, 0, 0); } - rgbsps_set(LED_I, 15, 0, 15); - rgbsps_set(LED_J, 15, 0, 15); - rgbsps_set(LED_K, 15, 0, 15); - rgbsps_set(LED_L, 15, 0, 15); + // rgbsps_set(LED_I, 15, 0, 15); + // rgbsps_set(LED_J, 15, 0, 15); + // rgbsps_set(LED_K, 15, 0, 15); + // rgbsps_set(LED_L, 15, 0, 15); - rgbsps_set(LED_U, 15, 0, 0); - rgbsps_set(LED_O, 15, 0, 0); - rgbsps_set(LED_COMM, 15, 0, 0); - rgbsps_set(LED_DOT, 15, 0, 0); - rgbsps_set(LED_SCLN, 15, 0, 0); - rgbsps_set(LED_P, 15, 0, 0); + // rgbsps_set(LED_U, 15, 0, 0); + // rgbsps_set(LED_O, 15, 0, 0); + // rgbsps_set(LED_COMM, 15, 0, 0); + // rgbsps_set(LED_DOT, 15, 0, 0); + // rgbsps_set(LED_SCLN, 15, 0, 0); + // rgbsps_set(LED_P, 15, 0, 0); - rgbsps_set(LED_Q, 0, 15, 0); - rgbsps_set(LED_W, 0, 15, 0); - rgbsps_set(LED_E, 0, 15, 0); - rgbsps_set(LED_R, 0, 15, 0); - rgbsps_set(LED_A, 0, 15, 0); - rgbsps_set(LED_S, 0, 15, 0); - rgbsps_set(LED_D, 0, 15, 0); - rgbsps_set(LED_F, 0, 15, 0); - rgbsps_set(LED_Z, 0, 15, 0); - rgbsps_set(LED_X, 0, 15, 0); - rgbsps_set(LED_C, 0, 15, 0); - rgbsps_set(LED_V, 0, 15, 0); + // rgbsps_set(LED_Q, 0, 15, 0); + // rgbsps_set(LED_W, 0, 15, 0); + // rgbsps_set(LED_E, 0, 15, 0); + // rgbsps_set(LED_R, 0, 15, 0); + // rgbsps_set(LED_A, 0, 15, 0); + // rgbsps_set(LED_S, 0, 15, 0); + // rgbsps_set(LED_D, 0, 15, 0); + // rgbsps_set(LED_F, 0, 15, 0); + // rgbsps_set(LED_Z, 0, 15, 0); + // rgbsps_set(LED_X, 0, 15, 0); + // rgbsps_set(LED_C, 0, 15, 0); + // rgbsps_set(LED_V, 0, 15, 0); rgbsps_send(); } @@ -430,54 +430,54 @@ void led_layer_num(void) { led_reset(); - for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) { - rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 0, 0, 0); - } + // for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) { + // rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 0, 0, 0); + // } - rgbsps_set(LED_U, 0, 5, 15); - rgbsps_set(LED_I, 0, 5, 15); - rgbsps_set(LED_O, 0, 5, 15); - rgbsps_set(LED_J, 0, 5, 15); - rgbsps_set(LED_K, 0, 5, 15); - rgbsps_set(LED_L, 0, 5, 15); - rgbsps_set(LED_M, 0, 5, 15); - rgbsps_set(LED_COMM, 0, 5, 15); - rgbsps_set(LED_DOT, 0, 5, 15); - rgbsps_set(LED_FUNC, 0, 5, 15); + // rgbsps_set(LED_U, 0, 5, 15); + // rgbsps_set(LED_I, 0, 5, 15); + // rgbsps_set(LED_O, 0, 5, 15); + // rgbsps_set(LED_J, 0, 5, 15); + // rgbsps_set(LED_K, 0, 5, 15); + // rgbsps_set(LED_L, 0, 5, 15); + // rgbsps_set(LED_M, 0, 5, 15); + // rgbsps_set(LED_COMM, 0, 5, 15); + // rgbsps_set(LED_DOT, 0, 5, 15); + // rgbsps_set(LED_FUNC, 0, 5, 15); - rgbsps_set(LED_EMOJI, 0, 10, 15); - rgbsps_set(LED_RALT, 0, 10, 15); + // rgbsps_set(LED_EMOJI, 0, 10, 15); + // rgbsps_set(LED_RALT, 0, 10, 15); - rgbsps_set(LED_Q, 0, 10, 15); - rgbsps_set(LED_W, 0, 10, 15); - rgbsps_set(LED_E, 0, 10, 15); - rgbsps_set(LED_R, 0, 10, 15); - rgbsps_set(LED_T, 0, 10, 15); - rgbsps_set(LED_Y, 0, 10, 15); - rgbsps_set(LED_P, 0, 10, 15); + // rgbsps_set(LED_Q, 0, 10, 15); + // rgbsps_set(LED_W, 0, 10, 15); + // rgbsps_set(LED_E, 0, 10, 15); + // rgbsps_set(LED_R, 0, 10, 15); + // rgbsps_set(LED_T, 0, 10, 15); + // rgbsps_set(LED_Y, 0, 10, 15); + // rgbsps_set(LED_P, 0, 10, 15); - rgbsps_set(LED_A, 0, 15, 15); - rgbsps_set(LED_S, 0, 15, 15); - rgbsps_set(LED_D, 0, 15, 15); - rgbsps_set(LED_F, 0, 15, 15); - rgbsps_set(LED_Z, 0, 15, 15); - rgbsps_set(LED_X, 0, 15, 15); - rgbsps_set(LED_C, 0, 15, 15); - rgbsps_set(LED_V, 0, 15, 15); + // rgbsps_set(LED_A, 0, 15, 15); + // rgbsps_set(LED_S, 0, 15, 15); + // rgbsps_set(LED_D, 0, 15, 15); + // rgbsps_set(LED_F, 0, 15, 15); + // rgbsps_set(LED_Z, 0, 15, 15); + // rgbsps_set(LED_X, 0, 15, 15); + // rgbsps_set(LED_C, 0, 15, 15); + // rgbsps_set(LED_V, 0, 15, 15); rgbsps_send(); } void led_layer_emoji(void) { - for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) { - rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 15, 15, 0); - } - for(uint8_t i = 0; i < COUNT(LED_MODS); i++) { - rgbsps_set(pgm_read_byte(&LED_MODS[i]), 15, 15, 0); - } - for(uint8_t i = 0; i < COUNT(LED_FN); i++) { - rgbsps_set(pgm_read_byte(&LED_FN[i]), 15, 15, 0); - } + // for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) { + // rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 15, 15, 0); + // } + // for(uint8_t i = 0; i < COUNT(LED_MODS); i++) { + // rgbsps_set(pgm_read_byte(&LED_MODS[i]), 15, 15, 0); + // } + // for(uint8_t i = 0; i < COUNT(LED_FN); i++) { + // rgbsps_set(pgm_read_byte(&LED_FN[i]), 15, 15, 0); + // } rgbsps_set(LED_IND_FUNC, 0, 0, 0); rgbsps_set(LED_IND_NUM, 0, 0, 0); @@ -612,17 +612,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,-----------------------------------------------------------------------------------. * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | ` | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | \ | - | = | < | > | ( | ) | ' | | | + * | | | \ | - | = | | | ( | ) | < | > | | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | _ | + | { | } | [ | ] | " | | | + * | | | | | _ | + | | | [ | ] | { | } | | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' */ [_PUNC] = KEYMAP( KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_GRV , - XXXXXXX, XXXXXXX, KC_BSLS, KC_MINS, KC_EQL, KC_LABK, KC_RABK, KC_LPRN, KC_RPRN, KC_QUOT, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_LBRC, KC_RBRC, KC_DQUO, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, KC_BSLS, KC_MINS, KC_EQL, XXXXXXX, XXXXXXX, KC_LPRN, KC_RPRN, KC_LABK, KC_RABK, XXXXXXX, + XXXXXXX, XXXXXXX, KC_PIPE, KC_UNDS, KC_PLUS, XXXXXXX, XXXXXXX, KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ),