diff options
author | akrob <akrob@users.noreply.github.com> | 2018-05-12 09:46:27 -0600 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-05-12 08:46:27 -0700 |
commit | 5b503cc5438fdc4f9b13ae3d697d28c3824f2b75 (patch) | |
tree | bf70526cffd2eaf8910bfd3a2e5a14d1a00010bc /keyboards | |
parent | 69ec54f3a46c59c4e1df982bc1f914fa881146b0 (diff) | |
download | qmk_firmware-5b503cc5438fdc4f9b13ae3d697d28c3824f2b75.tar.gz |
Fix syntax, add laylock with backlight toggle on locked layer (#2940)
* Create config.h
* Create rules.mk
* Create keymap.c
* fix syntax and add latest
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/iris/keymaps/transmogrified/keymap.c | 106 |
1 files changed, 88 insertions, 18 deletions
diff --git a/keyboards/iris/keymaps/transmogrified/keymap.c b/keyboards/iris/keymaps/transmogrified/keymap.c index 714b826ac..43d6cc600 100644 --- a/keyboards/iris/keymaps/transmogrified/keymap.c +++ b/keyboards/iris/keymaps/transmogrified/keymap.c @@ -27,6 +27,8 @@ enum custom_keycodes { ONEHANDL, RLAYER, LLAYER, + RLOCK, + LLOCK, DUAL, CONFIG, }; @@ -44,13 +46,15 @@ enum { /* LAYERS */ #define KC_LLAY LLAYER #define KC_RLAY RLAYER +#define KC_RLOK RLOCK +#define KC_LLOK LLOCK #define KC_QWER QWERTY #define KC_DVOR DVORAK #define KC_COLE COLEMAK #define KC_ONER ONEHANDR #define KC_ONEL ONEHANDL #define KC_DUAL DUAL -#define KC_CONF OSL(_CONFIG) +#define KC_CONF CONFIG /* Custom Shortened Keys */ #define KC_MCTB LCTL(KC_TAB) @@ -71,7 +75,7 @@ enum { #define KC_BLUP BL_INC #define KC_BLDN BL_DEC #define KC_SYSR KC_SYSREQ -#define KC_FLASH RESET +#define KC_REST RESET /* Tap Dance */ #define KC_LGUA TD(TD_LGUIAPP) @@ -82,13 +86,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = LAYOUT_kc( //,----+----+----+----+----+----. ,----+----+----+----+----+----. - LEAD, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,BSPC, + XXXX, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,BSPC, //|----+----+----+----+----+----| |----+----+----+----+----+----| TAB , Q , W , E , R , T , Y , U , I , O , P ,DEL , //|----+----+----+----+----+----| |----+----+----+----+----+----| CTEC, A , S , D , F , G , H , J , K , L ,SCLN,ENT , //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| - SHCL, Z , X , C , V , B ,XXXX, XXXX, N , M ,COMM,DOT ,SLSH,RSFT, + SHCL, Z , X , C , V , B ,LLOK, RLOK, N , M ,COMM,DOT ,SLSH,RSFT, //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' LALT,LLAY,TAB , SPC ,RLAY,LGUA // `----+----+----' `----+----+----' @@ -96,13 +100,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_COLEMAK] = LAYOUT_kc( //,----+----+----+----+----+----. ,----+----+----+----+----+----. - LEAD, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,BSPC, + XXXX, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,BSPC, //|----+----+----+----+----+----| |----+----+----+----+----+----| TAB , Q , W , F , P , G , J , L , U , Y ,SCLN,DEL , //|----+----+----+----+----+----| |----+----+----+----+----+----| - CTEC, A , R , S , T , D , H , N , E , I ,SCLN,ENT , + CTEC, A , R , S , T , D , H , N , E , I , O ,ENT , //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| - SHCL, Z , X , C , V , B ,XXXX, XXXX, K , M ,COMM,DOT ,SLSH,RSFT, + SHCL, Z , X , C , V , B ,LLOK, RLOK, K , M ,COMM,DOT ,SLSH,RSFT, //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' LALT,LLAY,TAB , SPC ,RLAY,LGUA // `----+----+----' `----+----+----' @@ -110,13 +114,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DVORAK] = LAYOUT_kc( //,----+----+----+----+----+----. ,----+----+----+----+----+----. - LEAD, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,BSPC, + XXXX, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,BSPC, //|----+----+----+----+----+----| |----+----+----+----+----+----| TAB ,QUOT,COMM,DOT , P , Y , F , G , C , R , L ,SLSH, //|----+----+----+----+----+----| |----+----+----+----+----+----| CTEC, A , O , E , U , I , D , H , T , N , S ,ENT , //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| - SHCL,SCLN, Q , J , K , X ,XXXX, XXXX, B , M , W , V , Z ,EQL , + SHCL,SCLN, Q , J , K , X ,LLOK, RLOK, B , M , W , V , Z ,EQL , //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' LALT,LLAY,TAB , SPC ,RLAY,LGUA // `----+----+----' `----+----+----' @@ -138,7 +142,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ONEHANDL] = LAYOUT_kc( //,----+----+----+----+----+----. ,----+----+----+----+----+----. - XXXX,XXXX,XXXX,XXXX,XXXX,XXXX, 5 , 4 , 3 , 2 , 1 ,LEAD, + XXXX,XXXX,XXXX,XXXX,XXXX,XXXX, 5 , 4 , 3 , 2 , 1 ,XXXX, //|----+----+----+----+----+----| |----+----+----+----+----+----| XXXX,XXXX,XXXX,XXXX,XXXX,XXXX, T , R , E , W , Q ,TAB , //|----+----+----+----+----+----| |----+----+----+----+----+----| @@ -152,14 +156,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_RLAYER] = LAYOUT_kc( //,----+----+----+----+----+----. ,----+----+----+----+----+----. - ,XXXX,XXXX,XXXX,XXXX,XXXX, MUTE,VOLD,VOLU,BLDN,BLUP, , + ,SLCK,SYSR,PSCR,INS ,PAUS, MUTE,VOLD,VOLU,BLDN,BLUP, , //|----+----+----+----+----+----| |----+----+----+----+----+----| - ,TILD,GRV ,EQL ,LBRC,RBRC, PGUP,ASTR, UP ,AMPR,CIRC, , + ,TILD,GRV ,EQL ,LBRC,RBRC, ASTR,HOME, UP ,PGUP,PLUS, , //|----+----+----+----+----+----| |----+----+----+----+----+----| - ,EXLM,PIPE,DLR ,LPRN,RPRN, HOME,LEFT,DOWN,RGHT,END ,QUOT, + ,EXLM,PIPE,DLR ,LPRN,RPRN, AMPR,LEFT,DOWN,RGHT,MINS,QUOT, //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| - , AT ,HASH,PERC,LCBR,RCBR,LGUI, ,PGDN,UNDS,MINS,PLUS,BSLS, , - //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + , AT ,HASH,PERC,LCBR,RCBR, , ,CIRC,END ,UNDS,PGDN,BSLS, , + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' , , , , , // `----+----+----' `----+----+----' ), @@ -172,7 +176,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //|----+----+----+----+----+----| |----+----+----+----+----+----| ,XXXX,MCST,DOWN,MCTB,ENT , SLSH, 4 , 5 , 6 ,MINS, , //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| - ,XXXX,XXXX,BSPC,SPC ,SINS,F11 , F12 ,EQL , 1 , 2 , 3 ,DOT , , + ,XXXX,XXXX,BSPC,SINS,SPC ,F11 , F12 ,EQL , 1 , 2 , 3 ,DOT , , //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' , , , 0 , , // `----+----+----' `----+----+----' @@ -180,7 +184,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DUAL] = LAYOUT_kc( //,----+----+----+----+----+----. ,----+----+----+----+----+----. - ,XXXX,XXXX,PSCR,INS ,XXXX, XXXX,SLEP,SLCK,PAUS,SYSR,XXXX, + ,XXXX,XXXX,XXXX,XXXX,XXXX, XXXX,XXXX,XXXX,XXXX,XXXX,XXXX, //|----+----+----+----+----+----| |----+----+----+----+----+----| ,XXXX,XXXX,XXXX,XXXX,XXXX, XXXX,XXXX,MS_U,XXXX,XXXX,MCAD, //|----+----+----+----+----+----| |----+----+----+----+----+----| @@ -194,7 +198,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_CONFIG] = LAYOUT_kc( //,----+----+----+----+----+----. ,----+----+----+----+----+----. - FLASH,XXXX,XXXX,XXXX,XXXX,XXXX, XXXX,XXXX,XXXX,XXXX,XXXX,XXXX, + REST,XXXX,XXXX,XXXX,XXXX,XXXX, XXXX,XXXX,XXXX,XXXX,XXXX,XXXX, //|----+----+----+----+----+----| |----+----+----+----+----+----| XXXX,QWER,XXXX,XXXX,XXXX,XXXX, XXXX,XXXX,XXXX,ONER,XXXX,XXXX, //|----+----+----+----+----+----| |----+----+----+----+----+----| @@ -237,6 +241,11 @@ void persistent_default_layer_set(uint16_t default_layer) { default_layer_set(default_layer); } +/* Variables for layer light toggling */ +static uint16_t currentBL = 0; +static uint16_t rlocked = 0; +static uint16_t llocked = 0; + bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case QWERTY: @@ -263,14 +272,33 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; + case CONFIG: + if (record->event.pressed) { + set_single_persistent_default_layer(_CONFIG); + backlight_toggle(); + } + return false; + break; case RLAYER: if (record->event.pressed) { layer_on(_RLAYER); update_tri_layer(_RLAYER, _LLAYER, _DUAL); + /* add logic to toggle backlight change when on a layer */ + currentBL = get_backlight_level(); + if ( currentBL == 0 || currentBL == 1 ) { + backlight_set(5); + } else { + backlight_set(0); + } } else { unregister_code(KC_LGUI); + rlocked = 0; layer_off(_RLAYER); update_tri_layer(_RLAYER, _LLAYER, _DUAL); + if ( llocked == 0 ) { + backlight_set(currentBL); + } else { + } } return false; break; @@ -278,9 +306,51 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { layer_on(_LLAYER); update_tri_layer(_RLAYER, _LLAYER, _DUAL); + /* add logic to toggle backlight change when on a layer */ + currentBL = get_backlight_level(); + if ( currentBL == 0 || currentBL == 1 ) { + backlight_set(5); + } else { + backlight_set(0); + } } else { + llocked = 0; layer_off(_LLAYER); update_tri_layer(_RLAYER, _LLAYER, _DUAL); + if ( rlocked == 0 ) { + backlight_set(currentBL); + } else { + } + } + return false; + break; + case RLOCK: + if (record->event.pressed) { + layer_on(_RLAYER); + /* add logic to toggle backlight change when on a layer */ + rlocked = 1; + currentBL = get_backlight_level(); + if ( currentBL == 0 || currentBL == 1 ) { + backlight_set(5); + } else { + backlight_set(0); + } + } else { + } + return false; + break; + case LLOCK: + if (record->event.pressed) { + layer_on(_LLAYER); + /* add logic to toggle backlight change when on a layer */ + llocked = 1; + currentBL = get_backlight_level(); + if ( currentBL == 0 || currentBL == 1 ) { + backlight_set(5); + } else { + backlight_set(0); + } + } else { } return false; break; |