summaryrefslogtreecommitdiffstats
path: root/keyboards
diff options
context:
space:
mode:
authorMaxr1998 <max.rumpf1998@gmail.com>2019-01-28 01:59:48 +0100
committerDrashna Jaelre <drashna@live.com>2019-01-27 17:44:54 -0800
commit795f743c04f6a62056aac9d637f7a5a896d030b8 (patch)
treed48cd9aef76011633025bf1ac3951731d2e453e6 /keyboards
parent17d3750f13b720b5f57c0c8127b177fe41fafe26 (diff)
[Keymap] Support FX keys on Maxr1998's Contra
Using update_tri_layer() and more manual layer switching, also rename some layers & keycodes
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/contra/keymaps/maxr1998/keymap.c79
1 files changed, 58 insertions, 21 deletions
diff --git a/keyboards/contra/keymaps/maxr1998/keymap.c b/keyboards/contra/keymaps/maxr1998/keymap.c
index 48bde833d5..326d5876d0 100644
--- a/keyboards/contra/keymaps/maxr1998/keymap.c
+++ b/keyboards/contra/keymaps/maxr1998/keymap.c
@@ -19,16 +19,17 @@
enum contra_layers {
_QWERTZ,
- _FUNC,
- _NUMROW,
- _NUMROW_L3,
+ _FN,
+ _NR,
+ _NR_L3,
+ _FX,
_GAMING
};
-#define KC_I3 LM(_NUMROW, MOD_LALT)
-#define KC_NR MO(_NUMROW)
-#define NR_L3 SAFE_RANGE
-#define FUN MO(_FUNC)
+#define KC_I3 LM(_NR, MOD_LALT)
+#define KC_NR SAFE_RANGE
+#define KC_N3 (SAFE_RANGE + 1)
+#define KC_FN MO(_FN)
#define G_1 TO(_GAMING)
#define G_0 TG(_GAMING)
@@ -49,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{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},
- {KC_LCTL, KC_LGUI, KC_LALT, KC_I3, KC_NR, KC_SPC, KC_SPC, NR_L3, FUN, KC_LEFT, KC_DOWN, KC_RGHT}
+ {KC_LCTL, KC_LGUI, KC_LALT, KC_I3, KC_NR, KC_SPC, KC_SPC, KC_N3, KC_FN, KC_LEFT, KC_DOWN, KC_RGHT}
},
/* Function layer
@@ -60,10 +61,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | | | | | | | RGBH-| RGBT | RGBH+| PgUp | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
- * | | | | ---- | ---- | | | ---- | ---- | Home | PgDn | End |
+ * | | | | ---- | ---- | | ---- | ---- | Home | PgDn | End |
* `-----------------------------------------------------------------------------------'
*/
-[_FUNC] = {
+[_FN] = {
{_______, _______, _______, _______, _______, _______, _______, DE_UE, _______, DE_OE, _______, KC_DEL },
{KC_LOCK, DE_AE, DE_SS, _______, _______, G_1, _______, RGB_M_P, RGB_M_B, RGB_M_SW,_______, _______},
{_______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_TOG, RGB_HUI, KC_PGUP, _______},
@@ -78,20 +79,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | <> | | | | | | | | | | -_ | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
- * | | | | ---- | ---- | | | ---- | ---- | | | |
+ * | | | | ---- | ---- | | ---- | ---- | | | |
* `-----------------------------------------------------------------------------------'
*/
-[_NUMROW] = {
+[_NR] = {
{_______, DE_1, DE_2, DE_3, DE_4, DE_5, DE_6, DE_7, DE_8, DE_9, DE_0, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, DE_HASH, _______},
{_______, DE_LESS, _______, _______, _______, _______, _______, _______, _______, _______, DE_MINS, _______},
- {_______, _______, _______, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, _______, _______, _______}
+ {_______, _______, _______, XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______}
},
-[_NUMROW_L3] = {
+[_NR_L3] = {
{_______, DE_1, DE_2, DE_3, DE_4, DE_5, DE_6, DE_7, DE_8, DE_9, DE_0, DE_SS },
{_______, DE_Q, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
{_______, DE_LESS, _______, _______, _______, _______, _______, _______, _______, _______, DE_MINS, _______},
- {_______, _______, _______, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, _______, _______, _______}
+ {_______, _______, _______, 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, _______, _______, _______}
},
/* Gaming
@@ -102,7 +121,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
- * | Space| | | | | | | | Reset| | | |
+ * | Space| | | | | | | Leave| | | |
* `-----------------------------------------------------------------------------------'
*/
[_GAMING] = {
@@ -113,6 +132,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}
};
+void update_tri_layer_user(void);
+
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch(keycode) {
case KC_BSPC:
@@ -125,20 +146,36 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
unregister_code(DE_SS);
}
return true;
- case NR_L3:
+ case KC_NR:
if (record->event.pressed) {
- register_code(KC_ALGR);
- layer_on(_NUMROW_L3);
+ layer_on(_NR);
} else {
- layer_off(_NUMROW_L3);
- unregister_code(KC_ALGR);
+ layer_off(_NR);
}
+ 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();
return false;
default:
return true;
}
}
+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);
+ }
+}
+
void led_set_user(uint8_t usb_led) {
// Force-enable Numlock
if (!(usb_led & (1<<USB_LED_NUM_LOCK))) {