* add_adjust_layer

* add_adjust_layer
This commit is contained in:
jotix 2020-06-25 03:08:24 -03:00 committed by GitHub
parent 995464cb9c
commit c8b35b6230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 30 deletions

View File

@ -1,9 +1,7 @@
// This is the canonical layout file for the Quantum project. If you want to add another keyboard, // This is the default layout for the handwired/jotanck keyboard
// this is the style you want to emulate.
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
// Each layer gets a name for readability, which is then used in the keymap matrix below. // Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them // Layer names don't all need to be of the same length, obviously, and you can also skip them
@ -12,14 +10,11 @@
#define _QWERTY 0 #define _QWERTY 0
#define _LOWER 1 #define _LOWER 1
#define _RAISE 2 #define _RAISE 2
#define _ADJUST 3
#define LOWER MO(_LOWER) #define LOWER MO(_LOWER)
#define RAISE MO(_RAISE) #define RAISE MO(_RAISE)
static bool is_ctl_pressed;
static bool is_esc_pressed;
static bool is_bspc_pressed;
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty /* Qwerty
@ -76,6 +71,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
), ),
[_ADJUST] = LAYOUT_ortho_4x12 (
_______, RESET, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
}; };
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
@ -95,26 +97,5 @@ layer_state_t layer_state_set_user(layer_state_t state) {
break; break;
}; };
#endif #endif
return state; return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_LCTL:
is_ctl_pressed = record->event.pressed;
break;
case KC_ESC:
is_esc_pressed = record->event.pressed;
break;
case KC_BSPC:
is_bspc_pressed = record->event.pressed;
break;
};
return true;
}
void matrix_scan_user(void) {
if (is_ctl_pressed && is_esc_pressed && is_bspc_pressed) {
reset_keyboard();
}
} }

View File

@ -35,6 +35,6 @@ Make example for this keyboard (after setting up your build environment):
![Default Keymap](https://i.imgur.com/xh7Dmd7.png) ![Default Keymap](https://i.imgur.com/xh7Dmd7.png)
To reset the keyboard press Ctrl+Esc+BackSpace To reset the keyboard press Lower+Raise+Q
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).