From e9944bfc8e89dc772fa04be90638cab1e722ece1 Mon Sep 17 00:00:00 2001 From: HagVcom Date: Fri, 2 Feb 2018 07:50:22 +0100 Subject: [PATCH] Added "hag" keymap to Iris (#2313) * Create keymap.c Add Hag keymap, a heavily modified dvorak swedish keymap with multiple layouts and often used stuff under the alpha cluster. * Create config.h * Create rules.mk --- keyboards/iris/keymaps/hag/config.h | 41 ++++ keyboards/iris/keymaps/hag/keymap.c | 297 ++++++++++++++++++++++++++++ keyboards/iris/keymaps/hag/rules.mk | 6 + 3 files changed, 344 insertions(+) create mode 100644 keyboards/iris/keymaps/hag/config.h create mode 100644 keyboards/iris/keymaps/hag/keymap.c create mode 100644 keyboards/iris/keymaps/hag/rules.mk diff --git a/keyboards/iris/keymaps/hag/config.h b/keyboards/iris/keymaps/hag/config.h new file mode 100644 index 0000000000..c4604af436 --- /dev/null +++ b/keyboards/iris/keymaps/hag/config.h @@ -0,0 +1,41 @@ +/* +Copyright 2017 Danny Nguyen + +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 . +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define MASTER_RIGHT +// #define EE_HANDS + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif diff --git a/keyboards/iris/keymaps/hag/keymap.c b/keyboards/iris/keymaps/hag/keymap.c new file mode 100644 index 0000000000..3aac1394ea --- /dev/null +++ b/keyboards/iris/keymaps/hag/keymap.c @@ -0,0 +1,297 @@ +#include "iris.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + + +//Heavily modified keymap. Some features: +//Multiple layouts, I use dvorak as main. +//Nordic(swedish) signs +//Symbols, numpad, arrows/navigation reachable under the alpas via the layers +//Mirrored ctl, alt and shift to be able to use both hands when doing commands +//Gaming layer, qwerty with space on left half. + +#define _QWERTY 2 +#define _DVORAK 0 +#define _COLEMAK 1 +#define _WORKMAN 3 +#define _GAMING 4 +#define _NUMPAD 5 +#define _LOWER 6 +#define _RAISE 7 + +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + DVORAK, + COLEMAK, + WORKMAN, + GAMING, + NUMPAD, + LOWER, + RAISE, + ADJUST, +}; + +#define KC_ KC_TRNS +#define _______ KC_TRNS +#define KC_XXXX KC_NO + +#define KC_Sw2 RALT(KC_2) // Nordic @ +#define KC_Sw3 RALT(KC_3) // Nordic something +#define KC_Sw4 RALT(KC_4) // Nordic something +#define KC_Sw5 RALT(KC_5) // Nordic something +#define KC_Sw6 RALT(KC_6) // ... +#define KC_Sw7 RALT(KC_7) +#define KC_Sw8 RALT(KC_8) +#define KC_Sw9 RALT(KC_9) +#define KC_Sw0 RALT(KC_0) +#define KC_Tild RALT(KC_RBRC) +#define KC_Bsls RALT(KC_MINS) +#define KC_Bar RALT(KC_NUBS) +#define KC_Less S(KC_NUBS) +#define KC_CATDEL LCTL(LALT(KC_DEL)) // Ctrl alt del +#define KC_TSKMGR LCTL(S(KC_ESC)) // Ctrl shift esc +#define KC_NUMP TG(_NUMPAD) // Toggle layer NUMPAD for use in KC_keymaps +#define KC_Close RALT(KC_F4) // Alt F4 +#define KC_Great S(KC_NUBS) +#define KC_MEH1 MEH(KC_1) +#define KC_MEH2 MEH(KC_2) +#define KC_MEH3 MEH(KC_3) +#define KC_MEH4 MEH(KC_4) +#define KC_MEH5 MEH(KC_5) + +#define KC_LOWR LOWER +#define KC_RASE RAISE +#define KC_RST RESET +#define KC_BL_S BL_STEP + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + DEL ,APP, VOLD,MUTE,VOLU,LGUI, RGUI,MPRV,MPLY,MNXT,DOWN,ESC , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + TAB , Q , W , E , R , T , Y , U , I , O , P ,LBRC, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LCTL, A , S , D , F , G , H , J , K , L ,SCLN,QUOT, + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + LSFT, Z , X , C , V , B ,NUMP, ENT , N , M ,COMM,DOT ,SLSH,RSFT, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + LALT,LOWR,BSPC, SPC ,RASE,LALT + // `----+----+----' `----+----+----' + ), + + [_GAMING] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,ESC , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + TAB , Q , W , E , R , T , Y , U , I , O , P ,DEL, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LCTL, A , S , D , F , G , H , J , K , L ,SCLN,RCTL, + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + LSFT, Z , X , C , V , B , Y , ENT , N , M ,COMM,DOT ,SLSH,RSFT, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + LALT,LOWR,SPC, BSPC ,RASE,LALT + // `----+----+----' `----+----+----' + ), + + [_DVORAK] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + DEL ,APP ,VOLD,MUTE,VOLU,LGUI, RGUI,MPRV,MPLY,MNXT,DOWN,ESC , + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TAB ,LBRC,QUOT,SCLN, P , Y , F , G , C , R , L ,DEL, + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + LCTL, A , O , E , U , I , D , H , T , N , S ,RCTL, + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + LSFT,DOT , Q , J , K , X ,NUMP, ENT , B , M , W , V , Z ,RSFT, + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + LALT,LOWR,BSPC, SPC ,RASE,LALT + // `----+----+----' `----+----+----' + ), + + [_COLEMAK] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + DEL ,APP, VOLD,MUTE,VOLU,LGUI, RGUI,MPRV,MPLY,MNXT,DOWN,ESC , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + TAB , Q , W , F , P , G , J , L , U , Y ,LBRC,QUOT, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LCTL, A , R , S , T , D , H , N , E , I , O ,SCLN, + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + LSFT, Z , X , C , V , B ,NUMP, ENT , K , M ,COMM, DOT,SLSH,RSFT, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + LALT,LOWR,BSPC, SPC ,RASE,LALT + // `----+----+----' `----+----+----' + ), + +[_WORKMAN] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + DEL ,APP, VOLD,MUTE,VOLU,LGUI, RGUI,MPRV,MPLY,MNXT,DOWN,ESC , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + TAB , Q , W , R , W , B , J , F , U , P ,LBRC,SCLN, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LCTL, A , S , H , T , G , Y , N , E , O , I ,RCTL, + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + LSFT, Z , X , M , C , V ,NUMP, ENT , K , L ,QUOT, DOT,SLSH,RSFT, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + LALT,LOWR,BSPC, SPC ,RASE,LALT + // `----+----+----' `----+----+----' + ), + + [_NUMPAD] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,F12 , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,MEH1,BTN2,MS_U,BTN1,CATDEL, PIPE, P7 , P8 , P9 ,SLSH, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,MEH4,MS_L,MS_D,MS_R,TSKMGR, COMM, P4 , P5 , P6 ,MINS, , + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + ,MEH5,ACL0,ACL1,ACL2,MEH3, , PENT,DOT , P1 , P2 , P3 , P0 , , + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + LALT,LOWR,BSPC, , P0 ,NLCK + // `----+----+----' `----+----+----' + ), + + + [_LOWER] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,F12 , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,CAPS,PGUP, UP ,PGDN, ESC, RCBR,EXLM,ASTR,LPRN,UNDS, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,HOME,LEFT,DOWN,RGHT, END, RPRN,QUES,Sw8 ,Sw9 ,LABK, , + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + , ENT, , , , DEL, , ,RABK,NUBS,Sw7 ,Sw0 ,Great, , + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + , , , , , + // `----+----+----' `----+----+----' + ), + + [_RAISE] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TILD,EXLM,GRV ,EQL, DLR ,PERC, Sw3 ,Sw5 ,Sw6 ,Sw0 ,RPRN, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,Bar ,Sw2 ,HASH, AT ,PERC, PIPE, 7 , 8 , 9 ,PMNS,PSLS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,Bsls,Tild,SLSH,AMPR,BSLS, COMM, 4 , 5 , 6 ,PPLS,PAST, + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + ,PIPE,Sw4 ,PLUS,CIRC,TILD, , PENT,DOT , 1 , 2 , 3 , 0 ,PEQL, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + , ,DEL , , , + // `----+----+----' `----+----+----' + ), + + [_ADJUST] = KEYMAP( + //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------. + GAMING , DVORAK, WORKMAN, COLEMAK, QWERTY , KC_RST, _______, _______, _______, _______, KC_PWR, RESET, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + _______, _______, _______,LGUI(KC_UP),_______,LALT(KC_F4), _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + _______, _______,LGUI(KC_LEFT),LGUI(KC_DOWN),LGUI(KC_RGHT),_______, _______, DEBUG , RGB_HUD, RGB_SAD, RGB_VAD, BL_STEP, + //|--------+--------+--------+--------+--------+--------+--------. ,--------|--------+--------+--------+--------+--------+--------| + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //`--------+--------+--------+----+---+--------+--------+--------/ \--------+--------+--------+---+----+--------+--------+--------' + _______, _______, _______, _______, _______, _______ + // `--------+--------+--------' `--------+--------+--------' + ) + +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE +// PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case NUMPAD: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE +// PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_NUMPAD); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE +// PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case WORKMAN: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE +// PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_WORKMAN); + } + return false; + break; + case GAMING: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE +// PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_GAMING); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} diff --git a/keyboards/iris/keymaps/hag/rules.mk b/keyboards/iris/keymaps/hag/rules.mk new file mode 100644 index 0000000000..22b6ec4766 --- /dev/null +++ b/keyboards/iris/keymaps/hag/rules.mk @@ -0,0 +1,6 @@ +RGBLIGHT_ENABLE = yes +BACKLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif