diff options
-rw-r--r-- | keyboards/crkbd/keymaps/edvorakjp/config.h | 24 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/edvorakjp/keymap.c | 158 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/edvorakjp/oled.c | 82 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/edvorakjp/oled.h | 24 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/edvorakjp/readme.md | 21 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/edvorakjp/rules.mk | 32 | ||||
-rw-r--r-- | users/edvorakjp/edvorakjp_process_record.c | 18 |
7 files changed, 354 insertions, 5 deletions
diff --git a/keyboards/crkbd/keymaps/edvorakjp/config.h b/keyboards/crkbd/keymaps/edvorakjp/config.h new file mode 100644 index 000000000..515591a42 --- /dev/null +++ b/keyboards/crkbd/keymaps/edvorakjp/config.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | /* Select hand configuration */ | ||
5 | |||
6 | #define MASTER_LEFT | ||
7 | // #define MASTER_RIGHT | ||
8 | // #define EE_HANDS | ||
9 | |||
10 | #define SSD1306OLED | ||
11 | #define SWAP_SCLN | ||
12 | |||
13 | // #define TAPPING_FORCE_HOLD | ||
14 | #define TAPPING_TERM 120 | ||
15 | |||
16 | #undef RGBLED_NUM | ||
17 | #define RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
18 | #define RGBLED_NUM 27 | ||
19 | #define RGBLIGHT_LIMIT_VAL 100 | ||
20 | #define RGBLIGHT_HUE_STEP 10 | ||
21 | #define RGBLIGHT_SAT_STEP 17 | ||
22 | #define RGBLIGHT_VAL_STEP 17 | ||
23 | |||
24 | #endif // CONFIG_USER_H | ||
diff --git a/keyboards/crkbd/keymaps/edvorakjp/keymap.c b/keyboards/crkbd/keymaps/edvorakjp/keymap.c new file mode 100644 index 000000000..ae2f710a0 --- /dev/null +++ b/keyboards/crkbd/keymaps/edvorakjp/keymap.c | |||
@@ -0,0 +1,158 @@ | |||
1 | #include QMK_KEYBOARD_H | ||
2 | #ifdef PROTOCOL_LUFA | ||
3 | #include "split_util.h" | ||
4 | #endif | ||
5 | #ifdef SSD1306OLED | ||
6 | #include "oled.h" | ||
7 | #endif | ||
8 | |||
9 | #include "edvorakjp.h" | ||
10 | |||
11 | /* | ||
12 | * enum custom_keycodes { | ||
13 | * KC_LOCK = NEW_SAFE_RANGE, | ||
14 | * }; | ||
15 | */ | ||
16 | |||
17 | #define KC_ KC_TRNS | ||
18 | |||
19 | #define KC_TMB1 LGUI_T(KC_TAB) | ||
20 | #define KC_TMB2 LSFT_T(KC_SPC) | ||
21 | #define KC_TMB3 TD(TD_LOWER) // act as LOWER when hold, as KC_LANG2(=English) when tapped | ||
22 | #define KC_TMB4 TD(TD_RAISE) // act as RAISE when hold, as KC_LANG1(=Japanese) when tapped | ||
23 | #define KC_TMB5 RCTL_T(KC_BSPC) | ||
24 | #define KC_TMB6 RALT_T(KC_ENT) | ||
25 | #define KC_TMB7 KC_DEL | ||
26 | #define KC_TMB8 RALT(KC_ENT) | ||
27 | #define KC_TMB9 LGUI(KC_TAB) | ||
28 | |||
29 | #define KC_RST RESET | ||
30 | #define KC_DBUG DEBUG | ||
31 | #define KC_RTOG RGB_TOG | ||
32 | #define KC_EDJP EDVORAK | ||
33 | #define KC_QWER QWERTY | ||
34 | |||
35 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
36 | |||
37 | [_EDVORAK] = LAYOUT_kc( | ||
38 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
39 | ESC ,QUOT,COMM,DOT , Y , P , F , G , R , W , Q ,BSLS, | ||
40 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
41 | EQL , A , O , E , I , U , D , T , N , S , M ,MINS, | ||
42 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
43 | GRV ,SCLN, X , C , V , Z , B , H , J , K , L ,SLSH, | ||
44 | //`----+----+----+----+----+----+----| |----+----+----+----+----+----+----' | ||
45 | TMB1,TMB2,TMB3, TMB4,TMB5,TMB6 | ||
46 | // `----+----+----' `----+----+----' | ||
47 | ), | ||
48 | |||
49 | [_EDVORAKJ1] = LAYOUT_kc( | ||
50 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
51 | , AI , OU , EI , , , , , , , , , | ||
52 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
53 | , , , , , , , , , Y , , , | ||
54 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
55 | ,ANN ,ONN ,ENN ,INN ,UNN , , , , , , , | ||
56 | //`----+----+----+----+----+----+----| |----+----+----+----+----+----+----' | ||
57 | , , , , , | ||
58 | // `----+----+----' `----+----+----' | ||
59 | ), | ||
60 | |||
61 | [_EDVORAKJ2] = LAYOUT_kc( | ||
62 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
63 | , AI , OU , EI , , , , , , , , , | ||
64 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
65 | , , , , , , , Y , , , , , | ||
66 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
67 | ,ANN ,ONN ,ENN ,INN ,UNN , , , , , , , | ||
68 | //`----+----+----+----+----+----+----| |----+----+----+----+----+----+----' | ||
69 | , , , , , | ||
70 | // `----+----+----' `----+----+----' | ||
71 | ), | ||
72 | |||
73 | [_QWERTY] = LAYOUT_kc( | ||
74 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
75 | TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS, | ||
76 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
77 | EQL , A , S , D , F , G , H , J , K , L ,SCLN,QUOT, | ||
78 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
79 | GRV , Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,BSLS, | ||
80 | //`----+----+----+----+----+----+----| |----+----+----+----+----+----+----' | ||
81 | , , , , , | ||
82 | // `----+----+----' `----+----+----' | ||
83 | ), | ||
84 | |||
85 | [_LOWER] = LAYOUT_kc( | ||
86 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
87 | , , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , , , | ||
88 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
89 | , 1 ,EXLM, AT ,HASH,DLR , PERC,CIRC,AMPR,ASTR, 0 , , | ||
90 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
91 | , , LT ,LCBR,LPRN,LBRC, RBRC,RPRN,RCBR, GT , , , | ||
92 | //`----+----+----+----+----+----+----| |----+----+----+----+----+----+----' | ||
93 | , , , ,TMB7,TMB8 | ||
94 | // `----+----+----' `----+----+----' | ||
95 | ), | ||
96 | |||
97 | [_RAISE] = LAYOUT_kc( | ||
98 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
99 | , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 , , | ||
100 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
101 | ,F11 ,F12 ,PSCR,SLCK,PAUS, ,HOME,PGDN,PGUP,END , , | ||
102 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
103 | , , , , , , ,LEFT,DOWN, UP ,RGHT, , | ||
104 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----' | ||
105 | TMB9, , , , , | ||
106 | // `----+----+----' `----+----+----' | ||
107 | ), | ||
108 | |||
109 | [_ADJUST] = LAYOUT_kc( | ||
110 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
111 | , , , ,EXTOFF, , ,EXTON, , , , , | ||
112 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
113 | , , ,QWER,WIN ,RST , RTOG,MAC ,EDJP, , , , | ||
114 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
115 | , , , , , , , , , , , , | ||
116 | //`----+----+----+----+----+----+----| |----+----+----+----+----+----+----' | ||
117 | , , , , , | ||
118 | // `----+----+----' `----+----+----' | ||
119 | ) | ||
120 | }; | ||
121 | |||
122 | #ifdef SSD1306OLED | ||
123 | void matrix_init_keymap(void) { | ||
124 | //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h | ||
125 | iota_gfx_init(!has_usb()); // turns on the display | ||
126 | } | ||
127 | |||
128 | void matrix_scan_user(void) { | ||
129 | iota_gfx_task(); // this is what updates the display continuously | ||
130 | } | ||
131 | #endif | ||
132 | |||
133 | #ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
134 | uint32_t layer_state_set_keymap(uint32_t state) { | ||
135 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); | ||
136 | switch (biton32(state)) { | ||
137 | case _EDVORAKJ1: | ||
138 | case _EDVORAKJ2: | ||
139 | // _EDVORAKJ1 & J2 are same colored | ||
140 | rgblight_sethsv_noeeprom_white(); | ||
141 | break; | ||
142 | case _LOWER: | ||
143 | rgblight_sethsv_noeeprom_red(); | ||
144 | break; | ||
145 | case _RAISE: | ||
146 | rgblight_sethsv_noeeprom_blue(); | ||
147 | break; | ||
148 | case _ADJUST: | ||
149 | rgblight_sethsv_noeeprom_green(); | ||
150 | break; | ||
151 | default: // for any other layers, or the default layer | ||
152 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_GRADIENT + 3); | ||
153 | rgblight_sethsv_noeeprom_red(); | ||
154 | break; | ||
155 | } | ||
156 | return state; | ||
157 | } | ||
158 | #endif | ||
diff --git a/keyboards/crkbd/keymaps/edvorakjp/oled.c b/keyboards/crkbd/keymaps/edvorakjp/oled.c new file mode 100644 index 000000000..e4cccf3e7 --- /dev/null +++ b/keyboards/crkbd/keymaps/edvorakjp/oled.c | |||
@@ -0,0 +1,82 @@ | |||
1 | #include <string.h> | ||
2 | #include "oled.h" | ||
3 | |||
4 | // NOTE: Redefined to avoid to use snprintf(); It makes size of firmware big. | ||
5 | const char *read_mode_icon(bool windows_mode) { | ||
6 | static const char logo[][2][3] = {{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}}; | ||
7 | static char mode_icon[10]; | ||
8 | |||
9 | int mode_number = windows_mode ? 1 : 0; | ||
10 | strcpy(mode_icon, logo[mode_number][0]); | ||
11 | |||
12 | strcat(mode_icon, "\n"); | ||
13 | strcat(mode_icon, logo[mode_number][1]); | ||
14 | |||
15 | return mode_icon; | ||
16 | } | ||
17 | |||
18 | const char *read_layer_state(void) { | ||
19 | static char layer_state_str[24]; | ||
20 | char layer_name[17]; | ||
21 | |||
22 | switch (biton32(layer_state)) { | ||
23 | case L_BASE: | ||
24 | strcpy(layer_name, default_layer_state == 1UL<<_EDVORAK ? "EDVORAK" : "QWERTY"); | ||
25 | break; | ||
26 | case _EDVORAKJ1: | ||
27 | case _EDVORAKJ2: | ||
28 | strcpy(layer_name, "JP_EXT"); | ||
29 | break; | ||
30 | case _RAISE: | ||
31 | strcpy(layer_name, "Raise"); | ||
32 | break; | ||
33 | case _LOWER: | ||
34 | strcpy(layer_name, "Lower"); | ||
35 | break; | ||
36 | case _ADJUST: | ||
37 | strcpy(layer_name, "Adjust"); | ||
38 | break; | ||
39 | default: | ||
40 | snprintf(layer_name, sizeof(layer_name), "Undef-%ld", layer_state); | ||
41 | } | ||
42 | |||
43 | strcpy(layer_state_str, "Layer: "); | ||
44 | |||
45 | strcat(layer_state_str, layer_name); | ||
46 | strcat(layer_state_str, "\n"); | ||
47 | return layer_state_str; | ||
48 | } | ||
49 | |||
50 | const char *read_host_led_state(void) { | ||
51 | static char led_str[24]; | ||
52 | bool ext_status = get_enable_jp_extra_layer() && get_japanese_mode(); | ||
53 | strcpy(led_str, ext_status ? "EXT" : " "); | ||
54 | |||
55 | strcat(led_str, (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? " NMLK" : " "); | ||
56 | strcat(led_str, (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? " CAPS" : " "); | ||
57 | strcat(led_str, (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? " SCLK" : " "); | ||
58 | return led_str; | ||
59 | } | ||
60 | |||
61 | void matrix_update(struct CharacterMatrix *dest, | ||
62 | const struct CharacterMatrix *source) { | ||
63 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
64 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
65 | dest->dirty = true; | ||
66 | } | ||
67 | } | ||
68 | |||
69 | void iota_gfx_task_user(void) { | ||
70 | struct CharacterMatrix matrix; | ||
71 | |||
72 | matrix_clear(&matrix); | ||
73 | if (is_master) { | ||
74 | matrix_write(&matrix, read_mode_icon(!get_enable_kc_lang())); | ||
75 | matrix_write(&matrix, " "); | ||
76 | matrix_write(&matrix, read_layer_state()); | ||
77 | matrix_write(&matrix, read_host_led_state()); | ||
78 | } else { | ||
79 | matrix_write(&matrix, read_logo()); | ||
80 | } | ||
81 | matrix_update(&display, &matrix); | ||
82 | } | ||
diff --git a/keyboards/crkbd/keymaps/edvorakjp/oled.h b/keyboards/crkbd/keymaps/edvorakjp/oled.h new file mode 100644 index 000000000..896347aea --- /dev/null +++ b/keyboards/crkbd/keymaps/edvorakjp/oled.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef OLED_USER_H | ||
2 | #define OLED_USER_H | ||
3 | |||
4 | //SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h | ||
5 | #include "ssd1306.h" | ||
6 | #include "edvorakjp.h" | ||
7 | |||
8 | //assign the right code to your layers for OLED display | ||
9 | #define L_BASE 0 | ||
10 | |||
11 | extern uint8_t is_master; | ||
12 | extern bool japanese_mode; | ||
13 | |||
14 | // method prototypes defined in crkbd/lib | ||
15 | extern const char *read_logo(void); | ||
16 | |||
17 | const char *read_mode_icon(bool swap); | ||
18 | const char *read_layer_state(void); | ||
19 | const char *read_host_led_state(void); | ||
20 | void matrix_update(struct CharacterMatrix *dest, | ||
21 | const struct CharacterMatrix *source); | ||
22 | void iota_gfx_task_user(void); | ||
23 | |||
24 | #endif // OLED_CONFIG_USER_H | ||
diff --git a/keyboards/crkbd/keymaps/edvorakjp/readme.md b/keyboards/crkbd/keymaps/edvorakjp/readme.md new file mode 100644 index 000000000..dd406523d --- /dev/null +++ b/keyboards/crkbd/keymaps/edvorakjp/readme.md | |||
@@ -0,0 +1,21 @@ | |||
1 | # edvorakjp | ||
2 | |||
3 | Epaew's Enhanced Dvorak layout for Japanese Programmer | ||
4 | see [here](/users/edvorakjp) for more informations. | ||
5 | |||
6 | ## License | ||
7 | |||
8 | Copyright 2018 Ryo Maeda epaew.333@gmail.com @epaew | ||
9 | |||
10 | This program is free software: you can redistribute it and/or modify | ||
11 | it under the terms of the GNU General Public License as published by | ||
12 | the Free Software Foundation, either version 2 of the License, or | ||
13 | (at your option) any later version. | ||
14 | |||
15 | This program is distributed in the hope that it will be useful, | ||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | GNU General Public License for more details. | ||
19 | |||
20 | You should have received a copy of the GNU General Public License | ||
21 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
diff --git a/keyboards/crkbd/keymaps/edvorakjp/rules.mk b/keyboards/crkbd/keymaps/edvorakjp/rules.mk new file mode 100644 index 000000000..b4f6d2f1f --- /dev/null +++ b/keyboards/crkbd/keymaps/edvorakjp/rules.mk | |||
@@ -0,0 +1,32 @@ | |||
1 | # Build Options | ||
2 | # change to "no" to disable the options, or define them in the Makefile in | ||
3 | # the appropriate keymap folder that will get included automatically | ||
4 | # | ||
5 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
6 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) | ||
7 | EXTRAKEY_ENABLE = no # Audio control and System control(+450) | ||
8 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
9 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
10 | NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
11 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
12 | MIDI_ENABLE = no # MIDI controls | ||
13 | AUDIO_ENABLE = no # Audio output on port C6 | ||
14 | UNICODE_ENABLE = no # Unicode | ||
15 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
16 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. | ||
17 | SWAP_HANDS_ENABLE = no # Enable one-hand typing | ||
18 | TAP_DANCE_ENABLE = yes | ||
19 | |||
20 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
21 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
22 | |||
23 | # If you want to change the display of OLED, you need to change here | ||
24 | SRC += ./lib/glcdfont.c \ | ||
25 | ./lib/logo_reader.c \ | ||
26 | oled.c \ | ||
27 | # ./lib/rgb_state_reader.c \ | ||
28 | # ./lib/layer_state_reader.c \ | ||
29 | # ./lib/keylogger.c \ | ||
30 | # ./lib/mode_icon_reader.c \ | ||
31 | # ./lib/host_led_state_reader.c \ | ||
32 | # ./lib/timelogger.c \ | ||
diff --git a/users/edvorakjp/edvorakjp_process_record.c b/users/edvorakjp/edvorakjp_process_record.c index dc70522b4..2dcdab2a2 100644 --- a/users/edvorakjp/edvorakjp_process_record.c +++ b/users/edvorakjp/edvorakjp_process_record.c | |||
@@ -37,11 +37,7 @@ bool process_record_edvorakjp_ext(uint16_t keycode, keyrecord_t *record) { | |||
37 | } | 37 | } |
38 | return true; | 38 | return true; |
39 | 39 | ||
40 | // left hand and right hand's right side | 40 | // left hand up and right hand's right side |
41 | case KC_X: | ||
42 | case KC_C: | ||
43 | case KC_V: | ||
44 | case KC_Z: | ||
45 | case KC_Y: | 41 | case KC_Y: |
46 | case KC_P: | 42 | case KC_P: |
47 | case KC_W: | 43 | case KC_W: |
@@ -54,6 +50,18 @@ bool process_record_edvorakjp_ext(uint16_t keycode, keyrecord_t *record) { | |||
54 | layer_on(_EDVORAKJ2); | 50 | layer_on(_EDVORAKJ2); |
55 | } | 51 | } |
56 | return true; | 52 | return true; |
53 | // left hand down | ||
54 | // If return true, QMK sends keycode in new layer, | ||
55 | // but these keys are only available in old layer. | ||
56 | case KC_X: | ||
57 | case KC_C: | ||
58 | case KC_V: | ||
59 | case KC_Z: | ||
60 | if (record->event.pressed) { | ||
61 | layer_on(_EDVORAKJ2); | ||
62 | tap_code(keycode); | ||
63 | } | ||
64 | return false; | ||
57 | } | 65 | } |
58 | 66 | ||
59 | // vowel keys, symbol keys and modifier keys | 67 | // vowel keys, symbol keys and modifier keys |