From c5ab0b2b61ca673b4bd8e03a767fcd91c3dee995 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Mon, 9 Jan 2017 19:35:01 +0700 Subject: Implement greek layers on my Promethium layout --- .../handwired/promethium/keymaps/priyadi/keymap.c | 187 ++++++++++++++++++++- 1 file changed, 182 insertions(+), 5 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 7ae269563..02ff57384 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); -- cgit v1.2.3 From 306f43e5eedb5b0a48cc9a83cd7ee8902dbc30d5 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Mon, 9 Jan 2017 21:24:26 +0700 Subject: fix greek layers --- keyboards/handwired/promethium/keymaps/priyadi/keymap.c | 8 ++++---- keyboards/handwired/promethium/promethium.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 02ff57384..4665e32af 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 662eeab99..a2572db2a 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, \ -- cgit v1.2.3 From 011811af68baa6d0103ab289ed4737991c24f9c4 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Mon, 9 Jan 2017 23:19:34 +0700 Subject: minimize LEDs --- .../handwired/promethium/keymaps/priyadi/keymap.c | 148 ++++++++++----------- 1 file changed, 74 insertions(+), 74 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 4665e32af..99948967b 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_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_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_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); - } - - 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_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); + // 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_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_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, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), -- cgit v1.2.3 From 4be4ed33970bbe5387e0004257d5fabc46a03d54 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Thu, 9 Feb 2017 01:40:22 +0700 Subject: Add USB-BLE manual output switching and indicator --- .../handwired/promethium/keymaps/priyadi/keymap.c | 56 +++++++++++++++++----- 1 file changed, 44 insertions(+), 12 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 99948967b..05cd2f061 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -13,6 +13,7 @@ #include "rgbsps.h" #include "ps2_mouse.h" #include "ps2.h" +#include "outputselect.h" #define COUNT(x) (sizeof (x) / sizeof (*(x))) // #define RGBLED_NUM 5 @@ -496,6 +497,24 @@ void led_layer_gui(void) { rgbsps_send(); } +void led_set_output_ble(void) { + rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 15); + rgbsps_set(LED_IND_USB, 0, 0, 0); + rgbsps_send(); +} + +void led_set_output_usb(void) { + rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 0); + rgbsps_set(LED_IND_USB, 15, 15, 15); + rgbsps_send(); +} + +void led_set_output_none(void) { + rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 0); + rgbsps_set(LED_IND_USB, 0, 0, 0); + rgbsps_send(); +} + void led_init(void) { // turn off all rgbsps_turnoff(); @@ -693,8 +712,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_GUI] = KEYMAP( _______, LGUI(KC_1),LGUI(KC_2),LGUI(KC_3),LGUI(KC_4),LGUI(KC_5),LGUI(KC_6),LGUI(KC_7),LGUI(KC_8),LGUI(KC_9),LGUI(KC_0), _______, - LINUX, _______, KC_VOLD, KC_MUTE, KC_VOLU,_______,_______,KC_WWW_BACK,_______,KC_WWW_FORWARD,KC_PAUS, QWERTY, - WIN, _______, KC_MPRV, KC_MPLY, KC_MNXT, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, COLEMAK, + LINUX, OUT_USB, KC_VOLD, KC_MUTE, KC_VOLU,_______,_______,KC_WWW_BACK,_______,KC_WWW_FORWARD,KC_PAUS, QWERTY, + WIN, OUT_BLE, KC_MPRV, KC_MPLY, KC_MNXT, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, COLEMAK, OSX, _______, _______, _______, _______, BL_DEC, BL_INC, _______, _______, RGB_VAI, RGB_VAD, WORKMAN ), @@ -908,23 +927,36 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } +void set_output_user(uint8_t output) { + switch(output) { + case OUTPUT_USB: + led_set_output_usb(); + break; + case OUTPUT_ADAFRUIT_BLE: + led_set_output_ble(); + break; + default: + led_set_output_none(); + } +} + void matrix_init_user(void) { + _delay_ms(500); // give time for usb to initialize + #ifdef AUDIO_ENABLE startup_user(); #endif set_unicode_input_mode(UC_LNX); led_init(); -} - -// void init_rgblight(void) { -// for (uint8_t i = 0; i < RGBLED_NUM; i++) { -// led[i].r = 255; -// led[i].g = 85; -// led[i].b = 0; -// } -// ws2812_setleds(led, RGBLED_NUM); -// } + // auto detect output on init + uint8_t output = auto_detect_output(); + if (output == OUTPUT_USB) { + set_output(OUTPUT_USB); + } else { + set_output(OUTPUT_ADAFRUIT_BLE); + } +} #ifdef AUDIO_ENABLE -- cgit v1.2.3 From 92308ed0e5ccac1aaeba6a952ccc2556dfffe4e0 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Fri, 10 Feb 2017 02:08:55 +0700 Subject: Remove audio stuff --- .../handwired/promethium/keymaps/priyadi/keymap.c | 60 ---------------------- 1 file changed, 60 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 05cd2f061..f2d7ebcb7 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -3,10 +3,6 @@ #include "promethium.h" #include "action_layer.h" -#ifdef AUDIO_ENABLE - #include "audio.h" - #include "musical_notes.h" -#endif #include "eeconfig.h" #include "process_unicode.h" #include "quantum.h" @@ -719,29 +715,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -#ifdef AUDIO_ENABLE -float tone_startup[][2] = SONG(STARTUP_SOUND); -float tone_qwerty[][2] = SONG(QWERTY_SOUND); -float tone_colemak[][2] = SONG(COLEMAK_SOUND); -float tone_workman[][2] = SONG(DVORAK_SOUND); -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); -float tone_linux[][2] = SONG(CAPS_LOCK_ON_SOUND); -float tone_windows[][2] = SONG(SCROLL_LOCK_ON_SOUND); -float tone_osx[][2] = SONG(NUM_LOCK_ON_SOUND); -float tone_click[][2] = SONG(MUSICAL_NOTE(_F3, 2)); -#endif - void persistant_default_layer_set(uint16_t default_layer) { eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - #ifdef AUDIO_ENABLE - // faux clicky - 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); @@ -813,27 +792,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // layout switchers case QWERTY: if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); - #endif persistant_default_layer_set(1UL<<_QWERTY); } return false; break; case COLEMAK: if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_colemak, false, 0); - #endif persistant_default_layer_set(1UL<<_COLEMAK); } return false; break; case WORKMAN: if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_workman, false, 0); - #endif persistant_default_layer_set(1UL<<_WORKMAN); } return false; @@ -904,23 +874,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // OS switchers case LINUX: set_unicode_input_mode(UC_LNX); - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_linux, false, 0); - #endif return false; break; case WIN: set_unicode_input_mode(UC_WINC); - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_windows, false, 0); - #endif return false; break; case OSX: set_unicode_input_mode(UC_OSX); - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_osx, false, 0); - #endif return false; break; } @@ -943,9 +904,6 @@ void set_output_user(uint8_t output) { void matrix_init_user(void) { _delay_ms(500); // give time for usb to initialize - #ifdef AUDIO_ENABLE - startup_user(); - #endif set_unicode_input_mode(UC_LNX); led_init(); @@ -958,24 +916,6 @@ void matrix_init_user(void) { } } -#ifdef AUDIO_ENABLE - -void startup_user() -{ - _delay_ms(20); // gets rid of tick - PLAY_NOTE_ARRAY(tone_startup, false, 0); -} - -void shutdown_user() -{ - PLAY_NOTE_ARRAY(tone_goodbye, false, 0); - _delay_ms(150); - stop_all_notes(); -} - -#endif - - void ps2_mouse_init_user() { uint8_t rcv; -- cgit v1.2.3 From af97d6b58ea7e2a445093eff5d757edc59dc0b57 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Fri, 10 Feb 2017 06:01:59 +0700 Subject: Add dvorak & norman layout. Add sys layer. --- .../handwired/promethium/keymaps/priyadi/keymap.c | 227 ++++++++++++++------- 1 file changed, 148 insertions(+), 79 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index f2d7ebcb7..3c48347d4 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -20,22 +20,30 @@ extern keymap_config_t keymap_config; enum layers { _QWERTY, + _DVORAK, _COLEMAK, _WORKMAN, + _NORMAN, + _PUNC, _NUM, _FUNC, - _EMOJI, + _GREEKU, _GREEKL, + + _EMOJI, _GUI, + _SYS, }; enum planck_keycodes { // layouts QWERTY = SAFE_RANGE, + DVORAK, COLEMAK, WORKMAN, + NORMAN, // layer switchers PUNC, @@ -269,9 +277,9 @@ 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) +// hybrid right-alt & scroll lock (mapped to Compose in OS) +#undef KC_RALT +#define KC_RALT MT(MOD_RALT, KC_SLCK) // RGBSPS @@ -537,18 +545,36 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,-----------------------------------------------------------------------------------. * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | S | D | F | G | H | J | K | L | ; |Enter | + * | Esc | A | S | D | F | G | H | J | K | L | ' |Enter | * |------+------+------+------+------+------|------+------+------+------+------+------| * | Shift| Z | X | C | V | B | N | M | , | . | / |Shift | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Emoji |Greek |AltGr | Ctrl | + * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |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_LALT, KC_LGUI, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, GREEK, KC_RALT, KC_RCTL + KC_LCTL, KC_LALT, KC_LGUI, PUNC, NUM, KC_SPC, KC_SPC, FUNC, GREEK, KC_RGUI, KC_RALT, KC_RCTL +), + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | Tab | ' | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S |Enter | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| / | Q | J | K | X | B | M | W | V | Z |Shift | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl | + * `-----------------------------------------------------------------------------------' + */ +[_DVORAK] = KEYMAP( + _______, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, _______, + _______, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, _______, + _______, KC_SLSH, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), /* Colemak @@ -559,7 +585,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------|------+------+------+------+------+------| * | Shift| Z | X | C | V | B | K | M | , | . | / |Shift | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl | + * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl | * `-----------------------------------------------------------------------------------' */ [_COLEMAK] = KEYMAP( @@ -569,57 +595,39 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), -/* Workman +/* Norman * ,-----------------------------------------------------------------------------------. - * | Tab | Q | D | R | W | B | J | F | U | P | ; | Bksp | + * | Tab | Q | W | D | F | K | J | U | R | L | ; | Bksp | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | S | H | T | G | Y | N | E | O | I |Enter | + * | Esc | A | S | E | T | G | Y | N | I | O | H |Enter | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | M | C | V | K | K | , | . | / |Shift | + * | Shift| Z | X | C | V | B | P | M | , | . | / |Shift | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl | + * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl | * `-----------------------------------------------------------------------------------' */ -[_WORKMAN] = KEYMAP( - _______, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, _______, - _______, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, _______, - _______, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______, +[_NORMAN] = KEYMAP( + _______, KC_Q, KC_W, KC_D, KC_F, KC_K, KC_J, KC_U, KC_R, KC_L, KC_QUOT, _______, + _______, KC_A, KC_S, KC_E, KC_T, KC_G, KC_Y, KC_N, KC_I, KC_O, KC_H, _______, + _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), -/* Uppercase Greek - * ,-----------------------------------------------------------------------------------. - * | | | | | | | | | | | | | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | | | | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | | - * `-----------------------------------------------------------------------------------' - */ -[_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 +/* Workman * ,-----------------------------------------------------------------------------------. - * | | | | | | | | | | | | | + * | Tab | Q | D | R | W | B | J | F | U | P | ; | Bksp | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | | | | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | | + * | Esc | A | S | H | T | G | Y | N | E | O | I |Enter | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | M | C | V | K | K | , | . | / |Shift | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | | + * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl | * `-----------------------------------------------------------------------------------' */ -[_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), _______, _______, _______, _______, +[_WORKMAN] = KEYMAP( + _______, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, _______, + _______, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, _______, + _______, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), @@ -677,6 +685,42 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +/* Uppercase Greek + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_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 + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_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), _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +), + /* Emoji * ,-----------------------------------------------------------------------------------. * | | | | | | | | | | | | | @@ -713,6 +757,24 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { OSX, _______, _______, _______, _______, BL_DEC, BL_INC, _______, _______, RGB_VAI, RGB_VAD, WORKMAN ), +/* GUI + * ,-----------------------------------------------------------------------------------. + * | |Qwerty| Win | | | | | USB | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | |Audio | |Dvorak| | Glow | | |WorkMn|Linux | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | |Colmak| | BLE |Norman|MacOS | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_SYS] = KEYMAP( + XXXXXXX, QWERTY, WIN, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, DVORAK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, WORKMAN, LINUX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, XXXXXXX, OUT_BLE, NORMAN, OSX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +), + }; void persistant_default_layer_set(uint16_t default_layer) { @@ -725,22 +787,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { 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; - + // handle greek layer shift case KC_LSFT: case KC_RSFT: ; @@ -750,7 +797,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { layer_on(_GREEKU); layer_off(_GREEKL); } else { - if (lshifted ^ rshifted) { // if only one shift is pressed + if (lshifted ^ rshifted) { // if only one shift was pressed layer_on(_GREEKL); layer_off(_GREEKU); } @@ -796,6 +843,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; + case DVORAK: + if (record->event.pressed) { + persistant_default_layer_set(1UL<<_DVORAK); + } + return false; + break; case COLEMAK: if (record->event.pressed) { persistant_default_layer_set(1UL<<_COLEMAK); @@ -808,48 +861,63 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; + case NORMAN: + if (record->event.pressed) { + persistant_default_layer_set(1UL<<_NORMAN); + } + return false; + break; // layer switcher case PUNC: if (record->event.pressed) { layer_on(_PUNC); - update_tri_layer(_PUNC, _EMOJI, _GUI); - if (IS_LAYER_ON(_GUI)) { - led_layer_gui(); + update_tri_layer(_PUNC, _GREEKL, _EMOJI); + if (IS_LAYER_ON(_EMOJI)) { + led_layer_emoji(); } else { - led_layer_punc();; + led_layer_punc(); } } else { layer_off(_PUNC); - update_tri_layer(_PUNC, _EMOJI, _GUI); - if (IS_LAYER_ON(_EMOJI)) { - led_layer_emoji(); + update_tri_layer(_PUNC, _GREEKL, _EMOJI); + if (IS_LAYER_ON(_GREEKL)) { + ; } else { - led_layer_normal();; + led_layer_normal(); } } return false; break; - case EMOJI: + + case GREEK: if (record->event.pressed) { - layer_on(_EMOJI); - update_tri_layer(_PUNC, _EMOJI, _GUI); - if (IS_LAYER_ON(_GUI)) { - led_layer_gui(); + if (lshifted || rshifted) { + layer_on(_GREEKU); + layer_off(_GREEKL); } else { - led_layer_emoji();; + layer_on(_GREEKL); + layer_off(_GREEKU); + update_tri_layer(_PUNC, _GREEKL, _EMOJI); + if (IS_LAYER_ON(_EMOJI)) { + led_layer_emoji(); + } else { + ; + } } } else { - layer_off(_EMOJI); - update_tri_layer(_PUNC, _EMOJI, _GUI); + layer_off(_GREEKU); + layer_off(_GREEKL); + update_tri_layer(_PUNC, _GREEKL, _EMOJI); if (IS_LAYER_ON(_PUNC)) { led_layer_punc(); } else { - led_layer_normal();; + led_layer_normal(); } } return false; break; + case NUM: if (record->event.pressed) { layer_on(_NUM); @@ -860,6 +928,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; + case FUNC: if (record->event.pressed) { layer_on(_FUNC); -- cgit v1.2.3 From dee6a6982cdc8ee7970d1c61f7b7b4799b0f777b Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Fri, 10 Feb 2017 06:31:29 +0700 Subject: Fix LED indicator --- keyboards/handwired/promethium/keymaps/priyadi/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 3c48347d4..082997ad6 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -882,7 +882,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { layer_off(_PUNC); update_tri_layer(_PUNC, _GREEKL, _EMOJI); if (IS_LAYER_ON(_GREEKL)) { - ; + led_layer_normal(); } else { led_layer_normal(); } -- cgit v1.2.3 From 27e7eac279b7f0f8c62a213444e1dd02968bd720 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Fri, 10 Feb 2017 06:51:10 +0700 Subject: Reorganize punctuation & numbers layer --- .../handwired/promethium/keymaps/priyadi/keymap.c | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 082997ad6..fa3e21d72 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -635,36 +635,36 @@ 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, 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, + XXXXXXX, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, XXXXXXX, XXXXXXX, KC_LPRN, KC_RPRN, KC_LABK, KC_RABK, XXXXXXX, + KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, XXXXXXX, XXXXXXX, KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, KC_COLN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), /* Num * ,-----------------------------------------------------------------------------------. - * | ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * | ~ | ! | @ | # | $ | % | A | 7 | 8 | 9 | D | ` | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | @ | A | B | C | ( | ) | 4 | 5 | 6 | : |Enter | + * | | * | \ | - | = | | B | 4 | 5 | 6 | E | | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | & | # | D | E | F | [ | ] | 1 | 2 | 3 | / | * | + * | & | ^ | | | _ | + | | C | 1 | 2 | 3 | F | : | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | x | | | 0 | , | . | + | - | + * | | | | | | | x | 0 | , | . | | | * `-----------------------------------------------------------------------------------' */ [_NUM] = KEYMAP( - KC_CIRC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, - KC_ESC, KC_AT, S(KC_A), S(KC_B), S(KC_C), KC_LPRN, KC_RPRN, KC_4, KC_5, KC_6, KC_COLN, KC_ENT, - KC_AMPR, KC_HASH, S(KC_D), S(KC_E), S(KC_F), KC_LBRC, KC_RBRC, KC_1, KC_2, KC_3, KC_SLSH, KC_ASTR, - _______, _______, _______, KC_X, _______, KC_SPC, KC_SPC, KC_0, KC_COMM, KC_DOT, KC_PLUS, KC_MINS + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, S(KC_A), KC_7, KC_8, KC_9, S(KC_D), KC_GRV, + XXXXXXX, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, XXXXXXX, S(KC_B), KC_4, KC_5, KC_6, S(KC_E), _______, + KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, XXXXXXX, S(KC_C), KC_1, KC_2, KC_3, S(KC_F), KC_COLN, + _______, _______, _______, _______, _______, _______, KC_X, KC_0, KC_COMM, KC_DOT, _______, _______ ), /* Func -- cgit v1.2.3 From a4a57d47eda4cae27dd56204a8bf36d3dac8e663 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Fri, 10 Feb 2017 13:13:04 +0700 Subject: Reimplement GUI Layer --- .../handwired/promethium/keymaps/priyadi/keymap.c | 41 +++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index fa3e21d72..9605c493c 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -63,6 +63,7 @@ enum planck_keycodes { #define _______ KC_TRNS #define XXXXXXX KC_NO +#define G(x) LGUI(x) // unicode map @@ -741,23 +742,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* GUI * ,-----------------------------------------------------------------------------------. - * | | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 | D10 | | + * | | | | | | | | | | | | | * |------+------+------+------+------+-------------+------+------+------+------+------| - * |Linux | | Vol- | Mute | Vol+ | | | D- | | D+ | |Qwerty| + * | | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 | D10 | | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Win | | Prev | Play | Next | | | | | | |Colmak| + * | | | | | | | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | OSX | | | | | BL- | BL+ | | | | |Workmn| + * | | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' */ [_GUI] = KEYMAP( - _______, LGUI(KC_1),LGUI(KC_2),LGUI(KC_3),LGUI(KC_4),LGUI(KC_5),LGUI(KC_6),LGUI(KC_7),LGUI(KC_8),LGUI(KC_9),LGUI(KC_0), _______, - LINUX, OUT_USB, KC_VOLD, KC_MUTE, KC_VOLU,_______,_______,KC_WWW_BACK,_______,KC_WWW_FORWARD,KC_PAUS, QWERTY, - WIN, OUT_BLE, KC_MPRV, KC_MPLY, KC_MNXT, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, COLEMAK, - OSX, _______, _______, _______, _______, BL_DEC, BL_INC, _______, _______, RGB_VAI, RGB_VAD, WORKMAN + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, G(KC_1), G(KC_2), G(KC_3), G(KC_4), G(KC_5), G(KC_6), G(KC_7), G(KC_8), G(KC_9), G(KC_0), XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX ), -/* GUI +/* Sys * ,-----------------------------------------------------------------------------------. * | |Qwerty| Win | | | | | USB | | | | | * |------+------+------+------+------+-------------+------+------+------+------+------| @@ -772,7 +773,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { XXXXXXX, QWERTY, WIN, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DVORAK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, WORKMAN, LINUX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, XXXXXXX, OUT_BLE, NORMAN, OSX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______ ), }; @@ -872,15 +873,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case PUNC: if (record->event.pressed) { layer_on(_PUNC); - update_tri_layer(_PUNC, _GREEKL, _EMOJI); - if (IS_LAYER_ON(_EMOJI)) { - led_layer_emoji(); + update_tri_layer(_PUNC, _GREEKL, _GUI); + if (IS_LAYER_ON(_GUI)) { + led_layer_normal(); } else { led_layer_punc(); } } else { layer_off(_PUNC); - update_tri_layer(_PUNC, _GREEKL, _EMOJI); + update_tri_layer(_PUNC, _GREEKL, _GUI); if (IS_LAYER_ON(_GREEKL)) { led_layer_normal(); } else { @@ -898,19 +899,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } else { layer_on(_GREEKL); layer_off(_GREEKU); - update_tri_layer(_PUNC, _GREEKL, _EMOJI); - if (IS_LAYER_ON(_EMOJI)) { - led_layer_emoji(); + update_tri_layer(_PUNC, _GREEKL, _GUI); + if (IS_LAYER_ON(_GUI)) { + led_layer_normal(); } else { - ; + led_layer_normal(); } } } else { layer_off(_GREEKU); layer_off(_GREEKL); - update_tri_layer(_PUNC, _GREEKL, _EMOJI); + update_tri_layer(_PUNC, _GREEKL, _GUI); if (IS_LAYER_ON(_PUNC)) { - led_layer_punc(); + led_layer_normal(); } else { led_layer_normal(); } -- cgit v1.2.3 From 0f92d305e267bbf399913d3631007aac885df88d Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Fri, 10 Feb 2017 14:32:24 +0700 Subject: Add slash/question mark to punc/num layer --- .../handwired/promethium/keymaps/priyadi/keymap.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 9605c493c..80224b93a 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -636,17 +636,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, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, XXXXXXX, XXXXXXX, KC_LPRN, KC_RPRN, KC_LABK, KC_RABK, XXXXXXX, - KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, XXXXXXX, XXXXXXX, KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, KC_COLN, + XXXXXXX, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, XXXXXXX, KC_LPRN, KC_RPRN, KC_LABK, KC_RABK, XXXXXXX, + KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, XXXXXXX, KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, KC_COLN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), @@ -654,17 +654,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,-----------------------------------------------------------------------------------. * | ~ | ! | @ | # | $ | % | A | 7 | 8 | 9 | D | ` | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | * | \ | - | = | | B | 4 | 5 | 6 | E | | + * | | * | \ | - | = | / | B | 4 | 5 | 6 | E | | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | & | ^ | | | _ | + | | C | 1 | 2 | 3 | F | : | + * | & | ^ | | | _ | + | ? | C | 1 | 2 | 3 | F | : | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | x | 0 | , | . | | | * `-----------------------------------------------------------------------------------' */ [_NUM] = KEYMAP( KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, S(KC_A), KC_7, KC_8, KC_9, S(KC_D), KC_GRV, - XXXXXXX, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, XXXXXXX, S(KC_B), KC_4, KC_5, KC_6, S(KC_E), _______, - KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, XXXXXXX, S(KC_C), KC_1, KC_2, KC_3, S(KC_F), KC_COLN, + XXXXXXX, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, S(KC_B), KC_4, KC_5, KC_6, S(KC_E), _______, + KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, S(KC_C), KC_1, KC_2, KC_3, S(KC_F), KC_COLN, _______, _______, _______, _______, _______, _______, KC_X, KC_0, KC_COMM, KC_DOT, _______, _______ ), @@ -752,9 +752,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_GUI] = KEYMAP( - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, G(KC_1), G(KC_2), G(KC_3), G(KC_4), G(KC_5), G(KC_6), G(KC_7), G(KC_8), G(KC_9), G(KC_0), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX ), -- cgit v1.2.3 From 4ffbfe829862bb6cc23202ced13da2672c490f5b Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Fri, 10 Feb 2017 14:43:56 +0700 Subject: Restore GUI layer --- .../handwired/promethium/keymaps/priyadi/keymap.c | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 80224b93a..c06fb7e78 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -12,9 +12,13 @@ #include "outputselect.h" #define COUNT(x) (sizeof (x) / sizeof (*(x))) -// #define RGBLED_NUM 5 -// struct cRGB led[RGBLED_NUM]; +// Fillers to make layering clearer +#define _______ KC_TRNS +#define XXXXXXX KC_NO +#define G(x) LGUI(x) +#define KC_WWWB KC_WWW_BACK +#define KC_WWWF KC_WWW_FORWARD extern keymap_config_t keymap_config; @@ -59,12 +63,6 @@ enum planck_keycodes { OSX, }; -// Fillers to make layering clearer - -#define _______ KC_TRNS -#define XXXXXXX KC_NO -#define G(x) LGUI(x) - // unicode map enum unicode_name { @@ -742,19 +740,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* GUI * ,-----------------------------------------------------------------------------------. - * | | | | | | | | | | | | | - * |------+------+------+------+------+-------------+------+------+------+------+------| * | | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 | D10 | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | Vol- | Mute | Vol+ | | | Prev | | Next | | | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | | + * | | | Prev | Play | Next | | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' */ [_GUI] = KEYMAP( XXXXXXX, G(KC_1), G(KC_2), G(KC_3), G(KC_4), G(KC_5), G(KC_6), G(KC_7), G(KC_8), G(KC_9), G(KC_0), XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, KC_VOLD, KC_MUTE, KC_VOLU, XXXXXXX, XXXXXXX, KC_WWWB, XXXXXXX, KC_WWWF, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX ), -- cgit v1.2.3 From a5b8db52a046e803c21146402e1d009f31b91508 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Fri, 10 Feb 2017 17:11:52 +0700 Subject: Activate SYS layer by pressing both Ctrls --- .../handwired/promethium/keymaps/priyadi/keymap.c | 34 ++++++++++++++++------ 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index c06fb7e78..eee859e31 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -782,8 +782,8 @@ void persistant_default_layer_set(uint16_t default_layer) { } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - bool lshifted = keyboard_report->mods & MOD_BIT(KC_LSFT); - bool rshifted = keyboard_report->mods & MOD_BIT(KC_RSFT); + bool lshift = keyboard_report->mods & MOD_BIT(KC_LSFT); + bool rshift = keyboard_report->mods & MOD_BIT(KC_RSFT); switch (keycode) { // handle greek layer shift @@ -796,7 +796,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { layer_on(_GREEKU); layer_off(_GREEKL); } else { - if (lshifted ^ rshifted) { // if only one shift was pressed + if (lshift ^ rshift) { // if only one shift was pressed layer_on(_GREEKL); layer_off(_GREEKU); } @@ -805,16 +805,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; break; + // press both ctrls to activate SYS layer + case KC_LCTL: + case KC_RCTL: + ; + bool lctrl = keyboard_report->mods & MOD_BIT(KC_LCTL); + bool rctrl = keyboard_report->mods & MOD_BIT(KC_RCTL); + if (record->event.pressed) { + if (lctrl ^ rctrl) { // if only one ctrl was pressed + layer_on(_SYS); + } + } else { + layer_off(_SYS); + } + return true; + break; + // QWERTZ style comma and dot: semicolon and colon when shifted case KC_COMM: if (record->event.pressed) { - if (lshifted || rshifted) { - if (lshifted) unregister_code(KC_LSFT); - if (rshifted) unregister_code(KC_RSFT); + if (lshift || rshift) { + if (lshift) unregister_code(KC_LSFT); + if (rshift) unregister_code(KC_RSFT); register_code(KC_SCLN); unregister_code(KC_SCLN); - if (lshifted) register_code(KC_LSFT); - if (rshifted) register_code(KC_RSFT); + if (lshift) register_code(KC_LSFT); + if (rshift) register_code(KC_RSFT); } else { register_code(KC_COMM); unregister_code(KC_COMM); @@ -891,7 +907,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case GREEK: if (record->event.pressed) { - if (lshifted || rshifted) { + if (lshift || rshift) { layer_on(_GREEKU); layer_off(_GREEKL); } else { -- cgit v1.2.3 From 07879bf66b29535214a147b1797f96767b1faa58 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Fri, 10 Feb 2017 17:45:12 +0700 Subject: Add function to cycle backlight modes --- .../handwired/promethium/keymaps/priyadi/keymap.c | 152 ++++++++++----------- 1 file changed, 74 insertions(+), 78 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index eee859e31..65fa14dd3 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -20,6 +20,13 @@ #define KC_WWWB KC_WWW_BACK #define KC_WWWF KC_WWW_FORWARD +enum glow_modes { + GLOW_NONE, + GLOW_MIN, + GLOW_FULL +}; +uint8_t glow_mode = GLOW_MIN; + extern keymap_config_t keymap_config; enum layers { @@ -61,6 +68,10 @@ enum planck_keycodes { LINUX, WIN, OSX, + + // others + GLOW, + AUDIO }; // unicode map @@ -317,6 +328,17 @@ const uint8_t PROGMEM LED_ALNUM[] = { LED_RSPC }; +const uint8_t PROGMEM LED_HOMING[] = { + LED_A, + LED_S, + LED_D, + LED_F, + LED_J, + LED_K, + LED_L, + LED_SCLN +}; + const uint8_t PROGMEM LED_MODS[] = { LED_TAB, LED_ESC, @@ -354,20 +376,50 @@ const uint8_t PROGMEM LED_TRACKPOINT[] = { LED_TRACKPOINT3, }; -void led_reset(void) { +void led_turnoff_keys(void) { 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_MODS); i++) { 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]), 0, 0, 0); } } +void led_reset(void) { + switch (glow_mode) { + case GLOW_NONE: + led_turnoff_keys(); + break; + case GLOW_MIN: + led_turnoff_keys(); + for(uint8_t i = 0; i < COUNT(LED_HOMING); i++) { + rgbsps_set(pgm_read_byte(&LED_HOMING[i]), 8, 8, 8); + } + rgbsps_set(LED_F, 15, 0, 0); + rgbsps_set(LED_J, 15, 0, 0); + break; + case GLOW_FULL: + for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) { + rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 8, 8, 8); + } + for(uint8_t i = 0; i < COUNT(LED_MODS); i++) { + rgbsps_set(pgm_read_byte(&LED_MODS[i]), 0, 15, 0); + } + for(uint8_t i = 0; i < COUNT(LED_FN); i++) { + rgbsps_set(pgm_read_byte(&LED_FN[i]), 0, 0, 15); + } + for(uint8_t i = 0; i < COUNT(LED_HOMING); i++) { + rgbsps_set(pgm_read_byte(&LED_HOMING[i]), 15, 0, 0); + } + rgbsps_set(LED_F, 15, 15, 0); + rgbsps_set(LED_J, 15, 15, 0); + break; + } +} + void led_layer_normal(void) { rgbsps_set(LED_IND_FUNC, 0, 0, 0); rgbsps_set(LED_IND_NUM, 0, 0, 0); @@ -385,35 +437,6 @@ void led_layer_func(void) { led_reset(); - for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) { - 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_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_send(); } @@ -434,55 +457,10 @@ 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); - // } - - // 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_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_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); - // } - rgbsps_set(LED_IND_FUNC, 0, 0, 0); rgbsps_set(LED_IND_NUM, 0, 0, 0); rgbsps_set(LED_IND_EMOJI, 15, 15, 0); @@ -769,7 +747,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_SYS] = KEYMAP( XXXXXXX, QWERTY, WIN, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, DVORAK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, WORKMAN, LINUX, XXXXXXX, XXXXXXX, + XXXXXXX, AUDIO, XXXXXXX, DVORAK, XXXXXXX, GLOW, XXXXXXX, XXXXXXX, WORKMAN, LINUX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, XXXXXXX, OUT_BLE, NORMAN, OSX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______ ), @@ -968,6 +946,24 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { set_unicode_input_mode(UC_OSX); return false; break; + + // glow mode changer + case GLOW: + if (record->event.pressed) { + glow_mode++; + if (glow_mode > GLOW_FULL) { + glow_mode = GLOW_NONE; + } + led_reset(); + rgbsps_send(); + } + return false; + break; + + // faux clicky toggle, TBD + case AUDIO: + return false; + break; } return true; } -- cgit v1.2.3 From 5944ab246a981d6ceca94b0972345277a746c2d3 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Fri, 10 Feb 2017 21:28:46 +0700 Subject: Implement battery level indicator --- .../handwired/promethium/keymaps/priyadi/keymap.c | 11 ++--- keyboards/handwired/promethium/promethium.c | 34 ++++++++++++++- keyboards/handwired/promethium/promethium.h | 6 ++- keyboards/handwired/promethium/rgbsps.c | 51 +++++++++++++++++++++- keyboards/handwired/promethium/rgbsps.h | 3 +- keyboards/handwired/promethium/rules.mk | 3 +- 6 files changed, 97 insertions(+), 11 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 65fa14dd3..469d7a5d8 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -25,6 +25,7 @@ enum glow_modes { GLOW_MIN, GLOW_FULL }; + uint8_t glow_mode = GLOW_MIN; extern keymap_config_t keymap_config; @@ -505,11 +506,6 @@ void led_init(void) { rgbsps_set(LED_TRACKPOINT2, 0, 0, 15); rgbsps_set(LED_TRACKPOINT3, 15, 0, 0); - // // hardcode indicator for now - rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 15); - rgbsps_set(LED_IND_USB, 15, 15, 15); - rgbsps_set(LED_IND_BATTERY, 0, 15, 0); - led_layer_normal(); } @@ -996,6 +992,11 @@ void matrix_init_user(void) { } } +void battery_poll(float percentage) { + rgbsps_sethsv(LED_IND_BATTERY, percentage*120/100, 255, 15); + rgbsps_send(); +} + void ps2_mouse_init_user() { uint8_t rcv; diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c index a0035cce1..7f876c756 100644 --- a/keyboards/handwired/promethium/promethium.c +++ b/keyboards/handwired/promethium/promethium.c @@ -1,6 +1,36 @@ #include "promethium.h" +#include "analog.h" +#include "timer.h" +#include "matrix.h" -void matrix_init_kb(void) { +float battery_percentage(void) { + float voltage = analogRead(BATTERY_PIN) * 2 * 3.3 / 1024; + float percentage = (voltage - 3.5) * 143; + if (percentage > 100) { + return 100; + } else if (percentage < 0) { + return 0; + } else { + return percentage; + } +} + +__attribute__ ((weak)) +void battery_poll(float percentage) { +} +void matrix_init_kb(void) { matrix_init_user(); -} \ No newline at end of file +} + +void matrix_scan_kb(void) { + static uint16_t counter = BATTERY_POLL; + counter++; + + if (counter > BATTERY_POLL) { + counter = 0; + battery_poll(battery_percentage()); + } +} + + diff --git a/keyboards/handwired/promethium/promethium.h b/keyboards/handwired/promethium/promethium.h index a2572db2a..6d51f81ca 100644 --- a/keyboards/handwired/promethium/promethium.h +++ b/keyboards/handwired/promethium/promethium.h @@ -5,6 +5,8 @@ #define PS2_INIT_DELAY 2000 #define UNICODE_TYPE_DELAY 0 +#define BATTERY_PIN 9 +#define BATTERY_POLL 30000 #define KEYMAP( \ k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \ @@ -23,6 +25,8 @@ {k47, k48, k49, k4a, k4b, k4c} \ } + + enum led_sequence { LED_IND_BLUETOOTH, LED_IND_USB, @@ -99,4 +103,4 @@ enum led_sequence { #endif - +void battery_poll(float percentage); \ No newline at end of file diff --git a/keyboards/handwired/promethium/rgbsps.c b/keyboards/handwired/promethium/rgbsps.c index ea922ec3f..f30badd35 100644 --- a/keyboards/handwired/promethium/rgbsps.c +++ b/keyboards/handwired/promethium/rgbsps.c @@ -21,4 +21,53 @@ void rgbsps_turnoff(void) { void rgbsps_send(void) { ws2812_setleds(led, RGBSPS_NUM); -} \ No newline at end of file +} + +void rgbsps_sethsv(uint8_t index, uint16_t hue, uint8_t sat, uint8_t val) { + uint8_t r = 0, g = 0, b = 0, base, color; + + if (sat == 0) { // Acromatic color (gray). Hue doesn't mind. + r = val; + g = val; + b = val; + } else { + base = ((255 - sat) * val) >> 8; + color = (val - base) * (hue % 60) / 60; + + switch (hue / 60) { + case 0: + r = val; + g = base + color; + b = base; + break; + case 1: + r = val - color; + g = val; + b = base; + break; + case 2: + r = base; + g = val; + b = base + color; + break; + case 3: + r = base; + g = val - color; + b = val; + break; + case 4: + r = base + color; + g = base; + b = val; + break; + case 5: + r = val; + g = base; + b = val - color; + break; + } + } + + rgbsps_set(index, r, g, b); +} + diff --git a/keyboards/handwired/promethium/rgbsps.h b/keyboards/handwired/promethium/rgbsps.h index 6da197f75..72612a7a8 100644 --- a/keyboards/handwired/promethium/rgbsps.h +++ b/keyboards/handwired/promethium/rgbsps.h @@ -1,4 +1,5 @@ void rgbsps_set(uint8_t index, uint8_t r, uint8_t g, uint8_t b); void rgbsps_setall(uint8_t r, uint8_t g, uint8_t b); void rgbsps_turnoff(void); -void rgbsps_send(void); \ No newline at end of file +void rgbsps_send(void); +void rgbsps_sethsv(uint8_t index, uint16_t hue, uint8_t sat, uint8_t val); \ No newline at end of file diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk index 465ef3359..e75cf4dde 100644 --- a/keyboards/handwired/promethium/rules.mk +++ b/keyboards/handwired/promethium/rules.mk @@ -72,4 +72,5 @@ API_SYSEX_ENABLE ?= no SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend SRC += $(QUANTUM_DIR)/light_ws2812.c -SRC += rgbsps.c \ No newline at end of file +SRC += rgbsps.c +SRC += $(QUANTUM_DIR)/analog.c \ No newline at end of file -- cgit v1.2.3 From 229e38f097448c61b2311c00837362fe5de17889 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Fri, 10 Feb 2017 22:15:15 +0700 Subject: Add ifdefs for keyboard layouts --- .../handwired/promethium/keymaps/priyadi/config.h | 5 +++ .../handwired/promethium/keymaps/priyadi/keymap.c | 37 ++++++++++++++-------- 2 files changed, 29 insertions(+), 13 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/config.h b/keyboards/handwired/promethium/keymaps/priyadi/config.h index 8b78c0dc4..36baedd48 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/config.h +++ b/keyboards/handwired/promethium/keymaps/priyadi/config.h @@ -14,4 +14,9 @@ #define RGB_DI_PIN B5 #define RGBSPS_NUM 57 +#define LAYOUT_DVORAK +#define LAYOUT_COLEMAK +#define LAYOUT_NORMAN +#define LAYOUT_WORKMAN + #endif diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 469d7a5d8..1e5e497df 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -13,19 +13,22 @@ #define COUNT(x) (sizeof (x) / sizeof (*(x))) // Fillers to make layering clearer - #define _______ KC_TRNS #define XXXXXXX KC_NO #define G(x) LGUI(x) #define KC_WWWB KC_WWW_BACK #define KC_WWWF KC_WWW_FORWARD +// hybrid right-alt & scroll lock (mapped to Compose in OS) +#undef KC_RALT +#define KC_RALT MT(MOD_RALT, KC_SLCK) + +// glow enum glow_modes { GLOW_NONE, GLOW_MIN, GLOW_FULL }; - uint8_t glow_mode = GLOW_MIN; extern keymap_config_t keymap_config; @@ -281,17 +284,6 @@ const uint32_t PROGMEM unicode_map[] = { [FSIGM] = 0x03C2, }; - -// hybrid shift - = -// #undef KC_LSFT -// #define KC_LSFT MT(MOD_LSFT, KC_MINS) -// #undef KC_RSFT -// #define KC_RSFT MT(MOD_LSFT, KC_EQL) - -// hybrid right-alt & scroll lock (mapped to Compose in OS) -#undef KC_RALT -#define KC_RALT MT(MOD_RALT, KC_SLCK) - // RGBSPS const uint8_t PROGMEM LED_ALNUM[] = { @@ -543,12 +535,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl | * `-----------------------------------------------------------------------------------' */ +#ifdef LAYOUT_DVORAK [_DVORAK] = KEYMAP( _______, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, _______, _______, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, _______, _______, KC_SLSH, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +#endif /* Colemak * ,-----------------------------------------------------------------------------------. @@ -561,12 +555,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl | * `-----------------------------------------------------------------------------------' */ + +#ifdef LAYOUT_COLEMAK [_COLEMAK] = KEYMAP( _______, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, _______, _______, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, _______, _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +#endif /* Norman * ,-----------------------------------------------------------------------------------. @@ -579,12 +576,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl | * `-----------------------------------------------------------------------------------' */ + +#ifdef LAYOUT_NORMAN [_NORMAN] = KEYMAP( _______, KC_Q, KC_W, KC_D, KC_F, KC_K, KC_J, KC_U, KC_R, KC_L, KC_QUOT, _______, _______, KC_A, KC_S, KC_E, KC_T, KC_G, KC_Y, KC_N, KC_I, KC_O, KC_H, _______, _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +#endif /* Workman * ,-----------------------------------------------------------------------------------. @@ -597,12 +597,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl | * `-----------------------------------------------------------------------------------' */ + +#ifdef LAYOUT_WORKMAN [_WORKMAN] = KEYMAP( _______, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, _______, _______, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, _______, _______, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +#endif /* Punc * ,-----------------------------------------------------------------------------------. @@ -832,30 +835,38 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; +#ifdef LAYOUT_DVORAK case DVORAK: if (record->event.pressed) { persistant_default_layer_set(1UL<<_DVORAK); } return false; break; +#endif +#ifdef LAYOUT_COLEMAK case COLEMAK: if (record->event.pressed) { persistant_default_layer_set(1UL<<_COLEMAK); } return false; break; +#endif +#ifdef LAYOUT_WORKMAN case WORKMAN: if (record->event.pressed) { persistant_default_layer_set(1UL<<_WORKMAN); } return false; break; +#endif +#ifdef LAYOUT_NORMAN case NORMAN: if (record->event.pressed) { persistant_default_layer_set(1UL<<_NORMAN); } return false; break; +#endif // layer switcher case PUNC: -- cgit v1.2.3 From 909fd4ae64432206e80925f12268c17ea7f2f68f Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 11 Feb 2017 00:07:10 +0700 Subject: Generalize layer indicators --- .../handwired/promethium/keymaps/priyadi/keymap.c | 142 +++++++++------------ keyboards/handwired/promethium/promethium.c | 2 + 2 files changed, 61 insertions(+), 83 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 1e5e497df..72b625357 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -413,61 +413,43 @@ void led_reset(void) { } } -void led_layer_normal(void) { - rgbsps_set(LED_IND_FUNC, 0, 0, 0); - rgbsps_set(LED_IND_NUM, 0, 0, 0); - rgbsps_set(LED_IND_EMOJI, 0, 0, 0); - - led_reset(); - - rgbsps_send(); -} +void led_set_layer_indicator(void) { + static uint8_t oldlayer = 255; -void led_layer_func(void) { - rgbsps_set(LED_IND_FUNC, 0, 15, 0); + rgbsps_set(LED_IND_FUNC, 0, 0, 0); rgbsps_set(LED_IND_NUM, 0, 0, 0); rgbsps_set(LED_IND_EMOJI, 0, 0, 0); led_reset(); - rgbsps_send(); -} - -void led_layer_punc(void) { - rgbsps_set(LED_IND_FUNC, 0, 15, 0); - rgbsps_set(LED_IND_NUM, 0, 0, 15); - rgbsps_set(LED_IND_EMOJI, 0, 0, 0); - - led_reset(); - - rgbsps_send(); -} - -void led_layer_num(void) { - rgbsps_set(LED_IND_FUNC, 0, 0, 0); - rgbsps_set(LED_IND_NUM, 0, 0, 15); - rgbsps_set(LED_IND_EMOJI, 0, 0, 0); - - led_reset(); + uint8_t layer = biton32(layer_state); + if (oldlayer == layer) { + return; + } - rgbsps_send(); -} + oldlayer = layer; -void led_layer_emoji(void) { - rgbsps_set(LED_IND_FUNC, 0, 0, 0); - rgbsps_set(LED_IND_NUM, 0, 0, 0); - rgbsps_set(LED_IND_EMOJI, 15, 15, 0); - - rgbsps_set(LED_PUNC, 15, 15, 15); - rgbsps_set(LED_EMOJI, 15, 15, 15); + if (layer <= _NORMAN) { + rgbsps_send(); + return; + } - rgbsps_send(); -} + switch(layer) { + case _FUNC: + rgbsps_set(LED_IND_FUNC, 15, 0, 0); + break; + case _NUM: + rgbsps_set(LED_IND_NUM, 0, 0, 15); + break; + case _EMOJI: + rgbsps_set(LED_IND_EMOJI, 15, 15, 0); + break; + default: + rgbsps_set(LED_IND_FUNC, 3, 3, 3); + rgbsps_set(LED_IND_NUM, 3, 3, 3); + rgbsps_set(LED_IND_EMOJI, 3, 3, 3); + } -void led_layer_gui(void) { - rgbsps_set(LED_IND_FUNC, 15, 10, 15); - rgbsps_set(LED_IND_NUM, 15, 10, 15); - rgbsps_set(LED_IND_EMOJI, 15, 10, 15); rgbsps_send(); } @@ -497,8 +479,6 @@ void led_init(void) { rgbsps_set(LED_TRACKPOINT1, 15, 0, 0); rgbsps_set(LED_TRACKPOINT2, 0, 0, 15); rgbsps_set(LED_TRACKPOINT3, 15, 0, 0); - - led_layer_normal(); } @@ -798,6 +778,22 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; break; + // press both Supers to activate EMOJI layer + case KC_LGUI: + case KC_RGUI: + ; + bool lgui = keyboard_report->mods & MOD_BIT(KC_LGUI); + bool rgui = keyboard_report->mods & MOD_BIT(KC_RGUI); + if (record->event.pressed) { + if (lgui ^ rgui) { // if only one super was pressed + layer_on(_EMOJI); + } + } else { + layer_off(_EMOJI); + } + return true; + break; + // QWERTZ style comma and dot: semicolon and colon when shifted case KC_COMM: if (record->event.pressed) { @@ -873,19 +869,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { layer_on(_PUNC); update_tri_layer(_PUNC, _GREEKL, _GUI); - if (IS_LAYER_ON(_GUI)) { - led_layer_normal(); - } else { - led_layer_punc(); - } } else { layer_off(_PUNC); update_tri_layer(_PUNC, _GREEKL, _GUI); - if (IS_LAYER_ON(_GREEKL)) { - led_layer_normal(); - } else { - led_layer_normal(); - } } return false; break; @@ -899,21 +885,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { layer_on(_GREEKL); layer_off(_GREEKU); update_tri_layer(_PUNC, _GREEKL, _GUI); - if (IS_LAYER_ON(_GUI)) { - led_layer_normal(); - } else { - led_layer_normal(); - } } } else { layer_off(_GREEKU); layer_off(_GREEKL); update_tri_layer(_PUNC, _GREEKL, _GUI); - if (IS_LAYER_ON(_PUNC)) { - led_layer_normal(); - } else { - led_layer_normal(); - } } return false; break; @@ -921,10 +897,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case NUM: if (record->event.pressed) { layer_on(_NUM); - led_layer_num(); } else { layer_off(_NUM); - led_layer_normal(); } return false; break; @@ -932,10 +906,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case FUNC: if (record->event.pressed) { layer_on(_FUNC); - led_layer_func(); } else { layer_off(_FUNC); - led_layer_normal(); } return false; break; @@ -1003,6 +975,10 @@ void matrix_init_user(void) { } } +void matrix_scan_user(void) { + led_set_layer_indicator(); +} + void battery_poll(float percentage) { rgbsps_sethsv(LED_IND_BATTERY, percentage*120/100, 255, 15); rgbsps_send(); @@ -1012,23 +988,23 @@ void ps2_mouse_init_user() { uint8_t rcv; // set TrackPoint sensitivity - PS2_MOUSE_SEND(0xE2, "set trackpoint sensitivity: 0xE2"); - PS2_MOUSE_SEND(0x81, "set trackpoint sensitivity: 0x81"); - PS2_MOUSE_SEND(0x4A, "set trackpoint sensitivity: 0x4A"); - PS2_MOUSE_SEND(0x49, "set trackpoint sensitivity: 0x59"); + PS2_MOUSE_SEND(0xE2, "tpsens: 0xE2"); + PS2_MOUSE_SEND(0x81, "tpsens: 0x81"); + PS2_MOUSE_SEND(0x4A, "tpsens: 0x4A"); + PS2_MOUSE_SEND(0x49, "tpsens: 0x59"); // set TrackPoint Negative Inertia factor - PS2_MOUSE_SEND(0xE2, "set negative inertia factor: 0xE2"); - PS2_MOUSE_SEND(0x81, "set negative inertia factor: 0x81"); - PS2_MOUSE_SEND(0x4D, "set negative inertia factor: 0x4D"); - PS2_MOUSE_SEND(0x06, "set negative inertia factor: 0x06"); + PS2_MOUSE_SEND(0xE2, "tpnegin: 0xE2"); + PS2_MOUSE_SEND(0x81, "tpnegin: 0x81"); + PS2_MOUSE_SEND(0x4D, "tpnegin: 0x4D"); + PS2_MOUSE_SEND(0x06, "tpnegin: 0x06"); // set TrackPoint speed // (transfer function upper plateau speed) - PS2_MOUSE_SEND(0xE2, "set trackpoint speed: 0xE2"); - PS2_MOUSE_SEND(0x81, "set trackpoint speed: 0x81"); - PS2_MOUSE_SEND(0x60, "set trackpoint speed: 0x60"); - PS2_MOUSE_SEND(0x61, "set trackpoint speed: 0x61"); + PS2_MOUSE_SEND(0xE2, "tpsp: 0xE2"); + PS2_MOUSE_SEND(0x81, "tpsp: 0x81"); + PS2_MOUSE_SEND(0x60, "tpsp: 0x60"); + PS2_MOUSE_SEND(0x61, "tpsp: 0x61"); // inquire pts status rcv = ps2_host_send(0xE2); diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c index 7f876c756..adfc11e2a 100644 --- a/keyboards/handwired/promethium/promethium.c +++ b/keyboards/handwired/promethium/promethium.c @@ -31,6 +31,8 @@ void matrix_scan_kb(void) { counter = 0; battery_poll(battery_percentage()); } + + matrix_scan_user(); } -- cgit v1.2.3 From bf31f516e30c4aae89a6636cecb3d7c5bb332cad Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 11 Feb 2017 00:07:44 +0700 Subject: Add reset keycode --- keyboards/handwired/promethium/keymaps/priyadi/keymap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 72b625357..3107d4e05 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -715,7 +715,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Sys * ,-----------------------------------------------------------------------------------. - * | |Qwerty| Win | | | | | USB | | | | | + * | |Qwerty| Win | |Reset | | | USB | | | | | * |------+------+------+------+------+-------------+------+------+------+------+------| * | |Audio | |Dvorak| | Glow | | |WorkMn|Linux | | | * |------+------+------+------+------+------+------+------+------+------+------+------| @@ -725,7 +725,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_SYS] = KEYMAP( - XXXXXXX, QWERTY, WIN, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, QWERTY, WIN, XXXXXXX, RESET, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, AUDIO, XXXXXXX, DVORAK, XXXXXXX, GLOW, XXXXXXX, XXXXXXX, WORKMAN, LINUX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, XXXXXXX, OUT_BLE, NORMAN, OSX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______ -- cgit v1.2.3 From fdd06d3fcafd5aae5eb8a6edf208f60a40a6a0be Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 11 Feb 2017 00:21:27 +0700 Subject: RShift + LShift = Capslock --- keyboards/handwired/promethium/keymaps/priyadi/keymap.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 3107d4e05..b50d2c3e2 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -744,6 +744,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { // handle greek layer shift + // handle both shift = capslock case KC_LSFT: case KC_RSFT: ; @@ -758,6 +759,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { layer_off(_GREEKU); } } + } else { + if (record->event.pressed) { + if (lshift ^ rshift) { // if only one shift was pressed + register_code(KC_CAPS); + unregister_code(KC_CAPS); + } + } } return true; break; -- cgit v1.2.3 From b31ac35441a8117877e446b8467e3e34e0a4505b Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 11 Feb 2017 01:30:08 +0700 Subject: Fix emoji layer --- keyboards/handwired/promethium/keymaps/priyadi/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index b50d2c3e2..6eb4e903f 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -692,7 +692,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { X(HART2), X(CRY2),X(WEARY),X(EYERT),X(SMIRK), X(TJOY),X(RECYC),X(UNAMU),X(MUSIC),X(OKHND),X(PENSV), X(PHEW), X(THMUP), X(PRAY),X(SMILE),X(SMIL2),X(FLUSH), X(GRIN),X(HEART), X(BYE), X(KISS),X(CELEB), X(COOL),X(NOEVS), X(THMDN),X(SLEEP), X(CLAP), X(CRY), X(VIC),X(BHART), X(SUN),X(SMEYE), X(WINK), X(MOON),X(CONFU),X(NOEVH), - X(POO), X(EYES),X(HUNRD), _______,X(SKULL),X(HORNS), X(HALO), X(FEAR), _______,X(YUMMY),X(DISAP),X(NOEVK) + X(POO), X(EYES), _______,X(HUNRD), X(SKULL),X(HORNS), X(HALO), X(FEAR),X(YUMMY),_______,X(DISAP),X(NOEVK) ), /* GUI -- cgit v1.2.3 From 9fc3afbef4b3ecc8568c37f247c3c7f1ec87a4c1 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 11 Feb 2017 14:50:43 +0700 Subject: simplify battery calculation for now --- keyboards/handwired/promethium/config.h | 89 +++++++++++++++++++--- .../handwired/promethium/keymaps/priyadi/keymap.c | 4 +- keyboards/handwired/promethium/promethium.c | 19 ++--- keyboards/handwired/promethium/promethium.h | 4 +- 4 files changed, 92 insertions(+), 24 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/config.h b/keyboards/handwired/promethium/config.h index 23fbfd0b9..fd45c2bfe 100644 --- a/keyboards/handwired/promethium/config.h +++ b/keyboards/handwired/promethium/config.h @@ -43,38 +43,107 @@ along with this program. If not, see . #define MATRIX_ROW_PINS { D7, C6, D0, D1, F5, F4, F1, F0 } #define UNUSED_PINS -/* COL2ROW or ROW2COL */ +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ #define DIODE_DIRECTION COL2ROW -/* define if matrix has ghost */ +// #define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ //#define MATRIX_HAS_GHOST /* number of backlight levels */ -#define BACKLIGHT_LEVELS 3 - -/* Set 0 if debouncing isn't needed */ -#define DEBOUNCING_DELAY 5 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -#define LOCKING_SUPPORT_ENABLE +// #define LOCKING_SUPPORT_ENABLE /* Locking resynchronize hack */ -#define LOCKING_RESYNC_ENABLE +// #define LOCKING_RESYNC_ENABLE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO /* key combination for command */ #define IS_COMMAND() ( \ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) \ ) +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + /* * Feature disable options * These options are also useful to firmware size reduction. */ /* disable debug print */ -//#define NO_DEBUG +// #define NO_DEBUG /* disable print */ -//#define NO_PRINT +// #define NO_PRINT /* disable action features */ //#define NO_ACTION_LAYER diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 6eb4e903f..992a03a41 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -987,8 +987,8 @@ void matrix_scan_user(void) { led_set_layer_indicator(); } -void battery_poll(float percentage) { - rgbsps_sethsv(LED_IND_BATTERY, percentage*120/100, 255, 15); +void battery_poll(uint8_t level) { + rgbsps_sethsv(LED_IND_BATTERY, level * 120/255, 255, 15); rgbsps_send(); } diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c index adfc11e2a..3e369a624 100644 --- a/keyboards/handwired/promethium/promethium.c +++ b/keyboards/handwired/promethium/promethium.c @@ -3,20 +3,17 @@ #include "timer.h" #include "matrix.h" -float battery_percentage(void) { +// cubic fit {3.3, 0}, {3.5, 2.9}, {3.6, 5}, {3.7, 8.6}, {3.8, 36}, {3.9, 62}, {4.0, 73}, {4.05, 83}, {4.1, 89}, {4.15, 94}, {4.2, 100} + +uint8_t battery_level(void) { float voltage = analogRead(BATTERY_PIN) * 2 * 3.3 / 1024; - float percentage = (voltage - 3.5) * 143; - if (percentage > 100) { - return 100; - } else if (percentage < 0) { - return 0; - } else { - return percentage; - } + if (voltage < MIN_VOLTAGE) return 0; + if (voltage > MAX_VOLTAGE) return 255; + return (voltage - MIN_VOLTAGE) / (MAX_VOLTAGE - MIN_VOLTAGE) * 255; } __attribute__ ((weak)) -void battery_poll(float percentage) { +void battery_poll(uint8_t level) { } void matrix_init_kb(void) { @@ -29,7 +26,7 @@ void matrix_scan_kb(void) { if (counter > BATTERY_POLL) { counter = 0; - battery_poll(battery_percentage()); + battery_poll(battery_level()); } matrix_scan_user(); diff --git a/keyboards/handwired/promethium/promethium.h b/keyboards/handwired/promethium/promethium.h index 6d51f81ca..da37e5c56 100644 --- a/keyboards/handwired/promethium/promethium.h +++ b/keyboards/handwired/promethium/promethium.h @@ -7,6 +7,8 @@ #define UNICODE_TYPE_DELAY 0 #define BATTERY_PIN 9 #define BATTERY_POLL 30000 +#define MAX_VOLTAGE 4.2 +#define MIN_VOLTAGE 3.2 #define KEYMAP( \ k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \ @@ -103,4 +105,4 @@ enum led_sequence { #endif -void battery_poll(float percentage); \ No newline at end of file +void battery_poll(uint8_t level); \ No newline at end of file -- cgit v1.2.3 From 79de0cd11964e9205654498aa0027510e3c3535e Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 11 Feb 2017 19:03:18 +0700 Subject: Implement Capslock LED --- .../handwired/promethium/keymaps/priyadi/keymap.c | 23 ++++++++++++++++++---- keyboards/handwired/promethium/promethium.c | 3 +++ 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 992a03a41..2a21b4ba7 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -10,6 +10,7 @@ #include "ps2_mouse.h" #include "ps2.h" #include "outputselect.h" +#include "led.h" #define COUNT(x) (sizeof (x) / sizeof (*(x))) // Fillers to make layering clearer @@ -23,6 +24,8 @@ #undef KC_RALT #define KC_RALT MT(MOD_RALT, KC_SLCK) +bool capslock = false; + // glow enum glow_modes { GLOW_NONE, @@ -417,7 +420,7 @@ void led_set_layer_indicator(void) { static uint8_t oldlayer = 255; rgbsps_set(LED_IND_FUNC, 0, 0, 0); - rgbsps_set(LED_IND_NUM, 0, 0, 0); + // rgbsps_set(LED_IND_NUM, 0, 0, 0); rgbsps_set(LED_IND_EMOJI, 0, 0, 0); led_reset(); @@ -438,9 +441,9 @@ void led_set_layer_indicator(void) { case _FUNC: rgbsps_set(LED_IND_FUNC, 15, 0, 0); break; - case _NUM: - rgbsps_set(LED_IND_NUM, 0, 0, 15); - break; + // case _NUM: + // rgbsps_set(LED_IND_NUM, 0, 0, 15); + // break; case _EMOJI: rgbsps_set(LED_IND_EMOJI, 15, 15, 0); break; @@ -992,6 +995,18 @@ void battery_poll(uint8_t level) { rgbsps_send(); } +void led_set_user(uint8_t usb_led) { + bool new_capslock = usb_led & (1< Date: Sat, 11 Feb 2017 21:54:10 +0700 Subject: LSpace + RSpace = switch layer --- .../handwired/promethium/keymaps/priyadi/config.h | 2 + .../handwired/promethium/keymaps/priyadi/keymap.c | 91 +++++++++++++++++++++- 2 files changed, 92 insertions(+), 1 deletion(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/config.h b/keyboards/handwired/promethium/keymaps/priyadi/config.h index 36baedd48..53059ca7d 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/config.h +++ b/keyboards/handwired/promethium/keymaps/priyadi/config.h @@ -19,4 +19,6 @@ #define LAYOUT_NORMAN #define LAYOUT_WORKMAN +#define DOUBLESPACE_LAYER_ENABLE + #endif diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 2a21b4ba7..9fa038724 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -25,6 +25,13 @@ #define KC_RALT MT(MOD_RALT, KC_SLCK) bool capslock = false; +#ifdef DOUBLESPACE_LAYER_ENABLE +bool lspace_active = false; +bool rspace_active = false; +bool lspace_emitted = false; +bool rspace_emitted = false; +bool space_layer_entered = false; +#endif // glow enum glow_modes { @@ -55,6 +62,9 @@ enum layers { _SYS, }; +// double-space layer +#define _SPACE _GUI + enum planck_keycodes { // layouts QWERTY = SAFE_RANGE, @@ -77,6 +87,8 @@ enum planck_keycodes { OSX, // others + LSPACE, + RSPACE, GLOW, AUDIO }; @@ -504,7 +516,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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_LALT, KC_LGUI, PUNC, NUM, KC_SPC, KC_SPC, FUNC, GREEK, KC_RGUI, KC_RALT, KC_RCTL + KC_LCTL, KC_LALT, KC_LGUI, PUNC, NUM, LSPACE, RSPACE, FUNC, GREEK, KC_RGUI, KC_RALT, KC_RCTL ), /* Dvorak @@ -745,7 +757,84 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool lshift = keyboard_report->mods & MOD_BIT(KC_LSFT); bool rshift = keyboard_report->mods & MOD_BIT(KC_RSFT); +#ifdef DOUBLESPACE_LAYER_ENABLE + // double-space: send space immediately if any other key depressed before space is released + if ((lspace_active ^ rspace_active) + && keycode != LSPACE + && keycode != RSPACE + && record->event.pressed) + { + if (lspace_active) { + if (!lspace_emitted) { + register_code(KC_SPC); + unregister_code(KC_SPC); + } + lspace_emitted = true; + } + if (rspace_active) { + if (!rspace_emitted) { + register_code(KC_SPC); + unregister_code(KC_SPC); + } + rspace_emitted = true; + } + } +#endif + switch (keycode) { + +#ifdef DOUBLESPACE_LAYER_ENABLE + // double-space enter space layer + case LSPACE: + if (record->event.pressed) { + lspace_active = true; + if (rspace_active) { + layer_on(_SPACE); + space_layer_entered = true; + } + } else { + lspace_active = false; + if (space_layer_entered) { + layer_off(_SPACE); + if (!rspace_active) { + space_layer_entered = false; + } + } else { + if (!lspace_emitted) { + register_code(KC_SPC); + unregister_code(KC_SPC); + } + lspace_emitted = false; + } + } + return false; + break; + case RSPACE: + if (record->event.pressed) { + rspace_active = true; + if (lspace_active) { + layer_on(_SPACE); + space_layer_entered = true; + } + } else { + rspace_active = false; + if (space_layer_entered) { + layer_off(_SPACE); + if (!lspace_active) { + space_layer_entered = false; + } + } else { + if (!rspace_emitted) { + register_code(KC_SPC); + unregister_code(KC_SPC); + } + rspace_emitted = false; + } + } + return false; + break; +#endif + // handle greek layer shift // handle both shift = capslock case KC_LSFT: -- cgit v1.2.3 From c6123b2e4a8472557c3a563d69662840dc3d0720 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 11 Feb 2017 22:03:34 +0700 Subject: Move X in number layer away from space --- keyboards/handwired/promethium/keymaps/priyadi/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 9fa038724..bfca58e37 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -635,7 +635,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, S(KC_A), KC_7, KC_8, KC_9, S(KC_D), KC_GRV, XXXXXXX, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, S(KC_B), KC_4, KC_5, KC_6, S(KC_E), _______, KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, S(KC_C), KC_1, KC_2, KC_3, S(KC_F), KC_COLN, - _______, _______, _______, _______, _______, _______, KC_X, KC_0, KC_COMM, KC_DOT, _______, _______ + _______, _______, _______, _______, _______, _______, _______, KC_0, KC_COMM, KC_DOT, KC_X, _______ ), /* Func -- cgit v1.2.3 From 4586b19be3058822474ba0b8035cc867a41154f9 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 11 Feb 2017 22:07:04 +0700 Subject: Turn off capslock when entering num layer --- keyboards/handwired/promethium/keymaps/priyadi/keymap.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index bfca58e37..8c24f381f 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -996,6 +996,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case NUM: if (record->event.pressed) { + turn_off_capslock(); layer_on(_NUM); } else { layer_off(_NUM); @@ -1096,6 +1097,13 @@ void led_set_user(uint8_t usb_led) { } } +void turn_off_capslock() { + if (capslock) { + register_code(KC_CAPS); + unregister_code(KC_CAPS); + } +} + void ps2_mouse_init_user() { uint8_t rcv; -- cgit v1.2.3 From 4c05e39a02a06644da6a5e65cbfce44e8626cfd2 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 11 Feb 2017 22:13:35 +0700 Subject: Switch to Emoji layer using Punc + greek --- .../handwired/promethium/keymaps/priyadi/keymap.c | 24 ++++------------------ 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 8c24f381f..9fa224bb5 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -878,22 +878,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; break; - // press both Supers to activate EMOJI layer - case KC_LGUI: - case KC_RGUI: - ; - bool lgui = keyboard_report->mods & MOD_BIT(KC_LGUI); - bool rgui = keyboard_report->mods & MOD_BIT(KC_RGUI); - if (record->event.pressed) { - if (lgui ^ rgui) { // if only one super was pressed - layer_on(_EMOJI); - } - } else { - layer_off(_EMOJI); - } - return true; - break; - // QWERTZ style comma and dot: semicolon and colon when shifted case KC_COMM: if (record->event.pressed) { @@ -968,10 +952,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case PUNC: if (record->event.pressed) { layer_on(_PUNC); - update_tri_layer(_PUNC, _GREEKL, _GUI); + update_tri_layer(_PUNC, _GREEKL, _EMOJI); } else { layer_off(_PUNC); - update_tri_layer(_PUNC, _GREEKL, _GUI); + update_tri_layer(_PUNC, _GREEKL, _EMOJI); } return false; break; @@ -984,12 +968,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } else { layer_on(_GREEKL); layer_off(_GREEKU); - update_tri_layer(_PUNC, _GREEKL, _GUI); + update_tri_layer(_PUNC, _GREEKL, _EMOJI); } } else { layer_off(_GREEKU); layer_off(_GREEKL); - update_tri_layer(_PUNC, _GREEKL, _GUI); + update_tri_layer(_PUNC, _GREEKL, _EMOJI); } return false; break; -- cgit v1.2.3 From 4163a3819ee4cdd49446da612a6ef3f74091ede1 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 11 Feb 2017 22:16:19 +0700 Subject: Add regular space to B+N on GUI layer for repeating space --- keyboards/handwired/promethium/keymaps/priyadi/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboards') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 9fa224bb5..1ad34612e 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -724,7 +724,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_GUI] = KEYMAP( XXXXXXX, G(KC_1), G(KC_2), G(KC_3), G(KC_4), G(KC_5), G(KC_6), G(KC_7), G(KC_8), G(KC_9), G(KC_0), XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD, KC_MUTE, KC_VOLU, XXXXXXX, XXXXXXX, KC_WWWB, XXXXXXX, KC_WWWF, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, KC_SPC, KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX ), -- cgit v1.2.3