From 08f3cee0a7ea50a6f4d9fe87fd8c1d814be142ff Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 15 Jan 2024 10:40:12 -0800 Subject: [PATCH] Added horizon layout --- .../betalupi_voyager/keymaps/default/config.h | 2 +- .../betalupi_voyager/keymaps/default/keymap.c | 15 +++--- .../default/layers/definitions/horizon.h | 47 +++++++++++++++++++ .../default/layers/definitions/layers.inc | 2 +- .../keymaps/default/parts/leader.c | 5 ++ .../keymaps/default/parts/tapdance.c | 25 +++++----- 6 files changed, 74 insertions(+), 22 deletions(-) create mode 100644 keyboards/betalupi_voyager/keymaps/default/layers/definitions/horizon.h diff --git a/keyboards/betalupi_voyager/keymaps/default/config.h b/keyboards/betalupi_voyager/keymaps/default/config.h index 6cc686a..456c99a 100644 --- a/keyboards/betalupi_voyager/keymaps/default/config.h +++ b/keyboards/betalupi_voyager/keymaps/default/config.h @@ -33,6 +33,6 @@ #define USB_SUSPEND_WAKEUP_DELAY 200 #define RAW_USAGE_PAGE 0xFF60 #define RAW_USAGE_ID 0x61 -#define LAYER_STATE_8BIT +#define LAYER_STATE_32BIT #define RGB_MATRIX_STARTUP_SPD 60 diff --git a/keyboards/betalupi_voyager/keymaps/default/keymap.c b/keyboards/betalupi_voyager/keymaps/default/keymap.c index 3426fb3..6d69d34 100644 --- a/keyboards/betalupi_voyager/keymaps/default/keymap.c +++ b/keyboards/betalupi_voyager/keymaps/default/keymap.c @@ -43,13 +43,6 @@ enum custom_keycodes { M_SPECIAL_BOTTOM }; -// Tapdance keycodes -enum tap_dance_codes { - TD_WMLAYOUT, - TD_SCREENSHOT, - TD_OCR -}; - // LED colors #define LC_OFF { 0, 0, 0} #define LC_GRN { 85, 203, 158} @@ -104,11 +97,17 @@ void matrix_scan_user(void) { #endif } +// Must be done early, layers need this enum +enum tap_dance_codes { + TD_WMLAYOUT, + TD_SCREENSHOT, + TD_ESCAPE, +}; // Include all other parts of configuration #include "layers/layers.c" #include "parts/leader.c" -//#include "parts/tapdance.c" +#include "parts/tapdance.c" // Process macros. // Return FALSE to halt key processing, diff --git a/keyboards/betalupi_voyager/keymaps/default/layers/definitions/horizon.h b/keyboards/betalupi_voyager/keymaps/default/layers/definitions/horizon.h new file mode 100644 index 0000000..465fa13 --- /dev/null +++ b/keyboards/betalupi_voyager/keymaps/default/layers/definitions/horizon.h @@ -0,0 +1,47 @@ +// See symbols.h for docs + +#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(HORIZON) + +#ifdef BETA_LAYER_LAYOUTS + #define BETA_LAYER_CONTEXT_DATA LAYOUT_EN + BETA_LAYER_MAGIC_MACRO +#endif + +#ifdef BETA_LAYER_KEYS + #define BETA_LAYER_CONTEXT_DATA LAYOUT_voyager(\ + TD(TD_ESCAPE), KC_1, KC_2, KC_3, KC_4, KC_5, \ + KC_H, KC_Q, KC_Q, KC_W, KC_E, KC_R, \ + KC_TAB, KC_LSFT, KC_A, KC_S, KC_D, KC_F, \ + KC_NO, KC_Z, KC_X, KC_NO, KC_C, KC_V, \ + KC_SPACE, KC_ENTER, \ + \ + \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_NO \ + ) + + BETA_LAYER_MAGIC_MACRO +#endif + +#ifdef BETA_LAYER_LEDS + #define BETA_LAYER_CONTEXT_DATA {\ + LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \ + LC_OFF, LC_OFF, LC_OFF, LC_BLU, LC_OFF, LC_OFF, \ + LC_OFF, LC_OFF, LC_BLU, LC_BLU, LC_BLU, LC_OFF, \ + LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \ + LC_OFF, LC_OFF, \ + LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \ + LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \ + LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \ + LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \ + LC_OFF, LC_OFF \ + } + + BETA_LAYER_MAGIC_MACRO +#endif + +#undef BETA_LAYER_CONTEXT_DATA +#undef BETA_LAYER_MAGIC_MACRO \ No newline at end of file diff --git a/keyboards/betalupi_voyager/keymaps/default/layers/definitions/layers.inc b/keyboards/betalupi_voyager/keymaps/default/layers/definitions/layers.inc index f2af906..38f7dfe 100644 --- a/keyboards/betalupi_voyager/keymaps/default/layers/definitions/layers.inc +++ b/keyboards/betalupi_voyager/keymaps/default/layers/definitions/layers.inc @@ -19,8 +19,8 @@ // The order of the layers below doesn't matter, // since they avoid transparent keys. +#include "horizon.h" #include "symbols.h" - #include "arrows.h" #include "macros.h" #include "fkeys.h" diff --git a/keyboards/betalupi_voyager/keymaps/default/parts/leader.c b/keyboards/betalupi_voyager/keymaps/default/parts/leader.c index 7c69a24..9ac9933 100644 --- a/keyboards/betalupi_voyager/keymaps/default/parts/leader.c +++ b/keyboards/betalupi_voyager/keymaps/default/parts/leader.c @@ -33,5 +33,10 @@ bool beta_leader_check(void) { return false; } + BETA_SEQ_2_SHORT(KC_H, KC_O) { + layer_move(LAYER_HORIZON); + return false; + } + return true; } \ No newline at end of file diff --git a/keyboards/betalupi_voyager/keymaps/default/parts/tapdance.c b/keyboards/betalupi_voyager/keymaps/default/parts/tapdance.c index 9a57d6c..40ab05d 100644 --- a/keyboards/betalupi_voyager/keymaps/default/parts/tapdance.c +++ b/keyboards/betalupi_voyager/keymaps/default/parts/tapdance.c @@ -10,16 +10,6 @@ void td_screenshot(tap_dance_state_t *state, void *user_data) { } } -void td_ocr(tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(LCTL(KC_PSCR)); - } else if (state->count == 2) { - tap_code16(LCTL(LSFT(KC_PSCR))); - } else { - reset_tap_dance(state); - } -} - void td_wmlayout(tap_dance_state_t *state, void *user_data) { if (state->count == 1) { tap_code16(LGUI(KC_COMMA)); @@ -30,8 +20,19 @@ void td_wmlayout(tap_dance_state_t *state, void *user_data) { } } +void td_escape(tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_ESCAPE); + } else if (state->count == 2) { + layer_move(LAYER_MAIN); + } else { + reset_tap_dance(state); + } +} + + tap_dance_action_t tap_dance_actions[] = { [TD_WMLAYOUT] = ACTION_TAP_DANCE_FN(td_wmlayout), [TD_SCREENSHOT] = ACTION_TAP_DANCE_FN(td_screenshot), - [TD_OCR] = ACTION_TAP_DANCE_FN(td_ocr), -}; \ No newline at end of file + [TD_ESCAPE] = ACTION_TAP_DANCE_FN(td_escape), +};