Updating the layout

This commit is contained in:
zjpxshade 2018-07-11 06:37:42 -05:00
parent e348afa41a
commit 181822d195
2 changed files with 147 additions and 64 deletions

View File

@ -22,8 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Use I2C or Serial, not both */
#define USE_SERIAL
// #define USE_I2C
//#define USE_SERIAL
#define USE_I2C
/* Select hand configuration */

View File

@ -4,88 +4,148 @@
extern keymap_config_t keymap_config;
#define _QWERTY 0
#define _LOWER 1
#define _RAISE 2
#define _DVORAK 0
#define _QWERTY 1
#define _GAMING 13
#define _LOWER 14
#define _RAISE 15
#define _ADJUST 16
enum custom_keycodes {
QWERTY = SAFE_RANGE,
DVORAK = SAFE_RANGE,
GAME,
DVPR,
QRTY,
QUIT,
LOWER,
RAISE,
ADJUST,
};
#define KC_ KC_TRNS
#define _______ KC_TRNS
//Definitions of Different Keys Go Here
#define KC_ KC_TRNS
#define _______ KC_TRNS
#define KC_LOWR LOWER
#define KC_RASE RAISE
#define KC_RST RESET
#define KC_BL_S BL_STEP
#define KC_DBUG DEBUG
#define KC_RTOG RGB_TOG
#define KC_RMOD RGB_MOD
#define KC_RHUI RGB_HUI
#define KC_RHUD RGB_HUD
#define KC_RSAI RGB_SAI
#define KC_RSAD RGB_SAD
#define KC_RVAI RGB_VAI
#define KC_RVAD RGB_VAD
#define KC_LOWR LOWER
#define KC_RASE RAISE
#define KC_RST RESET
#define KC_BL_S BL_STEP
#define KC_DBUG DEBUG
#define KC_RTOG RGB_TOG
#define KC_RMOD RGB_MOD
#define KC_RHUI RGB_HUI
#define KC_RHUD RGB_HUD
#define KC_RSAI RGB_SAI
#define KC_RSAD RGB_SAD
#define KC_RVAI RGB_VAI
#define KC_RVAD RGB_VAD
#define KC_DVPR DF(_DVORAK)
#define KC_GAME DF(_GAMING)
#define KC_QRTY DF(_QWERTY)
#define KC_QUIT LSFT(LALT(KC_Q))
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_kc(
// All custom layers should be placed below LOWER, RAISE, and ADJUST -- in that order.
// LOWER and RAISE have helpful keys on them. ADJUST is to adjust the keyboard's settings.
// I suppose that a pedestrian way of setting it up would be to make it as close to the old
// KB as possible and then slowly adjust things from there.
//DVORAK (Base Layer)
[_DVORAK] = LAYOUT_kc(
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
ESC , 7 , 5 , 3 , 1 , 9 , 2 , 4 , 6 , 8 , 0 ,BSPC,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
TAB ,SCLN,COMM,DOT , P , Y , F , G , C , R , L ,DEL ,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
LSFT, A , O , E , U , I , D , H , T , N , S ,RSFT,
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
LCTL,QUOT, Q , J , K , X ,HOME, END , B , M , W , V , Z ,SLSH,
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
LALT,LOWR,ENT , SPC ,RASE,LGUI
// `----+----+----' `----+----+----'
),
//QWERTY
[_QWERTY] = LAYOUT_kc(
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,BSPC,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
TAB , ,COMM,DOT , P , Y , F , G , C , R , L ,DEL ,
TAB , Q , W , E , R , T , Y , U , I , O , P ,QUOT,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
LSFT, A , O , E , U , I , D , H , T , N , S ,INS ,
LSFT, A , S , D , F , G , H , J , K , L ,SCLN,ENT ,
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
LCTL,QUOT, Q , J , K , X ,HOME, END , B , M , W , V , Z ,RSFT,
LCTL, Z , X , C , V , B ,HOME, END , N , M ,COMM,DOT ,SLSH,RSFT,
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
LGUI,LOWR,ENT , SPC ,RASE,LALT
LALT,LOWR,SPC , SPC ,RASE,LGUI
// `----+----+----' `----+----+----'
),
//GAMING
[_GAMING] = LAYOUT_kc(
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,BSPC,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
QUOT,TAB , Q , W , E , R , T , Y , U , I , O , P ,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
INS ,LSFT, A , S , D , F , G , H , J , K , L ,SCLN,
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
DEL ,LCTL, Z , X , C , V ,SPC, ENT , B , N , M ,COMM,DOT ,SLSH,
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
LALT,LOWR,LCTL, SPC ,RASE,LGUI
// `----+----+----' `----+----+----'
),
//GAMELOWER -- For one handed gaming
//LOWER - MAYBE TRY AND MAKE IT RIGHT HANDED SINCE LOWER IS ON LT?
[_LOWER] = LAYOUT_kc(
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
TILD,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,BSPC,
, , , , , , , , , , , ,
//|----+----+---+----+----+----| |----+----+----+----+----+----|
, , , , , , , , , , , ,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
RST , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , ,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
DEL , ,LEFT,RGHT, UP ,LBRC, RBRC, P4 , P5 , P6 ,PLUS,PIPE,
, , , , , , ,LEFT, UP ,DOWN,RGHT, ,
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
BL_S, , , ,DOWN,LCBR,LPRN, RPRN,RCBR, P1 , P2 , P3 ,MINS, ,
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
, ,DEL , DEL , , P0
// `----+----+----' `----+----+----'
),
[_RAISE] = LAYOUT_kc(
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
F12 , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN, ,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
,MPRV,MNXT,VOLU,PGUP,UNDS, EQL ,HOME, , , ,BSLS,
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
MUTE,MSTP,MPLY,VOLD,PGDN,MINS, , ,PLUS,END , , , , ,
, , , , , , , , , , , , , ,
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
, , , , ,
// `----+----+----' `----+----+----'
),
[_ADJUST] = LAYOUT_kc(
//RAISE - MAYBE TRY AND MAKE IT LEFT HANDED SINCE RAISE IS ON RT?
[_RAISE] = LAYOUT_kc(
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
QUIT, , , , , , , , , , , ,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
, , , , , , , , , , , ,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
RTOG,RMOD,RHUI,RSAI,RVAI, , , , , , , ,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
,DBUG,RHUD,RSAD,RVAD, , , , , , , ,
, , , , , , , , , , , ,
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
BL_S,RST , , , , , , , , , , , , ,
, , , , , , , , , , , , , ,
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
, , , , ,
// `----+----+----' `----+----+----'
),
//ADJUST
/*TOP ROW: Different custom defined layers, in order
* 2ND ROW:
* 3RD ROW:
* 4TH ROW:
* LTHUMBS:
* RTHUMBS:
*/
[_ADJUST] = LAYOUT_kc(
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
DVPR,QRTY, ,GAME, , , , , , , , ,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
BL_S, , , , , , , , , , , ,
//|----+----+----+----+----+----| |----+----+----+----+----+----|
, , , , , , , , , , , ,
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
, , , , , , , , , , , , ,RST ,
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
, , , , ,
// `----+----+----' `----+----+----'
@ -93,6 +153,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
void persistent_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
@ -100,9 +161,28 @@ void persistent_default_layer_set(uint16_t default_layer) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
//After this point, it's all about switching layers
case DVORAK: //DVORAK here is the base layer
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_QWERTY);
persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
break;
case QRTY:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
break;
case GAME: //GAME is now a keycode here
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_GAMING); //revert to Qwerty if we're on NSA/Windows
} //to play V / I / D / E / O ~ G / A / M / E / S
return false;
break;
case DVPR:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_DVORAK); //Changes base layer to _DVORAK
}
return false;
break;
@ -110,28 +190,31 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
}
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);
case RAISE: //Defines what happens when the RAISE key is pressed
if (record->event.pressed) { //if they key is pressed
layer_on(_RAISE); //toggle on the RAISE layer
update_tri_layer(_LOWER, _RAISE, _ADJUST); //update our layers to check if the LOWER key is pressed
}
else { //if the key is not pressed
layer_off(_RAISE); //leave everything alone
update_tri_layer(_LOWER, _RAISE, _ADJUST); //update the layers???
}
return false;
break;
case ADJUST:
if (record->event.pressed) {
if (record->event.pressed) { //RAISE + LOWER = ADJUST
layer_on(_ADJUST);
} else {
layer_off(_ADJUST);
}
}
else {
layer_off(_ADJUST); //Releasing one of them goes to the other one
}
return false;
break;
}