aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/v60_type_r/keymaps/xtonhasvim/config.h24
-rw-r--r--keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c196
-rw-r--r--keyboards/v60_type_r/keymaps/xtonhasvim/readme.md20
-rw-r--r--keyboards/v60_type_r/keymaps/xtonhasvim/rules.mk5
-rw-r--r--keyboards/v60_type_r/rules.mk2
-rw-r--r--users/xtonhasvim/fancylighting.c7
-rw-r--r--users/xtonhasvim/fancylighting.h9
-rw-r--r--users/xtonhasvim/xtonhasvim.h6
8 files changed, 259 insertions, 10 deletions
diff --git a/keyboards/v60_type_r/keymaps/xtonhasvim/config.h b/keyboards/v60_type_r/keymaps/xtonhasvim/config.h
new file mode 100644
index 000000000..997802a56
--- /dev/null
+++ b/keyboards/v60_type_r/keymaps/xtonhasvim/config.h
@@ -0,0 +1,24 @@
1/* Copyright 2018 Christon DeWan (Xton)
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
18#pragma once
19
20#define V60_POLESTAR
21
22#define PERMISSIVE_HOLD
23
24
diff --git a/keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c b/keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c
new file mode 100644
index 000000000..ec337bb22
--- /dev/null
+++ b/keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c
@@ -0,0 +1,196 @@
1/* Copyright 2018 Christon DeWan (Xton)
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#include QMK_KEYBOARD_H
17
18#include "xtonhasvim.h"
19#include "fancylighting.h"
20
21#define _______ KC_TRNS
22#define X_____X KC_NO
23
24enum layers {
25 _QWERTY,
26 _FUN,
27 _MOVE,
28 _CMD
29};
30
31enum layout_key_codes {
32 IND_BRI = VIM_SAFE_RANGE,
33 IND_DIM
34};
35
36extern uint8_t vim_cmd_layer(void) { return _CMD; }
37
38const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39 [_QWERTY] = LAYOUT_all(
40 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, X_____X, KC_BSPC, \
41 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \
42 LT(_MOVE, KC_CAPS), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \
43 KC_LSFT, X_____X, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, X_____X, \
44 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, VIM_START, MO(_FUN)),
45
46
47 [_MOVE] = LAYOUT_all(
48 X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X,
49 X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, KC_HOME, KC_PGDN, KC_PGUP, KC_END, X_____X, X_____X, X_____X, X_____X,
50 _______, X_____X, LGUI(KC_LBRC), LGUI(LSFT(KC_LBRC)), LGUI(LSFT(KC_RBRC)), LGUI(KC_RBRC), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, X_____X, X_____X, VIM_START,
51 _______, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, _______,
52 _______, _______, _______, _______, _______, _______, _______, _______),
53
54
55 [_FUN] = LAYOUT_all(
56 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, X_____X, KC_DEL, \
57 X_____X, X_____X, KC_UP, RGB_TOG, IND_BRI, X_____X, X_____X, X_____X, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, X_____X, KC_INS, \
58 X_____X, KC_LEFT, KC_DOWN, KC_RIGHT, IND_DIM, X_____X, X_____X, X_____X, KC_HOME, KC_PGUP, KC_LEFT, KC_RIGHT, FIREY_RETURN, \
59 _______, X_____X, BL_INC, BL_STEP, BL_DEC, X_____X, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_DOWN, _______, X_____X, \
60 _______, _______, _______, X_____X, _______, _______, X_____X, _______
61 ),
62
63 [_CMD] = LAYOUT_all(
64 VIM_ESC, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X,
65 X_____X, X_____X, VIM_W, VIM_E, X_____X, X_____X, VIM_Y, VIM_U, VIM_I, VIM_O, VIM_P, X_____X, X_____X, X_____X,
66 _______, VIM_A, VIM_S, VIM_D, X_____X, VIM_G, VIM_H, VIM_J, VIM_K, VIM_L, X_____X, X_____X, X_____X,
67 VIM_SHIFT, X_____X, X_____X, VIM_X, VIM_C, VIM_V, VIM_B, X_____X, X_____X, VIM_COMMA, VIM_PERIOD, X_____X, VIM_SHIFT,X_____X,
68 _______, _______, _______, _______, _______, _______, _______, TO(_QWERTY)
69 )
70};
71
72
73void led_set_user(uint8_t usb_led) {
74 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
75 // output low
76 DDRE |= (1<<PE6);
77 PORTE &= ~(1<<PE6);
78 }
79 else {
80 // Hi-Z
81 DDRE &= ~(1<<PE6);
82 PORTE &= ~(1<<PE6);
83 }
84}
85
86#define C_RED 0xFF, 0x00, 0x00
87#define C_GRN 0x00, 0xFF, 0x00
88#define C_BLU 0x00, 0x00, 0xFF
89
90#define C_YAN 0x00, 0xFF, 0xFF
91#define C_PRP 0x7A, 0x00, 0xFF
92#define C_ORG 0xFF, 0x93, 0x00
93
94float rgb_brightness = 1.0;
95
96/** the underglow LEDs aren't individually addressable, sadly */
97void rgbflag(uint8_t r, uint8_t g, uint8_t b) {
98 float rgb_brightness = ((float)rgblight_get_val())/256;
99 if(rgb_brightness == 0) rgb_brightness = 0.05;
100 LED_TYPE *target_led = user_rgb_mode ? shadowed_led : led;
101 target_led[0].r = (uint8_t)(r*rgb_brightness);
102 target_led[0].g = (uint8_t)(g*rgb_brightness);
103 target_led[0].b = (uint8_t)(b*rgb_brightness);
104 rgblight_set(); // just to handle turning off if that's required
105}
106
107void set_state_leds(void) {
108 switch (biton32(layer_state)) {
109 case _MOVE:
110 rgbflag(C_BLU);
111 break;
112 case _FUN:
113 rgbflag(C_PRP);
114 break;
115 case _CMD:
116 switch(vstate) {
117 case VIM_V:
118 case VIM_VI:
119 case VIM_VS:
120 case VIM_C:
121 case VIM_CI:
122 case VIM_D:
123 case VIM_DI:
124 rgbflag(C_RED);
125 break;
126 case VIM_G:
127 rgbflag(C_PRP);
128 break;
129 case VIM_Y:
130 rgbflag(C_ORG);
131 break;
132 case VIM_START:
133 default:
134 rgbflag(C_GRN);
135 break;
136 }
137 break;
138 default: // for any other layers, or the default layer
139 rgbflag(C_YAN);
140 break;
141 }
142}
143
144#define RGBLIGHT_LIMIT_VAL 255
145#define RGBLIGHT_BASE_VAL 3
146extern rgblight_config_t rgblight_config;
147extern backlight_config_t backlight_config;
148
149bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
150 if (record->event.pressed) {
151 switch(keycode) {
152 case IND_BRI:
153 if (rgblight_config.val + RGBLIGHT_VAL_STEP > RGBLIGHT_LIMIT_VAL) {
154 rgblight_config.val = RGBLIGHT_LIMIT_VAL;
155 } else {
156 rgblight_config.val = rgblight_config.val + RGBLIGHT_VAL_STEP;
157 }
158 eeconfig_update_rgblight(rgblight_config.raw);
159 set_state_leds();
160 break;
161 case IND_DIM:
162 if (rgblight_config.val - RGBLIGHT_VAL_STEP < RGBLIGHT_BASE_VAL) {
163 rgblight_config.val = RGBLIGHT_BASE_VAL;
164 } else {
165 rgblight_config.val = rgblight_config.val - RGBLIGHT_VAL_STEP;
166 }
167 eeconfig_update_rgblight(rgblight_config.raw);
168 set_state_leds();
169 break;
170 }
171 }
172 return true;
173}
174
175void suspend_power_down_user(void)
176{
177 // rgb
178 rgblight_config.enable = false;
179 rgblight_set();
180
181 // backlight
182 /** I don't know why, but 3 means "off" and down is up */
183 backlight_config.level = 3;
184 backlight_config.enable = false;
185 backlight_set(3);
186}
187
188void suspend_wakeup_init_user(void)
189{
190 rgblight_config.raw = eeconfig_read_rgblight();
191 backlight_config.raw = eeconfig_read_backlight();
192
193 backlight_set(backlight_config.level);
194 rgblight_set();
195}
196
diff --git a/keyboards/v60_type_r/keymaps/xtonhasvim/readme.md b/keyboards/v60_type_r/keymaps/xtonhasvim/readme.md
new file mode 100644
index 000000000..541faed2b
--- /dev/null
+++ b/keyboards/v60_type_r/keymaps/xtonhasvim/readme.md
@@ -0,0 +1,20 @@
1KB Paradise V60 Type R Xton Has Vim! Layout
2======================
3
4If you don't look closely, this layout mimics the default layout fairly well. Care
5is taken to match the FN layer to the keycaps that the TypeR comes with. I wrote this layout
6for a keyboard that I'm giving my intern as a parting gift and wanted it to be as easy to learn
7as possible.
8
9The key differences:
10
11- Holding capslock down activates the movement layer, much like the vimouse layout except that I'm using the xtonhasvim movement layer.
12- Capslock+return (or right-control) activates vim mode!
13
14## Keymap Notes
15
16- Alternate underglow modes are not supported. Instead the underglow is used to indicate state. It can be turned off and dimmed. Polestar underglow LEDs are not individually addressable, sadly.
17
18### Build
19
20To build this keymap, simply run `make v60_type_r:xtonhasvim` from the root project directory. Flash using QMK Toolbox
diff --git a/keyboards/v60_type_r/keymaps/xtonhasvim/rules.mk b/keyboards/v60_type_r/keymaps/xtonhasvim/rules.mk
new file mode 100644
index 000000000..6f9d7cc39
--- /dev/null
+++ b/keyboards/v60_type_r/keymaps/xtonhasvim/rules.mk
@@ -0,0 +1,5 @@
1BACKLIGHT_ENABLE = yes
2RGBLIGHT_ENABLE = yes
3MOUSEKEY_ENABLE = no
4CONSOLE_ENABLE = no # Console for debug(+400)
5DEBUG_ENABLE = no
diff --git a/keyboards/v60_type_r/rules.mk b/keyboards/v60_type_r/rules.mk
index afd65cd1a..30038d562 100644
--- a/keyboards/v60_type_r/rules.mk
+++ b/keyboards/v60_type_r/rules.mk
@@ -68,4 +68,4 @@ BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
68AUDIO_ENABLE ?= no # Audio output on port C6 68AUDIO_ENABLE ?= no # Audio output on port C6
69FAUXCLICKY_ENABLE ?= no # Use buzzer to emulate clicky switches 69FAUXCLICKY_ENABLE ?= no # Use buzzer to emulate clicky switches
70 70
71LAYOUTS = 60_ansi \ No newline at end of file 71LAYOUTS = 60_ansi
diff --git a/users/xtonhasvim/fancylighting.c b/users/xtonhasvim/fancylighting.c
index f4af5ec55..dc13df03f 100644
--- a/users/xtonhasvim/fancylighting.c
+++ b/users/xtonhasvim/fancylighting.c
@@ -34,9 +34,14 @@ void matrix_scan_keymap(void) {
34#define FADE_BACK_TIME 500 34#define FADE_BACK_TIME 500
35#define BREATH_FIRE_TIME 1000 35#define BREATH_FIRE_TIME 1000
36#define ANIMATION_STEP_INTERVAL 20 36#define ANIMATION_STEP_INTERVAL 20
37
38#if RGBLED_NUM >= 2
37#define POWER_KEY_OFFSET (RGBLED_NUM / 2) 39#define POWER_KEY_OFFSET (RGBLED_NUM / 2)
38#define SPACE_OFFSET_MAX (RGBLED_NUM / 2) 40#define SPACE_OFFSET_MAX (RGBLED_NUM / 2)
39 41#else
42#define POWER_KEY_OFFSET 1
43#define SPACE_OFFSET_MAX 1
44#endif
40 45
41uint16_t effect_start_timer = 0; 46uint16_t effect_start_timer = 0;
42uint8_t user_rgb_mode = 0; 47uint8_t user_rgb_mode = 0;
diff --git a/users/xtonhasvim/fancylighting.h b/users/xtonhasvim/fancylighting.h
index 982010d3d..02fb58b84 100644
--- a/users/xtonhasvim/fancylighting.h
+++ b/users/xtonhasvim/fancylighting.h
@@ -1,4 +1,4 @@
1p /* Copyright 2015-2017 Christon DeWan 1/* Copyright 2015-2017 Christon DeWan
2 * 2 *
3 * This program is free software: you can redistribute it and/or modify 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 4 * it under the terms of the GNU General Public License as published by
@@ -20,16 +20,17 @@ p /* Copyright 2015-2017 Christon DeWan
20 20
21#include "xtonhasvim.h" 21#include "xtonhasvim.h"
22 22
23
23extern uint8_t user_rgb_mode; 24extern uint8_t user_rgb_mode;
24extern LED_TYPE shadowed_led[]; 25extern LED_TYPE shadowed_led[];
25 26
26void start_firey_return(void);
27 27
28#endif //_fancy_lighting_h 28#endif //RGBLIGHT_ENABLE
29void start_firey_return(void);
29 30
30enum xtonhasvim_rgbmodes { 31enum xtonhasvim_rgbmodes {
31 BREATH_FIRE = 1, 32 BREATH_FIRE = 1,
32 FADE_BACK 33 FADE_BACK
33}; 34};
34 35
35#endif //RGBLIGHT_ENABLE 36#endif //_fancy_lighting_h
diff --git a/users/xtonhasvim/xtonhasvim.h b/users/xtonhasvim/xtonhasvim.h
index 5ff4932a4..2d6670a5e 100644
--- a/users/xtonhasvim/xtonhasvim.h
+++ b/users/xtonhasvim/xtonhasvim.h
@@ -22,11 +22,9 @@
22 22
23#define X_____X KC_NO 23#define X_____X KC_NO
24 24
25bool process_record_xtonhasvim(uint16_t keycode, keyrecord_t *record);
26
27enum xtonhasvim_keycodes { 25enum xtonhasvim_keycodes {
28 DUMMY = SAFE_RANGE, 26 // 20: give keyboard-specific codes some room
29 FIREY_RETURN, // kick off special effects 27 FIREY_RETURN = SAFE_RANGE + 20, // kick off special effects
30 VIM_START, // bookend for vim states 28 VIM_START, // bookend for vim states
31 VIM_A, 29 VIM_A,
32 VIM_B, 30 VIM_B,