aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Grosse <ste3ls@gmail.com>2020-10-24 02:10:45 +0200
committerGitHub <noreply@github.com>2020-10-23 17:10:45 -0700
commit7daad08a9140024921d887a33c344eb2e7af393d (patch)
tree62f039477b289ec0e487a932d2a275b94ece9e32
parentd689f76110ee20e45d6531eac31bf72461ed504b (diff)
downloadqmk_firmware-7daad08a9140024921d887a33c344eb2e7af393d.tar.gz
qmk_firmware-7daad08a9140024921d887a33c344eb2e7af393d.zip
[Keymap] plaid keymap with custm LED animation (#10701)
-rw-r--r--keyboards/dm9records/plaid/keymaps/gipsy-king/keymap.c188
-rw-r--r--keyboards/dm9records/plaid/keymaps/gipsy-king/readme.md17
2 files changed, 205 insertions, 0 deletions
diff --git a/keyboards/dm9records/plaid/keymaps/gipsy-king/keymap.c b/keyboards/dm9records/plaid/keymaps/gipsy-king/keymap.c
new file mode 100644
index 000000000..c02c62244
--- /dev/null
+++ b/keyboards/dm9records/plaid/keymaps/gipsy-king/keymap.c
@@ -0,0 +1,188 @@
1/* Copyright 2020 Benjamin Große <ste3ls@gmail.com>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include QMK_KEYBOARD_H
18
19
20enum plaid_layers {
21 _QWERTY,
22 _XMONAD,
23 _RAISE,
24 _LOWER,
25};
26
27enum plaid_keycodes {
28 QWERTY = SAFE_RANGE
29};
30
31#define XMONAD LM(_XMONAD, MOD_LGUI)
32#define SPC_LWR LT(_LOWER, KC_SPACE)
33#define ENT_RSE LT(_RAISE, KC_ENT)
34#define LOWER LT(_LOWER, KC_BSPC)
35
36#define LS_ESC LSFT_T(KC_ESC)
37#define RS_QUOT RSFT_T(KC_QUOT)
38
39#define LCT_MINS LCTL_T(KC_MINS)
40#define RCT_EQL RCTL_T(KC_EQL)
41
42
43const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
44
45/* Qwerty
46 * ,-----------------------------------------------------------------------------------.
47 * | Tab | Q | W | E | R | T | Y | U | I | O | P |Bckspc|
48 * |------+------+------+------+------+-------------+------+------+------+------+------|
49 * | Esc | A | S | D | F | G | H | J | K | L | ; | ' |
50 * |------+------+------+------+------+------|------+------+------+------+------+------|
51 * | - | Z | X | C | V | B | N | M | , | . | / | = |
52 * |------+------+------+------+------+------+------+------+------+------+------+------|
53 * | Ctrl | Alt | GUI |XMONAD|LShift| Space |Ent/RA|RShift|LOWER | RAlt |RCtrl |
54 * `-----------------------------------------------------------------------------------'
55 */
56[_QWERTY] = LAYOUT_plaid_grid( // Base QWERTY
57 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
58 LS_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, RS_QUOT,
59 LCT_MINS,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RCT_EQL,
60 KC_LCTL, KC_LALT, KC_LGUI, XMONAD, KC_LSPO, KC_SPACE,_______, ENT_RSE, KC_RSPC, LOWER, KC_RALT, KC_RCTL
61),
62
63[_XMONAD] = LAYOUT_plaid_grid( // Xmonad with MOD4
64 KC_Q, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_P, _______,
65 KC_LSFT, _______, _______, _______, _______, _______, KC_H, KC_J, KC_K, KC_L, _______, _______,
66 KC_LSFT, _______, _______, KC_C, _______, KC_B, _______, _______, _______, _______, _______, _______,
67 _______, _______, _______, _______, _______, _______, _______, KC_ENT, _______, _______, _______, _______
68),
69
70/* Raised
71 * ,-----------------------------------------------------------------------------------.
72 * | ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | \ |
73 * |------+------+------+------+------+-------------+------+------+------+------+------|
74 * | ~ | { | PgUp | PgDn | End | Home | Left | Down | Up | Right| } | | |
75 * |------+------+------+------+------+------|------+------+------+------+------+------|
76 * | [ | ! | @ | # | $ | % | ^ | & | * | ( | ) | ] |
77 * |------+------+------+------+------+------+------+------+------+------+------+------|
78 * | | | | | | | | |VolDn |VolUp |Mute |
79 * `-----------------------------------------------------------------------------------'
80 */
81[_RAISE] = LAYOUT_plaid_grid( // Numbers, arrows, symbols
82 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS,
83 KC_TILD, KC_LCBR, KC_PGUP, KC_PGDN, KC_END, KC_HOME, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_RCBR, KC_PIPE,
84 KC_LBRC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_RBRC,
85 _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE
86),
87
88[_LOWER] = LAYOUT_plaid_grid( // F, media keys, reset
89 KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
90 _______, _______, MU_MOD, AU_ON, AU_OFF, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, RESET,
91 _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF,_______, _______, _______,
92 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
93)
94};
95
96#define BLINKEN_RANDOM_STARTLE false
97static uint16_t blinken_timer = 0;
98static uint16_t next_timeout = 1000;
99enum blinken_modes {
100 BLINK_HOLD,
101 BLINK_STARTLED,
102 BLINK_STARTLED_LAYER
103};
104static uint16_t blinken_mode = BLINK_HOLD;
105static uint16_t blinken_timer_startled = 0;
106static uint16_t blinken_startled_state = 0;
107
108void matrix_init_user(void) {
109 // https://github.com/hsgw/plaid/issues/15#issuecomment-534677102
110 eeconfig_init();
111}
112
113void keyboard_post_init_user(void) {
114 writePinHigh(LED_RED);
115 writePinHigh(LED_GREEN);
116 blinken_timer = timer_read();
117}
118
119void matrix_scan_user(void) {
120 if (blinken_mode != BLINK_STARTLED_LAYER && timer_elapsed(blinken_timer) > next_timeout) {
121 blinken_timer = timer_read();
122 if (BLINKEN_RANDOM_STARTLE && rand() % 5 == 0) {
123 blinken_mode = BLINK_STARTLED;
124 blinken_timer_startled = timer_read();
125 blinken_startled_state = 0;
126 } else {
127 blinken_mode = BLINK_HOLD;
128
129 if(rand() % 2 == 0) {
130 next_timeout = 1000;
131 } else if(rand() % 2 == 0) {
132 next_timeout = 500;
133 } else {
134 next_timeout = 300;
135 }
136
137 if(rand() % 2 == 0) {
138 writePinLow(LED_RED);
139 } else {
140 writePinHigh(LED_RED);
141 }
142 if(rand() % 2 == 0) {
143 writePinLow(LED_GREEN);
144 } else {
145 writePinHigh(LED_GREEN);
146 }
147 }
148 } else if ((blinken_mode == BLINK_STARTLED || blinken_mode == BLINK_STARTLED_LAYER)
149 && timer_elapsed(blinken_timer_startled) > 50) {
150 blinken_timer_startled = timer_read();
151 switch (blinken_startled_state) {
152 case 0:
153 writePinLow(LED_GREEN);
154 blinken_startled_state += 1;
155 break;
156 case 1:
157 writePinHigh(LED_RED);
158 blinken_startled_state += 1;
159 break;
160 case 2:
161 writePinHigh(LED_GREEN);
162 blinken_startled_state += 1;
163 break;
164 case 3:
165 writePinLow(LED_RED);
166 blinken_startled_state = 0;
167 break;
168 }
169 }
170}
171
172layer_state_t layer_state_set_user(layer_state_t state) {
173 switch (get_highest_layer(state)) {
174 case _RAISE:
175 blinken_mode = BLINK_STARTLED_LAYER;
176 break;
177 case _XMONAD:
178 blinken_mode = BLINK_STARTLED_LAYER;
179 break;
180 case _LOWER:
181 blinken_mode = BLINK_STARTLED_LAYER;
182 break;
183 default:
184 blinken_mode = BLINK_HOLD;
185 break;
186 }
187 return state;
188}
diff --git a/keyboards/dm9records/plaid/keymaps/gipsy-king/readme.md b/keyboards/dm9records/plaid/keymaps/gipsy-king/readme.md
new file mode 100644
index 000000000..1dc2bba12
--- /dev/null
+++ b/keyboards/dm9records/plaid/keymaps/gipsy-king/readme.md
@@ -0,0 +1,17 @@
1# Gipsy keymap for plaid
2
3This layout is based on my corne layout:
4* QWERTY with Tab, Backspace on top, dash and equals on the bottom.
5* RAISE has numbers on top, arrows on hjkl, end/home on F/G, symbols on the
6 bottom and around.
7* XMONAD has xmonad wm key bindings, should be used with Layer modifier LGUI
8* LOWER has F keys and shouldn't be used much.
9* Thumbs are: XMONAD, Left SC shift, Space, Enter/Raise, Right SC shift
10
11Does not have so many modtaps, basically just on enter.
12
13The LEDs of the plaid keep blinking in a soothing dance, reminiscent of some
14old machine.
15
16When any layer is active, the LEDs are "startled".
17