summaryrefslogtreecommitdiff
path: root/keyboards/atreus/keymaps/xyverz/keymap.c
diff options
context:
space:
mode:
authorWilliam Chang <william@factual.com>2019-11-20 22:17:07 -0800
committerWilliam Chang <william@factual.com>2019-11-20 22:17:07 -0800
commite7f4d56592b3975c38af329e77b4efd9108495e8 (patch)
tree0a416bccbf70bfdbdb9ffcdb3bf136b47378c014 /keyboards/atreus/keymaps/xyverz/keymap.c
parent71493b2f9bbd5f3d18373c518fa14ccafcbf48fc (diff)
parent8416a94ad27b3ff058576f09f35f0704a8b39ff3 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'keyboards/atreus/keymaps/xyverz/keymap.c')
-rw-r--r--keyboards/atreus/keymaps/xyverz/keymap.c68
1 files changed, 23 insertions, 45 deletions
diff --git a/keyboards/atreus/keymaps/xyverz/keymap.c b/keyboards/atreus/keymaps/xyverz/keymap.c
index fe1ca295d8..7653206ae5 100644
--- a/keyboards/atreus/keymaps/xyverz/keymap.c
+++ b/keyboards/atreus/keymaps/xyverz/keymap.c
@@ -3,8 +3,6 @@
// Preonic keyboards by Jack Humbert.
#include QMK_KEYBOARD_H
-#include "action_layer.h"
-#include "eeconfig.h"
extern keymap_config_t keymap_config;
@@ -12,13 +10,16 @@ extern keymap_config_t keymap_config;
// 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
// entirely and just use numbers.
-#define _DVORAK 0
-#define _QWERTY 1
-#define _COLEMAK 2
-#define _DVORMAC 3
-#define _LOWER 4
-#define _RAISE 5
-#define _ADJUST 16
+
+enum layer_names {
+ _DVORAK,
+ _QWERTY,
+ _COLEMAK,
+ _DVORMAC,
+ _LOWER,
+ _RAISE,
+ _ADJUST
+};
enum planck_keycodes {
DVORAK = SAFE_RANGE,
@@ -27,7 +28,7 @@ enum planck_keycodes {
DVORMAC,
LOWER,
RAISE,
- BACKLIT
+ ADJUST
};
// Adding macros to make the keymaps below much easier to read.
@@ -37,6 +38,9 @@ enum planck_keycodes {
#define ALTENT ALT_T(KC_ENT)
#define ESCTRL CTL_T(KC_ESC)
#define TABALT ALT_T(KC_TAB)
+#define ADJUST MO(_ADJUST)
+#define LOWER MO(_LOWER)
+#define RAISE MO(_RAISE)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Dvorak Layer
@@ -159,57 +163,31 @@ 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);
+layer_state_t layer_state_set_user(layer_state_t state) {
+ return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
}
-
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
- case QWERTY:
+ case DVORAK:
if (record->event.pressed) {
- persistent_default_layer_set(1UL<<_QWERTY);
+ set_single_persistent_default_layer(_DVORAK);
}
return false;
- break;
case COLEMAK:
if (record->event.pressed) {
- persistent_default_layer_set(1UL<<_COLEMAK);
+ set_single_persistent_default_layer(_COLEMAK);
}
return false;
- break;
- case DVORAK:
+ case QWERTY:
if (record->event.pressed) {
- persistent_default_layer_set(1UL<<_DVORAK);
+ set_single_persistent_default_layer(_QWERTY);
}
return false;
- break;
case DVORMAC:
if (record->event.pressed) {
- persistent_default_layer_set(1UL<<_DVORMAC);
+ set_single_persistent_default_layer(_DVORMAC);
}
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;
}
return true;
-};
+} \ No newline at end of file