2018-06-30 15:31:26 +02:00
|
|
|
/* Copyright 2015-2017 Jack Humbert
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "contra.h"
|
|
|
|
#include "keymap_german.h"
|
|
|
|
|
|
|
|
enum contra_layers {
|
|
|
|
_QWERTZ,
|
2019-01-28 01:59:48 +01:00
|
|
|
_FN,
|
|
|
|
_NR,
|
|
|
|
_NR_L3,
|
|
|
|
_FX,
|
2018-10-15 22:23:19 +02:00
|
|
|
_GAMING
|
2018-06-30 15:31:26 +02:00
|
|
|
};
|
|
|
|
|
2019-01-28 01:59:48 +01:00
|
|
|
#define KC_I3 LM(_NR, MOD_LALT)
|
|
|
|
#define KC_NR SAFE_RANGE
|
|
|
|
#define KC_N3 (SAFE_RANGE + 1)
|
|
|
|
#define KC_FN MO(_FN)
|
2018-10-15 22:23:19 +02:00
|
|
|
#define G_1 TO(_GAMING)
|
|
|
|
#define G_0 TG(_GAMING)
|
2018-06-30 15:31:26 +02:00
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
|
|
|
|
/* Qwertz
|
|
|
|
* ,-----------------------------------------------------------------------------------.
|
|
|
|
* | Esc | Q | W | E | R | T | Z | U | I | O | P | Bksp |
|
|
|
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
|
|
|
* | Tab | A | S | D | F | G | H | J | K | L | +* ~ | Enter|
|
|
|
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
|
|
|
* | Shift| Y | X | C | V | B | N | M | , | . | Up | Shift|
|
|
|
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
2018-08-01 02:58:52 +02:00
|
|
|
* | Ctrl | Sup | Alt | i3 | NumR | Space | Spec | Fun | Left | Down | Right|
|
2018-06-30 15:31:26 +02:00
|
|
|
* `-----------------------------------------------------------------------------------'
|
|
|
|
*/
|
|
|
|
[_QWERTZ] = {
|
|
|
|
{KC_GESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
|
|
|
|
{KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, DE_PLUS, KC_ENT },
|
|
|
|
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_RSFT},
|
2019-01-28 01:59:48 +01:00
|
|
|
{KC_LCTL, KC_LGUI, KC_LALT, KC_I3, KC_NR, KC_SPC, KC_SPC, KC_N3, KC_FN, KC_LEFT, KC_DOWN, KC_RGHT}
|
2018-06-30 15:31:26 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
/* Function layer
|
|
|
|
* ,-----------------------------------------------------------------------------------.
|
|
|
|
* | | | | | | | | Ü | | Ö | | Del |
|
|
|
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
2018-10-15 22:23:19 +02:00
|
|
|
* | Lock | Ä | ß | | | GAME | | RGBS | RGBB | RGBS | | |
|
2018-06-30 15:31:26 +02:00
|
|
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
|
|
|
* | | | | | | | | RGBH-| RGBT | RGBH+| PgUp | |
|
|
|
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
2019-01-28 01:59:48 +01:00
|
|
|
* | | | | ---- | ---- | | ---- | ---- | Home | PgDn | End |
|
2018-06-30 15:31:26 +02:00
|
|
|
* `-----------------------------------------------------------------------------------'
|
|
|
|
*/
|
2019-01-28 01:59:48 +01:00
|
|
|
[_FN] = {
|
2021-07-06 01:05:11 +02:00
|
|
|
{_______, _______, _______, _______, _______, _______, _______, DE_UDIA, _______, DE_ODIA, _______, KC_DEL },
|
|
|
|
{KC_LOCK, DE_ADIA, DE_SS, _______, _______, G_1, _______, RGB_M_P, RGB_M_B, RGB_M_SW,_______, _______},
|
2018-06-30 15:31:26 +02:00
|
|
|
{_______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_TOG, RGB_HUI, KC_PGUP, _______},
|
|
|
|
{_______, _______, _______, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, KC_HOME, KC_PGDN, KC_END }
|
|
|
|
},
|
|
|
|
|
|
|
|
/* Numrow layer (special characters with Shift and ISO_L3_Shift)
|
|
|
|
* ,-----------------------------------------------------------------------------------.
|
2019-01-27 09:23:58 +01:00
|
|
|
* | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | \ |
|
2018-06-30 15:31:26 +02:00
|
|
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
2018-08-01 02:58:52 +02:00
|
|
|
* | | | | | | | | | | | #' | |
|
2018-06-30 15:31:26 +02:00
|
|
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
2018-08-01 02:58:52 +02:00
|
|
|
* | | <> | | | | | | | | | | -_ | |
|
2018-06-30 15:31:26 +02:00
|
|
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
2019-01-28 01:59:48 +01:00
|
|
|
* | | | | ---- | ---- | | ---- | ---- | | | |
|
2018-06-30 15:31:26 +02:00
|
|
|
* `-----------------------------------------------------------------------------------'
|
|
|
|
*/
|
2019-01-28 01:59:48 +01:00
|
|
|
[_NR] = {
|
2018-10-15 22:23:19 +02:00
|
|
|
{_______, DE_1, DE_2, DE_3, DE_4, DE_5, DE_6, DE_7, DE_8, DE_9, DE_0, _______},
|
2018-08-01 02:58:52 +02:00
|
|
|
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, DE_HASH, _______},
|
2021-07-06 01:05:11 +02:00
|
|
|
{_______, DE_LABK, _______, _______, _______, _______, _______, _______, _______, _______, DE_MINS, _______},
|
2019-01-28 01:59:48 +01:00
|
|
|
{_______, _______, _______, XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______}
|
2018-10-15 22:23:19 +02:00
|
|
|
},
|
2019-01-28 01:59:48 +01:00
|
|
|
[_NR_L3] = {
|
2019-01-27 09:23:58 +01:00
|
|
|
{_______, DE_1, DE_2, DE_3, DE_4, DE_5, DE_6, DE_7, DE_8, DE_9, DE_0, DE_SS },
|
2018-10-15 22:23:19 +02:00
|
|
|
{_______, DE_Q, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
|
2021-07-06 01:05:11 +02:00
|
|
|
{_______, DE_LABK, _______, _______, _______, _______, _______, _______, _______, _______, DE_MINS, _______},
|
2019-01-28 01:59:48 +01:00
|
|
|
{_______, _______, _______, XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______}
|
|
|
|
},
|
|
|
|
|
|
|
|
/* Function keys
|
|
|
|
* ,-----------------------------------------------------------------------------------.
|
|
|
|
* | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
|
|
|
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
|
|
|
* | | | | | | | | | | | | |
|
|
|
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
|
|
|
* | | | | | | | | | | | | |
|
|
|
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
|
|
|
* | | | | | | | | | | | |
|
|
|
|
* `-----------------------------------------------------------------------------------'
|
|
|
|
*/
|
|
|
|
[_FX] = {
|
|
|
|
{KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12 },
|
|
|
|
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
|
|
|
|
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
|
|
|
|
{_______, _______, _______, XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______}
|
2018-10-15 22:23:19 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
/* Gaming
|
|
|
|
* ,-----------------------------------------------------------------------------------.
|
|
|
|
* | | | | | | | | | | | | |
|
|
|
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
|
|
|
* | | | | | | | | | | | | |
|
|
|
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
|
|
|
* | | | | | | | | | | | | |
|
|
|
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
2019-01-28 01:59:48 +01:00
|
|
|
* | Space| | | | | | | Leave| | | |
|
2018-10-15 22:23:19 +02:00
|
|
|
* `-----------------------------------------------------------------------------------'
|
|
|
|
*/
|
|
|
|
[_GAMING] = {
|
|
|
|
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
|
|
|
|
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
|
|
|
|
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
|
2019-06-20 07:02:43 +02:00
|
|
|
{KC_SPC, XXXXXXX, _______, _______, _______, KC_LCTL, KC_LCTL, _______, G_0, _______, _______, _______}
|
2018-06-30 15:31:26 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-01-28 01:59:48 +01:00
|
|
|
void update_tri_layer_user(void);
|
|
|
|
|
2018-06-30 15:31:26 +02:00
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
2018-10-15 22:23:19 +02:00
|
|
|
switch(keycode) {
|
|
|
|
case KC_BSPC:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
if (get_mods() & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT))) {
|
|
|
|
register_code(DE_SS);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
unregister_code(DE_SS);
|
|
|
|
}
|
|
|
|
return true;
|
2019-01-28 01:59:48 +01:00
|
|
|
case KC_NR:
|
2018-10-15 22:23:19 +02:00
|
|
|
if (record->event.pressed) {
|
2019-01-28 01:59:48 +01:00
|
|
|
layer_on(_NR);
|
2018-10-15 22:23:19 +02:00
|
|
|
} else {
|
2019-01-28 01:59:48 +01:00
|
|
|
layer_off(_NR);
|
2018-10-15 22:23:19 +02:00
|
|
|
}
|
2019-01-28 01:59:48 +01:00
|
|
|
update_tri_layer_user();
|
|
|
|
return false;
|
|
|
|
case KC_N3:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
layer_on(_NR_L3);
|
|
|
|
} else {
|
|
|
|
layer_off(_NR_L3);
|
|
|
|
}
|
|
|
|
update_tri_layer_user();
|
2018-10-15 22:23:19 +02:00
|
|
|
return false;
|
|
|
|
default:
|
|
|
|
return true;
|
2018-06-30 15:31:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-28 01:59:48 +01:00
|
|
|
void update_tri_layer_user(void) {
|
|
|
|
update_tri_layer(_NR, _NR_L3, _FX);
|
|
|
|
if (layer_state_is(_NR_L3) && !layer_state_is(_FX)) {
|
|
|
|
register_code(KC_ALGR);
|
|
|
|
} else {
|
|
|
|
unregister_code(KC_ALGR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-30 15:31:26 +02:00
|
|
|
void led_set_user(uint8_t usb_led) {
|
|
|
|
// Force-enable Numlock
|
|
|
|
if (!(usb_led & (1<<USB_LED_NUM_LOCK))) {
|
|
|
|
register_code(KC_NUMLOCK);
|
|
|
|
unregister_code(KC_NUMLOCK);
|
|
|
|
}
|
|
|
|
}
|