From 80a9649c4f2f74c94ff180b6fe480944fe654800 Mon Sep 17 00:00:00 2001
From: erikbakker-dev <39745006+erikbakker-dev@users.noreply.github.com>
Date: Tue, 2 Feb 2021 06:52:00 +0100
Subject: add orthodeluxe keymap for Planck keyboard (#11077)
* add orthodeluxe keymap for Planck keyboard
* add licence header to config.h
* fix indentation
* add bootmagic lite and simplify code
---
keyboards/planck/keymaps/orthodeluxe/config.h | 27 ++
keyboards/planck/keymaps/orthodeluxe/keymap.c | 533 +++++++++++++++++++++++++
keyboards/planck/keymaps/orthodeluxe/readme.md | 64 +++
keyboards/planck/keymaps/orthodeluxe/rules.mk | 5 +
4 files changed, 629 insertions(+)
create mode 100644 keyboards/planck/keymaps/orthodeluxe/config.h
create mode 100644 keyboards/planck/keymaps/orthodeluxe/keymap.c
create mode 100644 keyboards/planck/keymaps/orthodeluxe/readme.md
create mode 100644 keyboards/planck/keymaps/orthodeluxe/rules.mk
(limited to 'keyboards')
diff --git a/keyboards/planck/keymaps/orthodeluxe/config.h b/keyboards/planck/keymaps/orthodeluxe/config.h
new file mode 100644
index 0000000000..05b5e8debb
--- /dev/null
+++ b/keyboards/planck/keymaps/orthodeluxe/config.h
@@ -0,0 +1,27 @@
+/* Copyright 2020 Erik Bakker
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+#define ENCODER_RESOLUTION 4
+#define TAPPING_TERM 175
+#define TAPPING_TOGGLE 3
+#define BOOTMAGIC_LITE_ROW 0
+#define BOOTMAGIC_LITE_COLUMN 0
+#define BOOTMAGIC_LITE_MACOS_ROW 2
+#define BOOTMAGIC_LITE_MACOS_COLUMN 7
+#define BOOTMAGIC_LITE_WIN_ROW 0
+#define BOOTMAGIC_LITE_WIN_COLUMN 2
diff --git a/keyboards/planck/keymaps/orthodeluxe/keymap.c b/keyboards/planck/keymaps/orthodeluxe/keymap.c
new file mode 100644
index 0000000000..f7a4834227
--- /dev/null
+++ b/keyboards/planck/keymaps/orthodeluxe/keymap.c
@@ -0,0 +1,533 @@
+/* Copyright 2020 Erik Bakker
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include QMK_KEYBOARD_H
+#include "muse.h"
+
+enum planck_layers {
+ _BASELAYER_MACOS,
+ _BASELAYER_WINDOWS,
+ _LEFTYLAYER,
+ _NUMLAYER_MACOS,
+ _NUMLAYER_WINDOWS,
+ _NAVLAYER_MACOS,
+ _NAVLAYER_WINDOWS,
+ _SYMLAYER_MACOS,
+ _SYMLAYER_WINDOWS,
+ _UTILSLAYER
+};
+
+enum planck_keycodes {
+ MACOS = SAFE_RANGE,
+ WINDOWS,
+ RCMDCTRL,
+ LEFTYCUT, LEFTYCOPY, LEFTYPASTE,
+ PLUSCOLON,
+ APPSWITCH, TASKVIEW, PREVDESK, NEXTDESK,
+ QUOTES, DQUOTES,
+ POINTYBR, SQUAREBR, CURLYBR, ROUNDBR
+};
+
+enum appswitch_mode {
+ APPSWITCH_OFF,
+ APPSWITCH_FIRST_TIME,
+ APPSWITCH_ON,
+ APPSWITCH_TASK_VIEW
+};
+
+enum quote_shapes {
+ SINGLE_QUOTE, DOUBLE_QUOTE
+};
+
+enum bracket_shapes {
+ POINTY, SQUARE, CURLY, ROUND
+};
+
+uint8_t windowsmode = 0;
+
+#define L_NUM_M MO(_NUMLAYER_MACOS)
+#define L_NUM_W MO(_NUMLAYER_WINDOWS)
+#define L_NAV_M MO(_NAVLAYER_MACOS)
+#define L_NAV_W MO(_NAVLAYER_WINDOWS)
+#define L_SYM_M MO(_SYMLAYER_MACOS)
+#define L_SYM_W MO(_SYMLAYER_WINDOWS)
+#define UTILSLAYER MO(_UTILSLAYER)
+
+static void set_keycodes_for_os(int os);
+static bool handle_app_switch(bool pressed);
+static bool app_switch_valid_keycode(uint16_t keycode);
+static bool handle_right_command_or_control(bool pressed);
+static bool handle_pluscolon(bool pressed);
+static bool type_quotes(uint8_t quote_shape, bool pressed);
+static bool type_brackets(uint8_t bracket_shape, bool pressed);
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+/* Base layer:
+ * ,-----------------------------------------------------------------------------------.
+ * |BckSpc| Q | W | E | R | T | Y | U | I | O | P | Del |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | Esc | A | S | D | F | G | H | J | K | L | ; : | Enter|
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | Tab- | Z | X | C | V | B | N | M | , < | . > | / ? | Tab |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | Shift| | | |NumLyr| Space |NavLyr| | | | Shift|
+ * `-----------------------------------------------------------------------------------'
+ *
+ * Bottom row for MacOS:
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | Shift| Ctrl |Option| Cmd |NumLyr| Space |NavLyr| Cmd |Option| Ctrl | Shift|
+ * `-----------------------------------------------------------------------------------'
+ *
+ * Bottom row for Windows:
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | Shift| Win | Alt | Ctrl |NumLyr| Space |NavLyr| Ctrl | Alt | Menu | Shift|
+ * `-----------------------------------------------------------------------------------'
+ */
+[_BASELAYER_MACOS] = LAYOUT_planck_grid(
+ KC_BSPC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL,
+ KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
+ _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_TAB,
+ KC_LSFT, KC_LCTRL, KC_LALT, KC_LGUI, L_NUM_M, KC_SPC, KC_SPC, L_NAV_M, RCMDCTRL, KC_RALT, KC_RCTRL, KC_RSFT
+),
+[_BASELAYER_WINDOWS] = LAYOUT_planck_grid(
+ KC_BSPC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL,
+ KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
+ _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_TAB,
+ KC_LSFT, KC_LGUI, KC_LALT, KC_LCTRL, L_NUM_W, KC_SPC, KC_SPC, L_NAV_W, RCMDCTRL, KC_RALT, KC_APP, KC_RSFT
+),
+
+/* Lefty layer:
+ * This layer enables lefties (who mouse with their left hand) to easily cut, copy and paste using their right hand.
+ * ,-----------------------------------------------------------------------------------.
+ * | | | | | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | Cut | Copy | Paste| | |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | | | | | | | |(hold)| | | |
+ * '-----------------------------------------------------------------------------------'
+ */
+
+ [_LEFTYLAYER] = LAYOUT_planck_grid(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, KC_X, KC_C, KC_V, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+),
+
+/* Numpad layer:
+ * ,-----------------------------------------------------------------------------------.
+ * | | & | | | ! | + | = | % | 7 | 8 | 9 | * | = |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | @ | ' ' | " " | - | _ | € | 4 | 5 | 6 | + : | Enter|
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | < > | [ ] | { } | ( ) | \ | $ | 1 | 2 | 3 | / | |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | | | | |(hold)| |SymLyr| 0 | . | - | |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_NUMLAYER_MACOS] = LAYOUT_planck_grid(
+ _______, KC_AMPR, KC_PIPE, KC_EXLM, KC_PPLS, KC_EQL, KC_PERC, KC_7, KC_8, KC_9, KC_PAST, KC_EQL,
+ _______, KC_AT, QUOTES, DQUOTES, KC_MINS, KC_UNDS, RALT(KC_2), KC_4, KC_5, KC_6, PLUSCOLON, KC_PENT,
+ _______, POINTYBR, SQUAREBR, CURLYBR, ROUNDBR, KC_BSLS, KC_DLR, KC_1, KC_2, KC_3, KC_PSLS, _______,
+ _______, _______, _______, _______, _______, _______, _______, L_SYM_M, KC_0, KC_PDOT, KC_PMNS, _______
+),
+[_NUMLAYER_WINDOWS] = LAYOUT_planck_grid(
+ _______, KC_AMPR, KC_PIPE, KC_EXLM, KC_PPLS, KC_EQL, KC_PERC, KC_7, KC_8, KC_9, KC_PAST, KC_EQL,
+ _______, KC_AT, QUOTES, DQUOTES, KC_MINS, KC_UNDS, RALT(KC_5), KC_4, KC_5, KC_6, PLUSCOLON, KC_PENT,
+ _______, POINTYBR, SQUAREBR, CURLYBR, ROUNDBR, KC_BSLS, KC_DLR, KC_1, KC_2, KC_3, KC_PSLS, _______,
+ _______, _______, _______, _______, _______, _______, _______, L_SYM_W, KC_0, KC_PDOT, KC_PMNS, _______
+),
+
+/* Symbol layer:
+ * ,-----------------------------------------------------------------------------------.
+ * | | | | € | | ~ | | _ | ^ | | % | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | @ | $ | $ | | ` | # | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | ! | | | \ | ~ | & | | | ! | |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | | | | |(hold)| UtilsLayer |(hold)| | | | |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_SYMLAYER_MACOS] = LAYOUT_planck_grid(
+ _______, XXXXXXX, XXXXXXX, RALT(KC_2), XXXXXXX, KC_TILD, XXXXXXX, KC_UNDS, KC_CIRC, XXXXXXX, KC_PERC, _______,
+ _______, KC_AT, KC_DLR, KC_DLR, XXXXXXX, KC_GRV, KC_HASH, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______,
+ _______, XXXXXXX, KC_EXLM, XXXXXXX, XXXXXXX, KC_BSLS, KC_TILD, KC_AMPR, XXXXXXX, XXXXXXX, KC_EXLM, _______,
+ _______, _______, _______, _______, _______, UTILSLAYER, UTILSLAYER, _______, _______, _______, _______, _______
+),
+[_SYMLAYER_WINDOWS] = LAYOUT_planck_grid(
+ _______, XXXXXXX, XXXXXXX, RALT(KC_5), XXXXXXX, KC_TILD, XXXXXXX, KC_UNDS, KC_CIRC, XXXXXXX, KC_PERC, _______,
+ _______, KC_AT, KC_DLR, KC_DLR, XXXXXXX, KC_GRV, KC_HASH, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______,
+ _______, XXXXXXX, KC_EXLM, XXXXXXX, XXXXXXX, KC_BSLS, KC_TILD, KC_AMPR, XXXXXXX, XXXXXXX, KC_EXLM, _______,
+ _______, _______, _______, _______, _______, UTILSLAYER, UTILSLAYER, _______, _______, _______, _______, _______
+),
+
+/* Navigation layer:
+ * ,-----------------------------------------------------------------------------------.
+ * | | F1 | F2 | F3 | F4 | | PgUp | Home | Up | End |PrtScr| Lock |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | F5 | F6 | F7 | F8 | | PgDn | Left | Down | Right| AppSw| |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | F9 | F10 | F11 | F12 | | |PrDesk| Down |NxDesk|TaskVw| |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | | | | |SymLyr| |(hold)| | | | |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_NAVLAYER_MACOS] = LAYOUT_planck_grid(
+ _______, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, KC_PGUP, G(KC_LEFT), KC_UP, G(KC_RGHT), SGUI(KC_4), C(G(KC_Q)),
+ _______, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, APPSWITCH, _______,
+ _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, C(KC_LEFT), KC_DOWN, C(KC_RGHT), C(KC_UP), _______,
+ _______, _______, _______, _______, L_SYM_M, _______, _______, _______, _______, _______, _______, _______
+),
+[_NAVLAYER_WINDOWS] = LAYOUT_planck_grid(
+ _______, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_PSCR, G(KC_L),
+ _______, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, APPSWITCH, _______,
+ _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, C(G(KC_LEFT)), KC_DOWN, C(G(KC_RGHT)), G(KC_TAB), _______,
+ _______, _______, _______, _______, L_SYM_W, _______, _______, _______, _______, _______, _______, _______
+),
+
+/* Utilities layer:
+ * ,-----------------------------------------------------------------------------------.
+ * | | | Win | | Reset| | | | Ins | | Pause| |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | |ScrlLk| Debug| | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | |CapsLk| | | NumLk| Mac | | | | |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | | | | |(hold)| (hold) |(hold)| | | | |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_UTILSLAYER] = LAYOUT_planck_grid(
+ _______, XXXXXXX, WINDOWS, XXXXXXX, RESET, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, XXXXXXX, KC_PAUS, _______,
+ _______, XXXXXXX, KC_SLCK, DEBUG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______,
+ _______, XXXXXXX, XXXXXXX, KC_CAPS, XXXXXXX, XXXXXXX, KC_NLCK, MACOS, XXXXXXX, XXXXXXX, XXXXXXX, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+)
+};
+
+/* Bootmagic keys (hold when plugging in the USB cable):
+ * ,-----------------------------------------------------------------------------------.
+ * |BootLd| | Win | | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | Mac | | | | |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | | | | | | | | | | | |
+ * `-----------------------------------------------------------------------------------'
+ */
+
+#ifdef AUDIO_ENABLE
+ float plover_song[][2] = SONG(PLOVER_SOUND);
+ float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
+#endif
+
+bool app_switch_active = false;
+static uint16_t timer;
+static uint16_t duration = 0;
+static bool double_tap = false;
+uint8_t active_modifiers = 0;
+bool shift_modifier_active = false;
+uint8_t keycode_rightcommand;
+uint8_t keycode_appswitch;
+
+/* main loop */
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+
+ /* Store modifiers in booleans for easy access in underlying methods. */
+ active_modifiers = get_mods();
+ shift_modifier_active = active_modifiers & ((1<<((KC_LSFT) & 0x07)) | (1<<((KC_RSFT) & 0x07)));
+
+ /* Switch off timer when double click time is exceeded. */
+ if (timer > 0) {
+ duration = timer_elapsed(timer);
+ if (duration > TAPPING_TERM) { timer = 0; }
+ }
+
+ /* Keep app_switch_active true, while a valid key is pressed. */
+ if (app_switch_active) {
+ if ((keycode == L_NAV_M || keycode == L_NAV_W) && record->event.pressed == false) {
+ unregister_code(keycode_appswitch);
+ app_switch_active = false;
+ }
+ if (app_switch_valid_keycode(keycode) == false) {
+ unregister_code(keycode_appswitch);
+ app_switch_active = false;
+ }
+ }
+
+ switch (keycode) {
+ case MACOS:
+ #ifdef AUDIO_ENABLE
+ stop_all_notes();
+ PLAY_SONG(plover_song);
+ #endif
+ set_keycodes_for_os(MACOS);
+ default_layer_set(_BASELAYER_MACOS);
+ layer_on(_BASELAYER_MACOS);
+ layer_off(_BASELAYER_WINDOWS);
+ return false;
+ break;
+ case WINDOWS:
+ #ifdef AUDIO_ENABLE
+ stop_all_notes();
+ PLAY_SONG(plover_gb_song);
+ #endif
+ set_keycodes_for_os(WINDOWS);
+ default_layer_set(_BASELAYER_WINDOWS);
+ layer_on(_BASELAYER_WINDOWS);
+ layer_off(_BASELAYER_MACOS);
+ return false;
+ break;
+ case RCMDCTRL:
+ return handle_right_command_or_control(record->event.pressed);
+ break;
+ case APPSWITCH:
+ return handle_app_switch(record->event.pressed);
+ break;
+ case QUOTES:
+ return type_quotes(SINGLE_QUOTE, record->event.pressed);
+ break;
+ case DQUOTES:
+ return type_quotes(DOUBLE_QUOTE, record->event.pressed);
+ break;
+ case POINTYBR:
+ return type_brackets(POINTY, record->event.pressed);
+ break;
+ case SQUAREBR:
+ return type_brackets(SQUARE, record->event.pressed);
+ break;
+ case CURLYBR:
+ return type_brackets(CURLY, record->event.pressed);
+ break;
+ case ROUNDBR:
+ return type_brackets(ROUND, record->event.pressed);
+ break;
+ case PLUSCOLON:
+ return handle_pluscolon(record->event.pressed);
+ break;
+ }
+ return true;
+}
+
+void set_keycodes_for_os(int os) {
+ if (os == MACOS) {
+ keycode_rightcommand = KC_RGUI;
+ keycode_appswitch = KC_LGUI;
+ } else {
+ keycode_rightcommand = KC_RCTRL;
+ keycode_appswitch = KC_LALT;
+ }
+}
+
+/* While lefties use their mouse with their left hand, it is handy to use their right hand for Cut, Copy and Paste. */
+bool handle_right_command_or_control(bool pressed) {
+ if (pressed) {
+ register_code(keycode_rightcommand);
+ layer_on(_LEFTYLAYER);
+ } else {
+ layer_off(_LEFTYLAYER);
+ unregister_code(keycode_rightcommand);
+ }
+ return false;
+}
+
+/* Key combo to easily switch applications. Press and hold Command or Alt, press and release Tab. Command or Alt is released when an invalid key is pressed in main loop. */
+bool handle_app_switch(bool pressed) {
+ if (pressed) {
+ if (app_switch_active == false) {
+ app_switch_active = true;
+ register_code(keycode_appswitch);
+ }
+ register_code(KC_TAB);
+ } else {
+ unregister_code(KC_TAB);
+ }
+ return false;
+}
+
+/* Defines valid keys for app_switch function. */
+bool app_switch_valid_keycode(uint16_t keycode) {
+ if (keycode == APPSWITCH || KC_UP || KC_LEFT || KC_DOWN || KC_RIGHT) {
+ return true;
+ }
+ return false;
+}
+
+/* Type 1 or 2 quotation marks, either single or double quotation marks.
+ * - Press once: type 1 quote and start timer.
+ * - Quickly press twice: type pair of quotes and put cursor in between.
+ */
+bool type_quotes(uint8_t quote_shape, bool pressed) {
+ clear_mods();
+ bool use_shift = quote_shape == DOUBLE_QUOTE ? true : false;
+
+ duration = timer_elapsed(timer);
+
+ if (pressed) {
+ if ((timer == 0) || (duration == 0) || (duration > TAPPING_TERM)) {
+ if (use_shift) { register_code(KC_LSFT); }
+ register_code(KC_QUOT);
+ double_tap = false;
+ } else {
+ if (duration < TAPPING_TERM) {
+ if (use_shift) {
+ tap_code16(S(KC_QUOT));
+ } else {
+ tap_code(KC_QUOT);
+ }
+ double_tap = true;
+ }
+ }
+ } else {
+ if (double_tap) {
+ tap_code(KC_LEFT);
+ timer = 0;
+ double_tap = false;
+ } else {
+ unregister_code(KC_QUOT);
+ if (use_shift) { unregister_code(KC_LSFT); }
+ timer = timer_read();
+ double_tap = false;
+ }
+ }
+
+ set_mods(active_modifiers);
+ return false;
+}
+
+/* Type a bracket or a pair of brackets
+ * - Press once: type opening bracket.
+ * - Press while holding shift: type closing bracket.
+ * - Quickly press twice: type pair of brackets and put cursor in between.
+ */
+bool type_brackets(uint8_t bracket_shape, bool pressed) {
+ clear_mods();
+
+ uint8_t opening_bracket;
+ uint8_t closing_bracket;
+ bool use_shift;
+ switch (bracket_shape) {
+ case POINTY:
+ opening_bracket = KC_COMM;
+ closing_bracket = KC_DOT;
+ use_shift = true;
+ break;
+ case SQUARE:
+ opening_bracket = KC_LBRC;
+ closing_bracket = KC_RBRC;
+ use_shift = false;
+ break;
+ case CURLY:
+ opening_bracket = KC_LBRC;
+ closing_bracket = KC_RBRC;
+ use_shift = true;
+ break;
+ case ROUND:
+ opening_bracket = KC_9;
+ closing_bracket = KC_0;
+ use_shift = true;
+ break;
+ }
+ duration = timer_elapsed(timer);
+
+ if (pressed) {
+ if ((timer == 0) || (duration == 0) || (duration > TAPPING_TERM) || (shift_modifier_active)) {
+ if (use_shift) { register_code(KC_LSFT); }
+ register_code(shift_modifier_active ? closing_bracket : opening_bracket);
+ double_tap = false;
+ } else {
+ if (duration < TAPPING_TERM) {
+ if (use_shift) {
+ tap_code16(S(closing_bracket));
+ } else {
+ tap_code(closing_bracket);
+ }
+ double_tap = true;
+ }
+ }
+ } else {
+ if (double_tap) {
+ tap_code(KC_LEFT);
+ timer = 0;
+ double_tap = false;
+ } else {
+ unregister_code(shift_modifier_active ? closing_bracket : opening_bracket);
+ if (use_shift) { unregister_code(KC_LSFT); }
+ timer = timer_read();
+ double_tap = false;
+ }
+ }
+
+ set_mods(active_modifiers);
+ return false;
+}
+
+/* On the Numpad-layer, the semicolon key produces a Plus ('+'). But to help entering time values, we like to have a colon (':') when shift is held. */
+bool handle_pluscolon(bool pressed) {
+ if (pressed) {
+ register_code(shift_modifier_active ? KC_SCLN : KC_PPLS);
+ } else {
+ unregister_code(shift_modifier_active ? KC_SCLN : KC_PPLS);
+ }
+ return false;
+}
+
+// Bootmagic configures the keyboard when initializing (starting up after connecting the USB cable)
+void bootmagic_lite(void) {
+ matrix_scan();
+ wait_ms(DEBOUNCE * 2);
+ matrix_scan();
+ int os;
+
+ // hold key in upper left corner while plugging in the USB cable to enter the Bootloader for flashing.
+ if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) {
+ bootloader_jump();
+ }
+
+ // hold M key while plugging in the USB cable to use the keyboard in MacOs mode.
+ if (matrix_get_row(BOOTMAGIC_LITE_MACOS_ROW) & (1 << BOOTMAGIC_LITE_MACOS_COLUMN)) {
+ os = MACOS;
+ }
+
+ // hold W key while plugging in the USB cable to use the keyboard in Windows mode.
+ if (matrix_get_row(BOOTMAGIC_LITE_WIN_ROW) & (1 << BOOTMAGIC_LITE_WIN_COLUMN)) {
+ os = WINDOWS;
+ }
+
+ switch (os){
+ case MACOS:
+ default_layer_set(_BASELAYER_MACOS);
+ layer_on(_BASELAYER_MACOS);
+ layer_off(_BASELAYER_WINDOWS);
+ break;
+ case WINDOWS:
+ default_layer_set(_BASELAYER_WINDOWS);
+ layer_on(_BASELAYER_WINDOWS);
+ layer_off(_BASELAYER_MACOS);
+ break;
+ default:
+ os = MACOS;
+ default_layer_set(_BASELAYER_MACOS);
+ layer_on(_BASELAYER_MACOS);
+ layer_off(_BASELAYER_WINDOWS);
+ break;
+ }
+ set_keycodes_for_os(os);
+}
diff --git a/keyboards/planck/keymaps/orthodeluxe/readme.md b/keyboards/planck/keymaps/orthodeluxe/readme.md
new file mode 100644
index 0000000000..51ad27e95c
--- /dev/null
+++ b/keyboards/planck/keymaps/orthodeluxe/readme.md
@@ -0,0 +1,64 @@
+![Orthodeluxe Layout Image](https://i.imgur.com/xnq1gNj.png)
+
+# Orthodeluxe layout for Planck keyboards
+
+By Erik Bakker
+
+## Main idea
+
+I use a Planck keyboard as a daily driver since 2018. Over time, I improved the layout and added functionality to the firmware. The main idea was to easily access all keys and functions without moving my hands from the home position (when your fingers rest on ASDF and JKL;). I'd like to share this keyboard layout with you.
+
+## Notes about left handedness
+
+This keyboard layout is perfect for people that use the mouse with their left hand. I am right handed myself. But since a couple of years, I learned to use the mouse with my left hand. I started doing that to relieve strain in my right arm. But now, I really like a setup with the keyboard in the middle, a mouse on the left, and pen and paper on the right. For those that insist on using the mouse with their right hand, I plan to create an alternative layout called 'orthodeluxe-R'.
+
+## Base layer
+
+Apart from the basic QWERTY layout, the base layer features:
+
+- A 2U space bar and 2 keys to switch layers. Rotate you keycaps 180 degrees for comfortable access.
+- Shift keys in the lower left and lower right corners. You hit them with the sides of your hands.
+- 2 sets of modifiers, symmetrically layed out in the bottom row. You can switch between MacOs and Windows layouts.
+- In Windows layout, the Ctrl keys are located where you can easily reach it with your thumbs. Just like the command key on Apple keyboards.
+- Symmetrical layout of the left and right sides of the keyboard. Row 1: Backspace and Delete, row 2: Escape and Enter, row 3: Left and right Tab.
+
+## Numpad layer
+
+The numpad layer contains a numpad and non-alphanumeric characters, like math operators, brackets and quotes.
+
+- Numpad, math operators and currency symbols are all operated by the right hand.
+- All symbols that programmers need are operated by the left hand.
+- Clicking a bracket key produces an opening bracket.
+- Holding shift while clicking a bracket key produces a closing bracket.
+- Double clicking a bracket key produces an opening and closing bracket with the cursor positioned in between.
+- Double clicking the quote keys produces 2 quotes with the cursor positioned in between.
+- The quote/apostrope is conveniently located at the S key, to easily type "It's everyone's favorite keyboard layout".
+
+## Navigation layer
+
+The navigation layer contains the cursor movement keys, keys F1-F12, and more:
+
+- The cursor keys are in an 'inverted T' configuration at the most comfortable position for the right hand (IJKL).
+- An 'App Switch' key to switch appslications, but smarter than just mapping Alt-Tab to that key.
+- A Key to easily access Task View in Windows (or Mission Control in MacOs).
+- Keys to switch virtual desktops in Windows (or spaces in MacOs).
+
+## Additional layers
+
+There are some additional layers for:
+
+- accessing lesser used symbols and functions;
+- switching between MacOs and Windows modes;
+- access Cut, Copy and Paste shortcuts wirth the right hand, for people that use the mouse with their left hand.
+
+## Bootmagic
+
+This keymap supports Bootmagic Lite. Bootmagic configures the keyboard when initializing (starting up after connecting the USB cable).
+- hold key in upper left corner while plugging in the USB cable to enter the Bootloader for flashing.
+- hold M key while plugging in the USB cable to use the keyboard in MacOs mode.
+- hold W key while plugging in the USB cable to use the keyboard in Windows mode.
+
+
+## Build
+
+Owners of an older Planck (rev5 or older, those without a USB-C connector) need to disable audio in file 'rules .mk' before building. Otherwise the firmware size will be too large.
diff --git a/keyboards/planck/keymaps/orthodeluxe/rules.mk b/keyboards/planck/keymaps/orthodeluxe/rules.mk
new file mode 100644
index 0000000000..36e0481b67
--- /dev/null
+++ b/keyboards/planck/keymaps/orthodeluxe/rules.mk
@@ -0,0 +1,5 @@
+AUDIO_ENABLE = yes
+BACKLIGHT_ENABLE = no
+KEY_LOCK_ENABLE = yes
+MOUSEKEY_ENABLE = no
+BOOTMAGIC_ENABLE = lite
--
cgit v1.2.3