2 #ifdef BACKLIGHT_ENABLE
9 /* Each layer is given a name to aid in readability, which is then
10 used in the keymap matrix below. The underscores do not denote
11 anything - you can have a layer called STUFF or any other name.
13 Layer names don't all need to be of the same length, obviously, and
14 you could also skip them entirely and just use numbers, though that
15 means needing to manage the numbers.
17 It is preferable to keep the symbols short so that a line worth of
18 key mappings fits compactly onto a line of code. */
20 /* This was originally based on planck/keymaps/default/default.c, and
21 then cbbrowne has revised things */
23 /* Things I did not like about the default mapping
25 - I found control too hard to get to. I use it more than Tab, so
27 - Having dash on [lower-j] is a bit nonintuitive, but may be OK
28 - I'll bet I should switch ESC/TAB
29 - I'm suspicious that I want to shift M(0) from [4][1] to [4][2],
30 and shift ESC off the first column so KC_LCTL and KC_LALT can
31 be on the first column.
32 - I needed to swap ' and ENTER
34 - All of the above are done :-)
36 - Dropped out support for Dvorak and friends. They aren't
41 /* Some interesting things implemented
43 - There is a macro that writes out "cbbrowne" to show that I could
44 - There is a (somewhat cruddy) linear congruential random number
46 - I would like to be seeding it with clock info to make it look
48 - There are two macros that use the random number generators
49 - one, M_RANDDIGIT, generates a random digit based on state
50 of the random number generator
51 - the other, M_RANDLETTER, generates a random letter based on state
52 of the random number generator
53 - in both, note the use of register_code()/unregister_code()
54 to indicate the desired key
55 - I do indeed want a sweet number pad!
58 /* Other things to do...
60 - Need to think about what zsh and readline actions I use lots
61 - Ought to ensure that Control-Alt-Delete is convenient enough
62 - How about Alt-F1 thru Alt-F8?
63 - What's the keystroke to get from X to console these days?
64 - A layer for doing console switching would not be a bad idea
68 _QWERTY = 0, /* Qwerty mapping */
69 _LOWER, /* Lower layer, where top line has symbols !@#$%^&*() */
70 _RAISE, /* Raised layer, where top line has digits 1234567890 */
71 _KEYPAD, /* Key pad */
72 _ADJUST, /* Special Adjust layer coming via tri-placement */
85 #define M_LOWER M(MACRO_LOWER)
86 #define M_UPPER M(MACRO_UPPER)
87 #define ROT_LED M(M_LED) /* Rotate LED */
88 #define QWERTY DF(_QWERTY) /* Switch to QWERTY layout */
89 #define KEYPAD DF(_KEYPAD) /* Switch to keypad */
90 #define USERNAME M(M_USERNAME) /* shortcut for username */
91 #define RANDDIG M(M_RANDDIGIT)
92 #define RANDALP M(M_RANDLETTER)
93 #define CTLENTER MT(MOD_RCTL, KC_ENT)
94 #define SHIFTQUOTE MT(MOD_RSFT, KC_QUOT)
97 /* Note that Planck has dimensions 4 rows x 12 columns */
99 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
100 [_QWERTY] = { /* Qwerty */
101 {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
102 {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, CTLENTER},
103 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SHIFTQUOTE },
104 {KC_TAB, ROT_LED, KC_LALT, KC_LGUI, M_LOWER, KC_SPC, KC_SPC, M_UPPER, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
105 /* Note that KC_SPC is recorded TWICE, so that either matrix position can activate it */
107 [_RAISE] = { /* RAISE */
108 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
109 {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
110 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, QWERTY, KEYPAD, KEYPAD, RESET, _______},
111 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
113 [_LOWER] = { /* LOWER */
114 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
115 {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
116 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, QWERTY, KEYPAD, KEYPAD, RESET, _______},
117 {_______, KEYPAD, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
119 [_KEYPAD] = { /* Key Pad */
120 {KC_ESC, USERNAME, M(M_VERSION), KC_F10, KC_F11, KC_F12, KC_PGUP, KC_KP_ENTER, KC_7, KC_8, KC_9, KC_BSPC},
121 {KC_LCTL, RANDDIG, KC_F5, KC_F6, KC_F7, KC_F8, KC_PGDN, KC_KP_MINUS, KC_4, KC_5, KC_6, KC_PIPE},
122 {KC_LSFT, RANDALP, KC_F1, KC_F2, KC_F3, KC_F4, KC_DEL, KC_KP_PLUS, KC_1, KC_2, KC_3, KC_ENTER},
123 {BL_STEP, ROT_LED, KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, QWERTY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT}
126 [_ADJUST] = { /* Adjustments - gonna shift the wild tools in here */
127 { ROT_LED, USERNAME, M(M_VERSION), _______, _______, _______, _______, _______, _______, _______, _______, _______ },
128 {_______, RANDDIG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
129 {_______, RANDALP, _______, _______, _______, RESET, RESET, _______, _______, _______, _______, _______ },
130 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }
134 /* What is fn_actions actually used for??? */
135 const uint16_t PROGMEM fn_actions[] = {
138 /* This bit of logic seeds a wee linear congruential random number generator */
139 /* lots of prime numbers everywhere... */
140 static uint16_t random_value = 157;
142 const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
145 clockbyte = TCNT1 % 256;
147 // MACRODOWN only works in this function
150 if (record->event.pressed) {
151 register_code(KC_RSFT);
152 #ifdef BACKLIGHT_ENABLE
156 unregister_code(KC_RSFT);
160 if (record->event.pressed) {
161 SEND_STRING("cbbrowne");
165 if (record->event.pressed) {
166 SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP "@" QMK_VERSION "@" QMK_BUILDDATE);
170 /* Generate, based on random number generator, a keystroke for
171 a numeric digit chosen at random */
172 random_value = ((random_value + randadd) * randmul) % randmod;
173 if (record->event.pressed) {
174 /* Here, we mix the LCRNG with low bits from one of the system
175 clocks via XOR in the theory that this may be more random
176 than either separately */
177 rval = (random_value ^ clockbyte) % 10;
178 /* Note that KC_1 thru KC_0 are a contiguous range */
179 register_code (KC_1 + rval);
180 unregister_code (KC_1 + rval);
184 /* Generate, based on random number generator, a keystroke for
185 a letter chosen at random */
186 /* Here, we mix the LCRNG with low bits from one of the system
187 clocks via XOR in the theory that this may be more random
188 than either separately */
189 random_value = ((random_value + randadd) * randmul) % randmod;
190 if (record->event.pressed) {
191 rval = (random_value ^ clockbyte) % 26;
192 register_code (KC_A + rval);
193 unregister_code (KC_A + rval);
197 if (record->event.pressed)
200 update_tri_layer(_LOWER, _RAISE, _ADJUST);
205 update_tri_layer(_LOWER, _RAISE, _ADJUST);
209 if (record->event.pressed)
212 update_tri_layer(_LOWER, _RAISE, _ADJUST);
217 update_tri_layer(_LOWER, _RAISE, _ADJUST);