2020 February 29 Breaking Changes Update (#8064)
[jackhill/qmk/firmware.git] / keyboards / sentraq / s60_x / keymaps / ansi_qwertz / keymap.c
CommitLineData
07924511
FU
1/*
2Copyright 2016 Julien Pecqueur <julien@peclu.net>
3Copyright 2016 Felix Uhl <ifreilicht@gmail.com>
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13You should have received a copy of the GNU General Public License
14along with this program. If not, see <http://www.gnu.org/licenses/>.
15*/
16
51703984 17#include QMK_KEYBOARD_H
07924511 18
07924511
FU
19#define ONESHOT_TAP_TOGGLE 2
20#define ONESHOT_TIMEOUT 1
21
22//uncomment to activate dead keys
23//#define DONT_REVIVE_DEADKEYS 1
24
25//Function keycodes for better readability
26//SpaceFN
27//OneShot LeftShift
28//GamingMode Lock (disables SpaceFn and OneShot LShift)
29//Function
30//Mute microphone
26eef35f 31#define KC_SPACEFN LT(2, KC_SPACE)
07924511
FU
32#define KC_OSLS KC_FN3
33#define KC_GMLK KC_FN1
554e4bf2 34#define KC_FUNC MO(2)
07924511
FU
35#define MICMUTE RCTL(KC_LCTL)
36
37enum function_codes {
07924511
FU
38 F_OSLS = 3,
39 F_GMLK = 1,
07924511
FU
40};
41
42enum layer_names {
43 DEFAULT,
44 GAMING,
45 FUNCTION
46};
47
48enum languages {
49 GERMAN
50};
51
52#define LANGUAGE GERMAN
53
54enum custom_keycodes {
55 KC_CM_A = SAFE_RANGE,
56// KC_CM_B,
57 KC_CM_C,
58// KC_CM_D,
59 KC_CM_E,
60// KC_CM_F,
61 KC_CM_G,
62// KC_CM_H,
63 KC_CM_I,
64// KC_CM_J,
65 KC_CM_K,
66 KC_CM_L,
67 KC_CM_M,
68 KC_CM_N,
69 KC_CM_O,
70 KC_CM_P,
71// KC_CM_Q,
72 KC_CM_R,
73 KC_CM_S,
74// KC_CM_T,
75 KC_CM_U,
76// KC_CM_V,
77 KC_CM_W,
78// KC_CM_X,
73f13c8f 79 KC_CM_Y,
07924511
FU
80 KC_CM_Z
81};
82
83const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
84 /* Layout 0: Default Layer
85 * ,-----------------------------------------------------------.
86 * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \|Del|
87 * |-----------------------------------------------------------|
88 * |Tab | Q| W| E| R| T| Z| U| I| O| P| [| ]|BckSp|
89 * |-----------------------------------------------------------|
90 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Return |
91 * |-----------------------------------------------------------|
92 * |Shift | Y| X| C| V| B| N| M| ,| .| /| Up |RSft|
93 * |-----------------------------------------------------------|
94 * |Fn2 |Gui |Alt | SpaceFn |Alt |Left|Down|Right|
95 * `-----------------------------------------------------------'
96 */
1f778684 97 [DEFAULT] = LAYOUT(
07924511
FU
98 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, KC_BSLS, KC_DEL, \
99 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, \
100 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, \
51703984 101 KC_LSFT, KC_NUBS, KC_Y, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, KC_RSFT, \
07924511
FU
102 KC_FUNC, KC_LGUI, KC_LALT, KC_SPACEFN, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT
103 ),
104
105 /* Layout 1: Gaming Layer, SpaceFn disabled
106 * ,-----------------------------------------------------------.
107 * | | | | | | | | | | | | | | | |
108 * |-----------------------------------------------------------|
109 * | | | | | | | | | | | | | | |
110 * |-----------------------------------------------------------|
111 * | | | | | | | | | | | | | |
112 * |-----------------------------------------------------------|
113 * | | | | | | | | | | | | |Fn1 |
114 * |-----------------------------------------------------------|
115 * | |RSft| | Space | | | | |
116 * `-----------------------------------------------------------'
117 */
1f778684 118 [GAMING] = LAYOUT(
07924511
FU
119 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
120 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
121 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
51703984 122 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_GMLK, \
07924511
FU
123 _______, KC_RSFT, _______, KC_SPC, _______, _______, _______, _______
124 ),
125
126 /* Layout 2: Function Layer
127 * MicMute requires special software to be installed. Check readme.md for more information
128 * ,-----------------------------------------------------------.
129 * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|RES|
130 * |-----------------------------------------------------------|
1f778684 131 * | | | | |Prv|Ply|Nxt| � | | � | |Prt|Slk|Pau |
07924511 132 * |-----------------------------------------------------------|
1f778684 133 * | | � | � | |Vl-|Mut|Vl+| | | | | |PEnt |
07924511
FU
134 * |-----------------------------------------------------------|
135 * | | | | |MicMut|Cal| | | | |Pau |PUp |Fn1 |
136 * |-----------------------------------------------------------|
137 * | | | | | |Home|PDn |End |
138 * `-----------------------------------------------------------'
139 */
1f778684 140 [FUNCTION] = LAYOUT(
07924511 141 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, KC_INS, RESET, \
73f13c8f 142 _______, _______, KC_CM_W, KC_CM_E, KC_MPRV, KC_MPLY, KC_MNXT, KC_CM_U, KC_CM_I, KC_CM_O, KC_CM_P, KC_PSCR, KC_SLCK, KC_PAUS, \
07924511 143 _______, KC_CM_A, KC_CM_S, _______, KC_VOLD, KC_MUTE, KC_VOLU, _______, KC_CM_K, KC_CM_L, _______, _______, _______, KC_PENT, \
51703984 144 _______, _______, KC_CM_Y, _______, KC_CM_C, MICMUTE, KC_CALC, KC_CM_N, KC_CM_M, _______, _______, _______, KC_PGUP, KC_GMLK, \
07924511
FU
145 _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END
146 ),
147};
148
149/*
150* Fn action definition
151*/
152const uint16_t PROGMEM fn_actions[] = {
07924511 153 [F_GMLK] = ACTION_LAYER_TOGGLE(1), // Disable SpaceFn and Oneshot Shift
07924511
FU
154 [F_OSLS] = ACTION_MODS_ONESHOT(MOD_LSFT) // Oneshot Leftshift
155};
156
07924511
FU
157void matrix_init_user(void) {
158
159}
160
161void matrix_scan_user(void) {
162
163}
164
165bool process_german(uint16_t keycode, keyrecord_t *record) {
166 uint16_t send_code = 0;
167 if (record->event.pressed) {
168 switch (keycode) {
73f13c8f 169 case KC_CM_A:
07924511
FU
170 send_code = KC_Q;
171 break;
73f13c8f 172 case KC_CM_O:
07924511
FU
173 send_code = KC_P;
174 break;
73f13c8f 175 case KC_CM_U:
07924511
FU
176 send_code = KC_Y;
177 break;
73f13c8f 178 case KC_CM_S:
07924511
FU
179 send_code = KC_S;
180 break;
181 }
182
183 if (send_code == 0) {
184 return true;
185 }
186 else {
187 register_code(KC_RALT);
188 register_code(send_code);
189 unregister_code(send_code);
190 unregister_code(KC_RALT);
191 return false;
192 }
193 }
73f13c8f 194 return true;
07924511
FU
195}
196
197bool process_record_user(uint16_t keycode, keyrecord_t *record) {
198 //revive dead keys
199#ifndef DONT_REVIVE_DEADKEYS
200 bool shift_active = keyboard_report->mods & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_LSFT));
201 bool altgr_active = keyboard_report->mods & (MOD_BIT(KC_RALT));
1f778684 202 if ((keycode == KC_QUOT && !altgr_active) ||
07924511 203 keycode == KC_GRV ||
1f778684 204 (keycode == KC_6 && shift_active))
07924511
FU
205 {
206 if (record->event.pressed) {
207 register_code(keycode);
208 unregister_code(keycode);
209 register_code(KC_SPACE);
210 unregister_code(KC_SPACE);
211 }
212 return false;
213 }
214#endif
215#if LANGUAGE == GERMAN
216 return process_german(keycode, record);
217#else
218 return true;
219#endif
220}
221
222void led_set_user(uint8_t usb_led) {
223
1f778684 224}