aboutsummaryrefslogtreecommitdiff
path: root/keyboards/xd75
diff options
context:
space:
mode:
authorJames Young <18669334+noroadsleft@users.noreply.github.com>2020-03-04 16:42:09 -0800
committerGitHub <noreply@github.com>2020-03-04 16:42:09 -0800
commit9550ab334232b73025e105a9d04f67e57aa3c02f (patch)
tree955fd1d3c2b96b48ca86f9871c37fd21698da90d /keyboards/xd75
parent607e2f6c310f2404933e791561912a0a35587aae (diff)
downloadqmk_firmware-9550ab334232b73025e105a9d04f67e57aa3c02f.tar.gz
qmk_firmware-9550ab334232b73025e105a9d04f67e57aa3c02f.zip
[Keymap] Adding the 4sStylZ xd75 (#8285)
* Adding the 4sStylZ xd75 * Update keyboards/xd75/keymaps/4sstylz/keycodes.h * Apply suggestions from code review
Diffstat (limited to 'keyboards/xd75')
-rw-r--r--keyboards/xd75/keymaps/4sstylz/config.h31
-rw-r--r--keyboards/xd75/keymaps/4sstylz/keycodes.h90
-rw-r--r--keyboards/xd75/keymaps/4sstylz/keymap.c186
-rw-r--r--keyboards/xd75/keymaps/4sstylz/leds.h46
-rw-r--r--keyboards/xd75/keymaps/4sstylz/readme.md4
-rw-r--r--keyboards/xd75/keymaps/4sstylz/rules.mk30
6 files changed, 387 insertions, 0 deletions
diff --git a/keyboards/xd75/keymaps/4sstylz/config.h b/keyboards/xd75/keymaps/4sstylz/config.h
new file mode 100644
index 000000000..3049141c2
--- /dev/null
+++ b/keyboards/xd75/keymaps/4sstylz/config.h
@@ -0,0 +1,31 @@
1/* Copyright 2017 Benjamin Kesselring
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#pragma once
18
19// place overrides here
20
21/* Enable the space-cadet options */
22#define RSPC_KEYS KC_RSFT, KC_TRNS, KC_PGUP
23#define RCPC_KEYS KC_RCTL, KC_TRNS, KC_PGDOWN
24#define LSPO_KEYS KC_LSFT, KC_TRNS, KC_HOME
25#define LCPO_KEYS KC_LCTL, KC_TRNS, KC_END
26
27#define COMBO_COUNT 1
28#define TAPPING_TERM 175
29
30#define BACKLIGHT_BREATHING
31#undef RGBLIGHT_ANIMATIONS
diff --git a/keyboards/xd75/keymaps/4sstylz/keycodes.h b/keyboards/xd75/keymaps/4sstylz/keycodes.h
new file mode 100644
index 000000000..d0460856b
--- /dev/null
+++ b/keyboards/xd75/keymaps/4sstylz/keycodes.h
@@ -0,0 +1,90 @@
1/*
2 * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3 * Version 2, December 2004
4 *
5 * Copyright (C) 2019 4sStylZ <4sstylz@protonmail.ch>
6 *
7 * Everyone is permitted to copy and distribute verbatim or modified
8 * copies of this license document, and changing it is allowed as long
9 * as the name is changed.
10 *
11 * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
12 * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
13 *
14 * 0. You just DO WHAT THE FUCK YOU WANT TO.
15 */
16#include QMK_KEYBOARD_H
17
18/**
19 * Macro for selecting all the text in the document.
20 * Usual shortcut : Ctrl+A.
21 *
22 * @param keyrecord_t *record
23 *
24 * @return void
25 */
26void select_all(keyrecord_t *record) {
27 if (record->event.pressed) {
28 tap_code16(C(KC_A));
29 }
30}
31
32/**
33 * Macro for selecting the current row.
34 *
35 * @param keyrecord_t *record
36 *
37 * @return void
38 */
39void select_row(keyrecord_t *record) {
40 if (record->event.pressed) {
41 tap_code(KC_HOME);
42 tap_code16(S(KC_END));
43 }
44}
45
46/**
47 * Macro for selecting the current word.
48 * Usage : You need to have the cursor into the word or directly at the right.
49 *
50 *
51 * Usual shortcut : Ctrl+A.
52 *
53 * @param keyrecord_t *record
54 *
55 * @return void
56 */
57void select_word(keyrecord_t *record) {
58 if (record->event.pressed) {
59 register_code(KC_LCTL);
60 tap_code(KC_LEFT);
61 tap_code16(S(KC_RGHT));
62 unregister_code(KC_LCTL);
63 }
64}
65
66/**
67 * Macro for inserting two 0 with keypad.
68 * Be carefull to have the keypad lock enabled
69 *
70 * @param keyrecord_t *record
71 *
72 * @return void
73 */
74void insert_00(keyrecord_t *record) {
75 if (record->event.pressed) {
76 tap_code16(S(KC_0));
77 tap_code16(S(KC_0));
78 }
79}
80
81/**
82 * Bépo Windows lock
83 *
84 * @param keyrecord_t *record
85 *
86 * @return void
87 */
88void windows_lock(void) {
89 tap_code16(G(KC_O));
90}
diff --git a/keyboards/xd75/keymaps/4sstylz/keymap.c b/keyboards/xd75/keymaps/4sstylz/keymap.c
new file mode 100644
index 000000000..d722da9c5
--- /dev/null
+++ b/keyboards/xd75/keymaps/4sstylz/keymap.c
@@ -0,0 +1,186 @@
1/* Copyright 2017 Wunder
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#include "keycodes.h"
18#include "leds.h"
19
20// Implement Super-alt↯tab
21// See https://docs.qmk.fm/#/feature_macros?id=super-alt↯tab
22bool is_alt_tab_active = false;
23uint16_t alt_tab_timer = 0;
24bool is_screen_lock_triggered = false;
25uint16_t screen_lock_timer = 0;
26
27// Defining all the custom keycodes.
28enum custom_keycodes {
29 ALT_TAB = SAFE_RANGE,
30 KC_00 ,
31 SLC_ROW,
32 SLC_ALL,
33 SLC_WRD
34};
35
36enum combo_events {
37 SCR_LCK
38};
39
40const uint16_t PROGMEM lock_combo[] = {KC_J, KC_K, KC_L, KC_SCLN, COMBO_END};
41combo_t key_combos[COMBO_COUNT] = {COMBO(lock_combo, SCR_LCK)};
42
43// Layer shorthand
44#define _QW 0
45#define _FN 1
46
47const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
48
49/* QWERTY
50 * ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┐
51 * │` Esc │ 1 │ 2 │ 3 │ 4 │ 5 │ Del │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │PrtScn│
52 * ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
53 * │ Tab │ Q │ W │ E │ R │ T │ Bksp │ Y │ U │ I │ O │ P │ [ │ ] │ Home │
54 * ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
55 * │ FN │ A │ S │ D │ F │ G │Enter │ H │ J │ K │ L │ ; │ ' │ # │ End │
56 * ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
57 * │ Shft │ Z │ X │ C │ V │ B │ALTTAB│ N │ M │ , │ . │ / │ Shft │ FN │ PgUp │
58 * ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
59 * │ Ctrl │ Gui │ Alt │ Back │ Frwd │Space │ App │Space │ Left │ Up │ Down │ Right│ Alt │ Ctrl │ PgDn │
60 * └──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘
61 */
62
63 [_QW] = LAYOUT_ortho_5x15( /* QWERTY */
64 KC_GESC, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_DEL , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINUS, KC_EQUAL, KC_PSCR,
65 KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_BSPC, KC_Y , KC_U , KC_I , KC_O , KC_P , KC_LBRC , KC_RBRC , KC_HOME,
66 MO(_FN), KC_A , KC_S , KC_D , KC_F , KC_G , KC_ENT , KC_H , KC_J , KC_K , KC_L , KC_SCLN , KC_QUOT , KC_NUHS , KC_END ,
67 KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , ALT_TAB, KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH , KC_RSFT , MO(_FN) , KC_PGUP,
68 KC_LCTL, KC_LGUI, KC_LALT, KC_WBAK, KC_WFWD, KC_SPC, KC_APP , KC_SPC, KC_LEFT, KC_UP , KC_DOWN, KC_RIGHT, KC_RALT , KC_RCTL , KC_PGDN
69 ),
70
71/* FUNCTION
72 * NB :  My OS  layout (Bépo) don't have direct access to numbers, so that's why I use « LSFT » mod for the keypad.
73 * You need to remove LSFT(KC) for using this layout with Qwerty. Also the use of KC_8, 7, and V are some specific Bépo
74 * things.
75 * ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┐
76 * │Alt F4│ F1 │ F2 │ F3 │ F4 │ F5 │BL Tog│ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │ # Lk │
77 * ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
78 * │ │ │SltAll│SltRow│SltRow│ Brt+ │BL Stp│ │ │ KP 7 │ KP 8 │ KP 9 │ 8 │ │ │
79 * ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
80 * │ │ │ Cut │ Copy │Paste │ Brt- │BL Brt│ │ │ KP 4 │ KP 5 │ KP 6 │ 7 │ │Reset │
81 * ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
82 * │ │ │ Mute │ Vol- │ Vol+ │ Play │Ld Tog│ │ │ KP 1 │ KP 2 │ KP 3 │Enter │ │ │
83 * ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
84 * │ │ │ │ │ │ │Ld M+ │ │ │ KP 0 │KC 00 │ V │ │ │ │
85 * └──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘
86 */
87
88 [_FN] = LAYOUT_ortho_5x15( /* FUNCTION */
89 LALT(KC_F4), KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , BL_TOGG, KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_NLCK,
90 _______ , _______, SLC_ALL , SLC_ROW , SLC_WRD , KC_BRIU, BL_STEP, _______, _______, LSFT(KC_7) , LSFT(KC_8) , LSFT(KC_9), KC_8 , _______, _______,
91 _______ , _______, LSFT(KC_DEL), LCTL(KC_INS), LSFT(KC_INS), KC_BRID, BL_BRTG, _______, _______, LSFT(KC_4) , LSFT(KC_5) , LSFT(KC_6), KC_7 , _______, RESET ,
92 _______ , _______, KC_MUTE , KC_VOLD , KC_VOLU , KC_MPLY, RGB_TOG, _______, _______, LSFT(KC_1) , LSFT(KC_2) , LSFT(KC_3), KC_ENT , _______, _______,
93 _______ , _______, _______ , _______ , _______ , _______, RGB_MOD, _______, _______, LSFT(KC_0) , KC_00 , KC_V , _______ , _______, _______
94 )
95};
96
97// Processing all the key pressed.
98// Alt+tab.
99bool process_record_user(uint16_t keycode, keyrecord_t *record) {
100
101 // Depending keycodes…
102 switch (keycode) { // This will do most of the grunt work with the keycodes.
103 case ALT_TAB:
104 if (record->event.pressed) {
105 if (!is_alt_tab_active) {
106 is_alt_tab_active = true;
107 gp100_led_on();
108 register_code(KC_LALT);
109 }
110 alt_tab_timer = timer_read();
111 register_code(KC_TAB);
112 } else {
113 unregister_code(KC_TAB);
114 }
115 break;
116 case KC_00:
117 insert_00(record);
118 break;
119 case SLC_ALL:
120 select_all(record);
121 break;
122 case SLC_ROW:
123 select_row(record);
124 break;
125 case SLC_WRD:
126 select_word(record);
127 break;
128 }
129 return true;
130}
131
132void process_combo_event(uint8_t combo_index, bool pressed) {
133 switch(combo_index) {
134 case SCR_LCK:
135 if (pressed) {
136 /*if (!is_screen_lock_triggered) {*/
137 is_screen_lock_triggered = true;
138 gp103_led_on();
139 windows_lock();
140 /*}*/
141 screen_lock_timer = timer_read();
142 }
143 break;
144 }
145}
146
147void matrix_scan_user(void) { // The very important timer.
148 if (is_alt_tab_active) {
149 if (timer_elapsed(alt_tab_timer) > 750) {
150 unregister_code(KC_LALT);
151 gp100_led_off();
152 is_alt_tab_active = false;
153 }
154 }
155 if (is_screen_lock_triggered) {
156 if (timer_elapsed(screen_lock_timer) > 750) {
157 gp103_led_off();
158 is_screen_lock_triggered = false;
159 }
160 }
161}
162
163void led_set_user(uint8_t usb_led) {
164 if (IS_LAYER_ON(_FN)) {
165 capslock_led_on();
166 } else {
167 capslock_led_off();
168 }
169}
170
171void keyboard_post_init_user (void) {
172 setDefaultDisplay();
173}
174
175layer_state_t layer_state_set_user(layer_state_t state) {
176 switch (get_highest_layer(state)) {
177 case _FN:
178 setFNDisplay();
179 break;
180
181 default: // for any other layers, or the default layer
182 setDefaultDisplay();
183 break;
184 }
185 return state;
186}
diff --git a/keyboards/xd75/keymaps/4sstylz/leds.h b/keyboards/xd75/keymaps/4sstylz/leds.h
new file mode 100644
index 000000000..a5ad863b0
--- /dev/null
+++ b/keyboards/xd75/keymaps/4sstylz/leds.h
@@ -0,0 +1,46 @@
1/*
2 * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3 * Version 2, December 2004
4 *
5 * Copyright (C) 2019 4sStylZ <4sstylz@protonmail.ch>
6 *
7 * Everyone is permitted to copy and distribute verbatim or modified
8 * copies of this license document, and changing it is allowed as long
9 * as the name is changed.
10 *
11 * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
12 * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
13 *
14 * 0. You just DO WHAT THE FUCK YOU WANT TO.
15 */
16#include QMK_KEYBOARD_H
17
18void setDefaultDisplay(void) {
19 _delay_ms(10);
20 rgblight_setrgb_at(180, 35, 0, 0);
21 _delay_ms(10);
22 rgblight_setrgb_at(200, 35, 0, 1);
23 _delay_ms(10);
24 rgblight_setrgb_at(220, 35, 0, 2);
25 _delay_ms(10);
26 rgblight_setrgb_at(220, 35, 0, 3);
27 _delay_ms(10);
28 rgblight_setrgb_at(200, 35, 0, 4);
29 _delay_ms(10);
30 rgblight_setrgb_at(180, 35, 0, 5);
31}
32
33void setFNDisplay(void) {
34 _delay_ms(10);
35 rgblight_setrgb_at(145, 45, 0, 0);
36 _delay_ms(10);
37 rgblight_setrgb_at(160, 45, 0, 1);
38 _delay_ms(10);
39 rgblight_setrgb_at(175, 45, 0, 2);
40 _delay_ms(10);
41 rgblight_setrgb_at(190, 45, 0, 3);
42 _delay_ms(10);
43 rgblight_setrgb_at(205, 45, 0, 4);
44 _delay_ms(10);
45 rgblight_setrgb_at(220, 45, 0, 5);
46}
diff --git a/keyboards/xd75/keymaps/4sstylz/readme.md b/keyboards/xd75/keymaps/4sstylz/readme.md
new file mode 100644
index 000000000..31efa071f
--- /dev/null
+++ b/keyboards/xd75/keymaps/4sstylz/readme.md
@@ -0,0 +1,4 @@
1# Personal keymap of 4sStylZ
2
3* Similar to a Typematrix 2030 layout,
4* 3 leds on the GP001, GP003 and Capslock led
diff --git a/keyboards/xd75/keymaps/4sstylz/rules.mk b/keyboards/xd75/keymaps/4sstylz/rules.mk
new file mode 100644
index 000000000..ffb70f0a9
--- /dev/null
+++ b/keyboards/xd75/keymaps/4sstylz/rules.mk
@@ -0,0 +1,30 @@
1# Copyright 2013 Jun Wako <wakojun@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
16COMBO_ENABLE = yes # Enable combo for special function when using multiple keys at once.
17BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
18RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
19
20BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
21MOUSEKEY_ENABLE = no # Mouse keys
22EXTRAKEY_ENABLE = yes # Audio control and System control
23CONSOLE_ENABLE = no # Console for debug
24COMMAND_ENABLE = no # Commands for debug and configuration
25NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
26MIDI_ENABLE = no # MIDI support
27AUDIO_ENABLE = no # Audio output on port C6
28UNICODE_ENABLE = no # Unicode
29BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
30SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend