1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
#include QMK_KEYBOARD_H
#include "keymap_japanese.h"
#ifdef RGBLIGHT_ENABLE
//Following line allows macro to read current RGB settings
extern rgblight_config_t rgblight_config;
#endif
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum layer_number {
_BASE = 0,
_NUMPAD,
_LOWER,
_RAISE,
_ADJUST,
};
enum custom_keycodes {
BASE = SAFE_RANGE,
NUMPAD,
KANJI,
LOWER,
RAISE,
ADJUST,
RGBRST
};
enum tapdances{
TD_CODO = 0,
// TD_MNUB,
};
// Layer Mode aliases
#define KC_LOWER LOWER
#define KC_RAISE RAISE
#define KC_ADJST ADJUST
#define KC_DLNP NUMPAD //DF(_NUMPAD)
#define KC_DLBS BASE //DF(_BASE)
#define KC_ZSFT LSFT_T(KC_Z)
#define KC_MNSF LSFT_T(KC_MINS)
#define KC_ESCT LCTL_T(KC_ESC)
#define KC_TBAL LALT_T(KC_TAB)
#define KC_11SF LSFT_T(KC_F11)
#define KC_ALAP LALT_T(KC_APP)
#define KC_JEQL LSFT(KC_MINS)
#define KC_WLCK LALT(KC_L)
#define KC_SFEQ LSFT(KC_MINS)
#define KC_SFPL LSFT(KC_SCLN)
#define KC_SFAS LSFT(KC_QUOT)
#define KC_CODO TD(TD_CODO)
// #define KC_MNUB TD(TD_MNUB)
tap_dance_action_t tap_dance_actions[] = {
[TD_CODO] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_DOT),
// [TD_MNUB] = ACTION_TAP_DANCE_DOUBLE(KC_MINS, LSFT(JP_BSLS)),
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT(
//,----------------------------------. ,----------------------------------.
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
//|------+------+------+------+------| |------+------+------+------+------|
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT,
//|------+------+------+------+------| |------+------+------+------+------|
KC_ZSFT, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_CODO, KC_UP, KC_MNSF,
//|------+------+------+------+------|------+------+------+------+------+------+------|
KC_ESCT, KC_TBAL, KC_LGUI, KC_LOWER, KC_BSPC, KC_BSPC, KC_SPC, KC_SPC, KC_RAISE, KC_LEFT, KC_DOWN, KC_RGHT
//|------+------+------+------+-------------+------+------+------+------+------+------|
),
[_NUMPAD] = LAYOUT(
//,----------------------------------. ,----------------------------------.
KC_P7, KC_P8, KC_P9, KC_PAST, KC_NUM, KC_P7, KC_P8, KC_P9, KC_PAST, KC_NUM,
//|------+------+------+------+------| |------+------+------+------+------|
KC_P4, KC_P5, KC_P6, KC_PMNS, KC_PSLS, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_PSLS,
//|------+------+------+------+------| |------+------+------+------+------|
KC_P1, KC_P2, KC_P3, KC_PPLS, KC_QUOT, KC_P1, KC_P2, KC_P3, KC_PPLS, KC_QUOT,
//|------+------+------+------+------|------+------+------+------+------+------+------|
KC_DLBS, KC_P0, KC_PDOT, KC_SFEQ, KC_SPC, KC_DEL, KC_SPC, KC_DLBS, KC_P0, KC_PDOT, KC_SFEQ, KC_BSPC
//|------+------+------+------+-------------+------+------+------+------+------+------|
),
[_LOWER] = LAYOUT(
//,----------------------------------. ,----------------------------------.
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_MINS, KC_EQL, JP_YEN, KC_LBRC, KC_RBRC,
//|------+------+------+------+------| |------+------+------+------+------|
KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, XXXXXXX, XXXXXXX, KC_SCLN, KC_QUOT, KC_BSLS,
//|------+------+------+------+------| |------+------+------+------+------|
KC_11SF, KC_F12, KC_DLNP, KANJI, KC_ENT, XXXXXXX, KC_COMM, KC_DOT, KC_SLSH, JP_BSLS,
//|------+------+------+------+------|------+------+------+------+------+------+------|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
//|------+------+------+------+-------------+------+------+------+------+------+------|
),
[_RAISE] = LAYOUT(
//,----------------------------------. ,----------------------------------.
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,
//|------+------+------+------+------| |------+------+------+------+------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_QUOT, KC_4, KC_5, KC_6, KC_MINS,
//|------+------+------+------+------| |------+------+------+------+------|
KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_SLSH, KC_1, KC_2, KC_3, KC_PPLS,
//|------+------+------+------+------|------+------+------+------+------+------+------|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_WLCK, KC_TRNS, KC_0, KC_DOT, KC_JEQL
//|------+------+------+------+-------------+------+------+------+------+------+------|
),
[_ADJUST] = LAYOUT(
//,----------------------------------. ,----------------------------------.
QK_BOOT, RGBRST, AG_NORM, AG_SWAP, KC_CAPS, XXXXXXX, KC_WH_L, KC_WH_U, KC_HOME, KC_PGUP,
//|------+------+------+------+------| |------+------+------+------+------|
RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, KC_SCRL, XXXXXXX, KC_WH_R, KC_WH_D, KC_END, KC_PGDN,
//|------+------+------+------+------| |------+------+------+------+------|
RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, KC_NUM, XXXXXXX, KC_BTN1, KC_BTN2, KC_MS_U, XXXXXXX,
//|------+------+------+------+------|------+------+------+------+------+------+------|
KC_LSFT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R
//|------+------+------+------+-------------+------+------+------+------+------+------|
)
};
#define L_BASE _BASE
#define L_NUMPAD (1<<_NUMPAD)
static inline void update_change_layer(bool pressed, uint8_t layer1, uint8_t layer2, uint8_t layer3) {
pressed ? layer_on(layer1) : layer_off(layer1);
IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2) ? layer_on(layer3) : layer_off(layer3);
}
int RGB_current_mode;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
bool result = false;
switch (keycode) {
case BASE:
if (record->event.pressed) {
default_layer_set(L_BASE);
}
break;
case NUMPAD:
if (record->event.pressed) {
default_layer_set(L_NUMPAD);
}
break;
case LOWER:
update_change_layer(record->event.pressed, _LOWER, _RAISE, _ADJUST);
break;
case RAISE:
update_change_layer(record->event.pressed, _RAISE, _LOWER, _ADJUST);
break;
case KANJI:
if (record->event.pressed) {
if (keymap_config.swap_lalt_lgui == false) {
register_code(KC_LNG2);
} else {
tap_code16(A(KC_GRV));
}
} else {
unregister_code(KC_LNG2);
}
break;
#ifdef RGBLIGHT_ENABLE
//led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
case RGB_MOD:
if (record->event.pressed) {
rgblight_mode(RGB_current_mode);
rgblight_step();
RGB_current_mode = rgblight_config.mode;
}
break;
case RGBRST:
if (record->event.pressed) {
eeconfig_update_rgblight_default();
rgblight_enable();
RGB_current_mode = rgblight_config.mode;
}
break;
#endif
default:
result = true;
break;
}
return result;
}
void matrix_init_user(void) {
#ifdef RGBLIGHT_ENABLE
RGB_current_mode = rgblight_config.mode;
#endif
}
|