2 #ifdef BACKLIGHT_ENABLE
6 /* Each layer is given a name to aid in readability, which is then
7 used in the keymap matrix below. The underscores do not denote
8 anything - you can have a layer called STUFF or any other name.
10 Layer names don't all need to be of the same length, obviously, and
11 you could also skip them entirely and just use numbers, though that
12 means needing to manage the numbers.
14 It is preferable to keep the symbols short so that a line worth of
15 key mappings fits compactly onto a line of code. */
17 /* This was originally based on planck/keymaps/default/default.c, and
18 then cbbrowne has revised things */
20 /* Things I did not like about the default mapping
22 - I find control too hard to get to. I think I'll want it on a
23 left finger. Gonna need to lose something to do that...
24 - Almost certainly, KC_LCTL should be on [2][1]
25 - having dash on [lower-j] is a bit nonintuitive, but may be OK
26 - I'll bet I should switch ESC/TAB
27 - I'm suspicious that I want to shift M(0) from [4][1] to [4][2],
28 and shift ESC off the first column so KC_LCTL and KC_LALT can
29 be on the first column.
30 - I think I wanna swap ' and ENTER
32 - All of the above are done :-)
34 - I'm keeping Colemak and Dvorak around for reference, and added
35 Workman just for fun. They're useless to me, though.
39 /* Some interesting things implemented
41 - There is a macro that writes out "cbbrowne" just because I could
42 - There is a (somewhat cruddy) linear congruential random number
44 - I would like to be seeding it with clock info to make it look
46 - There are two macros that use the random number generators
47 - one, M_RANDDIGIT, generates a random digit based on state
48 of the random number generator
49 - the other, M_RANDLETTER, generates a random letter based on state
50 of the random number generator
51 - in both, note the use of register_code()/unregister_code()
52 to indicate the desired key
55 /* Other things to do...
57 - Need to think about what zsh and readline actions I use lots
58 - Wanna figure out macros, so I can put in a "cbbrowne" macro
59 - Ought to ensure that Control-Alt-Delete is convenient enough
60 - How about Alt-F1 thru Alt-F8?
61 - What's the keystroke to get from X to console these days?
62 - I do indeed want a sweet number pad!
63 - A layer for doing console switching would not be a bad idea
67 _QW = 0, /* Qwerty mapping */
68 _LW, /* Lower layer, where top line has symbols !@#$%^&*() */
69 _RS, /* Raised layer, where top line has digits 1234567890 */
80 /* Note that Planck has dimensions 4 rows x 12 columns */
82 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
83 [_QW] = { /* Qwerty */
84 {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
85 {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT},
86 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT },
87 {KC_TAB, M(M_LED), KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
90 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
91 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
92 {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_KP), DF(_KP), RESET, KC_TRNS},
93 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
96 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
97 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
98 {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_KP), DF(_KP), RESET, KC_TRNS},
99 {KC_TRNS, DF(_KP), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
101 [_KP] = { /* Key Pad */
102 {KC_ESC, M(M_USERNAME), KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_ENTER, KC_KP_PLUS, KC_KP_PLUS, KC_KP_ENTER, KC_BSPC},
103 {KC_LCTL, M(M_RANDDIGIT), KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_MINUS, KC_7, KC_8, KC_9, KC_ENT},
104 {KC_LSFT, M(M_RANDLETTER), KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_PLUS, KC_4, KC_5, KC_6, KC_DOT},
105 {BL_STEP, M(M_LED), KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, DF(_QW), KC_1, KC_2, KC_3, KC_0}
109 const uint16_t PROGMEM fn_actions[] = {
112 /* This bit of logic seeds a wee linear congruential random number generator */
114 static uint16_t random_value = 157;
119 const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
122 clockbyte = TCNT1 % 256;
123 // MACRODOWN only works in this function
126 if (record->event.pressed) {
127 register_code(KC_RSFT);
128 #ifdef BACKLIGHT_ENABLE
132 unregister_code(KC_RSFT);
136 if (record->event.pressed) {
137 return MACRO( I(1), T(C), T(B), T(B), T(R), T(O), T(W), T(N), T(E));
143 /* Generate, based on random number generator, a keystroke for
144 a numeric digit chosen at random */
145 random_value = ((random_value + randadd) * randmul) % randmod;
146 if (record->event.pressed)
148 /* Here, we mix the LCRNG with low bits from one of the system
149 clocks via XOR in the theory that this may be more random
150 than either separately */
152 switch ((random_value ^ clockbyte) % 10) {
154 register_code (KC_0);
155 unregister_code (KC_0);
158 register_code (KC_1);
159 unregister_code (KC_1);
162 register_code (KC_2);
163 unregister_code (KC_2);
166 register_code (KC_3);
167 unregister_code (KC_3);
170 register_code (KC_4);
171 unregister_code (KC_4);
174 register_code (KC_5);
175 unregister_code (KC_5);
178 register_code (KC_6);
179 unregister_code (KC_6);
182 register_code (KC_7);
183 unregister_code (KC_7);
186 register_code (KC_8);
187 unregister_code (KC_8);
190 register_code (KC_9);
191 unregister_code (KC_9);
196 /* Generate, based on random number generator, a keystroke for
197 a letter chosen at random */
198 /* Here, we mix the LCRNG with low bits from one of the system
199 clocks via XOR in the theory that this may be more random
200 than either separately */
201 random_value = ((random_value + randadd) * randmul) % randmod;
202 if (record->event.pressed)
203 switch((random_value ^ clockbyte) % 26) {
206 unregister_code(KC_A);
210 unregister_code(KC_B);
214 unregister_code(KC_C);
218 unregister_code(KC_D);
222 unregister_code(KC_E);
226 unregister_code(KC_F);
230 unregister_code(KC_G);
234 unregister_code(KC_H);
238 unregister_code(KC_I);
242 unregister_code(KC_J);
246 unregister_code(KC_K);
250 unregister_code(KC_L);
254 unregister_code(KC_M);
258 unregister_code(KC_N);
262 unregister_code(KC_O);
266 unregister_code(KC_P);
270 unregister_code(KC_Q);
274 unregister_code(KC_R);
278 unregister_code(KC_S);
282 unregister_code(KC_T);
286 unregister_code(KC_U);
290 unregister_code(KC_V);
294 unregister_code(KC_W);
298 unregister_code(KC_X);
302 unregister_code(KC_Y);
306 unregister_code(KC_Z);