/* * Copyright (c) 2021 Mike "KemoNine" Crosson * * SPDX-License-Identifier: MIT */ #include #include #include /***************************************** * Macros for filling in "&none" in the right places in the keymap for re-use needs *****************************************/ #define NONE0(X) #define NONE1(X) X #define NONE2(X) NONE1(X) X #define NONE3(X) NONE2(X) X #define NONE4(X) NONE3(X) X #define NONE5(X) NONE4(X) X #define NONE6(X) NONE5(X) X #define NONE7(X) NONE6(X) X #define NONE8(X) NONE7(X) X #define NONE9(X) NONE8(X) X #define NONE10(X) NONE9(X) X #define NONE(HUNDREDS,TENS,ONES) \ NONE##HUNDREDS(NONE10(NONE10(&none))) \ NONE##TENS(NONE10(&none)) \ NONE##ONES(&none) /***************************************** * ARDUX website : https://www.ardux.io * Primary reference : https://www.ardux.io/_FILES/images/ARDUX.jpg *****************************************/ /***************************************** * Setting up ARDUX comboing * - Enabled right OR left handed orientation * - Please note: A/E key positions should be on your INDEX finger * - The online reference is for right handed use * - When using the ARDUX layout left handed you'll want to ensure your keypositions are flipped along the Y axis * - Update/adjust the key positions using your boards keymap * - See below for additional details * - YOU MUST SET THE FOLLOWING CONFIG VALUES FOR THIS SETUP TO WORK PROPERLY IN YOUR BOARDS .conf FILE * - CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY=16 * - CONFIG_ZMK_COMBO_MAX_KEYS_PER_COMBO=8 * - CONFIG_ZMK_COMBO_MAX_PRESSED_COMBOS=8 *****************************************/ /***************************************** * Define which layout you want to use * ONLY ENABLE ONE OF THESE *****************************************/ //#define ARDUX_RIGHT 1 //#define ARDUX_LEFT 1 //#define ARDUX_BIG 1 // If you use COLEMAK as your standard keyboard layout, you may want this // This define will make base ardux keys and N more in line with COLEMAK //#define ARDUX_COLEMAK 1 /***************************************** * Define key positions used for combos * These definitions are used to define the various ARDUX combos * * Please see the documentation on "combos" for details on how to find the proper key positions * * Default key positions are for a generic 4x2 keyboard and should NOT be used outright * DEFINE these definitions in your boards keymap BEFORE including ardux.dtsi *****************************************/ // ARTS Row // #define KEY_A 0 // #define KEY_R 1 // #define KEY_T 2 // #define KEY_S 3 // EYIO Row // #define KEY_E 4 // #define KEY_Y 5 // #define KEY_I 6 // #define KEY_O 7 // Big ardux F1-12 layer keys for combo // #define KEY_F_TOP -1 // #define KEY_F_BOTTOM -1 /***************************************** * Define key position offsets in main keymap * * In order to make this keymap flexible, you must setup the number of &none "offsets" to use * The defines below should be set in your LOCAL keymap and using the above "NONE([hundreds],[tens],[ones])" macro for filling in the gaps *****************************************/ // #define LEADING_NONES NONE(0, 1, 0) // #define MIDDLE_NONES NONE(0, 0, 3) // #define TRAILING_NONES NONE(0, 1, 0) // #define BIG_LEADING_NONES NONE(0, 0, 0) // #define BIG_BETWEEN_ROW_ONE_TWO_NONES NONE(0, 0, 0) // #define BIG_BETWEEN_ROW_TWO_THREE_NONES NONE(0, 0, 0) // #define BIG_BETWEEN_ROW_THREE_THUMBS NONE(0, 0, 0) // #define BIG_TRAILING_NONES NONE(0, 0, 0) /***************************************** * Define custom BT layer extra keys * * You can override the 2 blank keys on the BT select layer by copy/pasting the below into your keymap * *before* including the ardux.dtsfile * Once added to your keymap you can adjust these 2 keys as you see fit *****************************************/ #if !defined ARDUX_BT_TOP #define ARDUX_BT_TOP &out OUT_BLE #endif #if !defined ARDUX_BT_BOTTOM #define ARDUX_BT_BOTTOM &out OUT_USB #endif /***************************************** * Define how long it takes for the combos/holds to 'time out' * See documentation on "combos" for more detail * THE COMBO TIMEOUTS MUST BE THE SAME * https://github.com/zmkfirmware/zmk/issues/905 *****************************************/ #if !defined TIMEOUT_COMBO_2 #define TIMEOUT_COMBO_2 175 #endif #if !defined TIMEOUT_COMBO_3 #define TIMEOUT_COMBO_3 175 #endif #if !defined TIMEOUT_COMBO_4 #define TIMEOUT_COMBO_4 175 #endif #if !defined TIMEOUT_LAYER_HOLD #define TIMEOUT_LAYER_HOLD 200 #endif #if !defined TIMEOUT_STICKY_LEADER_KEY #define TIMEOUT_STICKY_LEADER_KEY 5000 #endif &sk { release-after-ms = ; }; &sl { release-after-ms = ; }; /***************************************** * Define custom layer * * You can override this layer by copy/pasting the into your keymap *before* including the ardux.dtsi file * Once added to your keymap you can adjust as you see fit *****************************************/ #if !defined ARDUX_LAYER_CUSTOM #if defined ARDUX_RIGHT #define ARDUX_LAYER_CUSTOM \ custom { \ label = "Custom"; \ bindings = < \ LEADING_NONES \ &kp C_MUTE &kp INS &kp C_VOL_UP &none \ MIDDLE_NONES \ &sk RSHFT &kp PSCRN &kp C_VOL_DN &mo LAYER_ID_CUSTOM \ TRAILING_NONES \ >; \ }; #endif #if defined ARDUX_LEFT #define ARDUX_LAYER_CUSTOM \ custom { \ label = "Custom"; \ bindings = < \ LEADING_NONES \ &none &kp C_VOL_UP &kp INS &kp C_MUTE \ MIDDLE_NONES \ &mo LAYER_ID_CUSTOM &kp C_VOL_DN &kp PSCRN &sk RSHFT \ TRAILING_NONES \ >; \ }; #endif #endif /***************************************** * Define base layer chars for 'standard ARDUX' or 'COLEMAK' inspired (you can add more by following the pattern below) * Turn on the ARDUX_COLEMAK definition above if you want this change *****************************************/ #define ARDUX_BASE_A A #define ARDUX_BASE_R R #define ARDUX_BASE_T T #define ARDUX_BASE_S S #define ARDUX_BASE_E E #define ARDUX_BASE_Y Y #define ARDUX_BASE_I I #define ARDUX_BASE_O O #define ARDUX_COMBO_N N #if ARDUX_COLEMAK #define ARDUX_BASE_A T #define ARDUX_BASE_R S #define ARDUX_BASE_T R #define ARDUX_BASE_S A #define ARDUX_BASE_E N #define ARDUX_BASE_Y E #define ARDUX_BASE_I I #define ARDUX_BASE_O O #define ARDUX_COMBO_N Y #endif /***************************************** * Layer IDs used by the ARDUX keymap * Do NOT change these and do NOT change the order of the layers as shown below *****************************************/ #define LAYER_ID_GLOBAL -1 #define LAYER_ID_BASE 0 #define LAYER_ID_NUMBERS 1 #define LAYER_ID_SYMBOLS 2 #define LAYER_ID_PARENTHETICALS 3 #define LAYER_ID_NAVIGATION 4 #define LAYER_ID_BT_SEL 5 #define LAYER_ID_CUSTOM 6 #define LAYER_ID_BIG_SYM 7 #define LAYER_ID_BIG_FUNCTION 8 /***************************************** * Standard ARDUX combo definitions * These should NOT be changed and are global in scope *****************************************/ / { combos { compatible = "zmk,combos"; /***************************************** * 2 key combos *****************************************/ // Function layer doesn't apply to non-big ardux presently #if defined ARDUX_BIG combo_layer_functions { key-positions = ; bindings = <&sl LAYER_ID_BIG_FUNCTION>; }; #endif combo_enter { timeout-ms = ; key-positions = ; bindings = <&kp ENTER>; }; combo_control { timeout-ms = ; key-positions = ; bindings = <&sk LCTRL>; }; combo_gui { timeout-ms = ; key-positions = ; bindings = <&sk LGUI>; }; combo_alt { timeout-ms = ; key-positions = ; bindings = <&sk LALT>; }; combo_backspace { timeout-ms = ; key-positions = ; bindings = <&kp BACKSPACE>; }; combo_delete { timeout-ms = ; key-positions = ; bindings = <&kp DELETE>; }; combo_shift_lock { timeout-ms = ; key-positions = ; bindings = <&kt LSHFT>; }; combo_b { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp B>; }; combo_c { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp C>; }; combo_n { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp ARDUX_COMBO_N>; }; combo_f { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp F>; }; combo_g { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp G>; }; combo_u { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp U>; }; combo_h { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp H>; }; combo_v { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp V>; }; combo_j { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp J>; }; combo_w { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp W>; }; combo_k { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp K>; }; combo_period { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp PERIOD>; }; combo_comma { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp COMMA>; }; combo_slash { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp SLASH>; }; combo_exclamation { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp EXCL>; }; combo_seven { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp N7>; }; combo_eight { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp N8>; }; combo_nine { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp N9>; }; combo_zero { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp N0>; }; /***************************************** * 3 key combos *****************************************/ combo_esc { timeout-ms = ; key-positions = ; bindings = <&kp ESC>; }; combo_layer_navigation { timeout-ms = ; key-positions = ; bindings = <&tog LAYER_ID_NAVIGATION>; }; combo_m { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp M>; }; combo_d { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp D>; }; combo_p { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp P>; }; combo_q { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp Q>; }; combo_x { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp X>; }; combo_l { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp L>; }; combo_single_quote { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp SQT>; }; /***************************************** * 4 key combos *****************************************/ combo_tab { timeout-ms = ; key-positions = ; bindings = <&kp TAB>; }; combo_space { timeout-ms = ; key-positions = ; bindings = <&kp SPACE>; }; combo_shift { timeout-ms = ; key-positions = ; bindings = <&sk LSHFT>; }; combo_layer_bt_select { timeout-ms = ; key-positions = ; bindings = <&tog LAYER_ID_BT_SEL>; }; combo_bt_clr { timeout-ms = ; key-positions = ; bindings = <&bt BT_CLR>; }; combo_z { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp Z>; }; combo_caps_lock { layers = ; timeout-ms = ; key-positions = ; bindings = <&kp CAPS>; }; }; }; /***************************************** * Standard ARDUX layer activation definitions * These should NOT be changed and are global in scope *****************************************/ / { behaviors { layer_base_kp: layer_base_kp { compatible = "zmk,behavior-hold-tap"; label = "layer_base_kp"; #binding-cells = <2>; tapping_term_ms = ; flavor = "tap-preferred"; bindings = <&mo>, <&kp>; }; layer_numbers_kp: layer_numbers_kp { compatible = "zmk,behavior-hold-tap"; label = "layer_numbers_kp"; #binding-cells = <2>; tapping_term_ms = ; flavor = "tap-preferred"; bindings = <&mo>, <&kp>; }; layer_symbols_kp: layer_symbols_kp { compatible = "zmk,behavior-hold-tap"; label = "layer_symbols_kp"; #binding-cells = <2>; tapping_term_ms = ; flavor = "tap-preferred"; bindings = <&mo>, <&kp>; }; layer_parentheticals_kp: layer_parentheticals_kp { compatible = "zmk,behavior-hold-tap"; label = "layer_parentheticals_kp"; #binding-cells = <2>; tapping_term_ms = ; flavor = "tap-preferred"; bindings = <&mo>, <&kp>; }; layer_custom_kp: layer_custom_kp { compatible = "zmk,behavior-hold-tap"; label = "layer_custom_kp"; #binding-cells = <2>; tapping_term_ms = ; flavor = "tap-preferred"; bindings = <&mo>, <&kp>; }; ctrl_alt_kp: ctrl_alt_kp { compatible = "zmk,behavior-hold-tap"; label = "ctrl_alt_kp"; #binding-cells = <2>; tapping_term_ms = ; flavor = "tap-preferred"; bindings = <&sk>, <&sk>; }; }; }; /***************************************** * Standard ARDUX layer definitions * !!!!!!!!!! FOR RIGHT HANDED USE !!!!!!!!!! *****************************************/ #if defined ARDUX_RIGHT / { keymap { compatible = "zmk,keymap"; #if defined ARDUX_BIG base { label = "*ARDUX*"; bindings = < BIG_LEADING_NONES &kp MINUS &layer_parentheticals_kp LAYER_ID_PARENTHETICALS ARDUX_BASE_A &kp ARDUX_BASE_R &kp ARDUX_BASE_T &layer_numbers_kp LAYER_ID_NUMBERS ARDUX_BASE_S BIG_BETWEEN_ROW_ONE_TWO_NONES &sk LSHFT &layer_symbols_kp LAYER_ID_SYMBOLS ARDUX_BASE_E &kp ARDUX_BASE_Y &kp ARDUX_BASE_I &layer_custom_kp LAYER_ID_CUSTOM ARDUX_BASE_O BIG_BETWEEN_ROW_TWO_THREE_NONES &kp TAB &kp EQUAL &kp DEL &kp AT &ctrl_alt_kp LALT LCTRL BIG_BETWEEN_ROW_THREE_THUMBS &kp ENTER &kp SPACE &mo LAYER_ID_BIG_SYM BIG_TRAILING_NONES >; }; #else base { label = "ARDUX"; bindings = < LEADING_NONES &layer_parentheticals_kp LAYER_ID_PARENTHETICALS ARDUX_BASE_A &kp ARDUX_BASE_R &kp ARDUX_BASE_T &layer_numbers_kp LAYER_ID_NUMBERS ARDUX_BASE_S MIDDLE_NONES &layer_symbols_kp LAYER_ID_SYMBOLS ARDUX_BASE_E &kp ARDUX_BASE_Y &kp ARDUX_BASE_I &layer_custom_kp LAYER_ID_CUSTOM ARDUX_BASE_O TRAILING_NONES #if defined CUSTOM_THUMB CUSTOM_THUMB #endif >; }; #endif numbers { label = "Number"; bindings = < LEADING_NONES &kp N1 &kp N2 &kp N3 &mo LAYER_ID_NUMBERS MIDDLE_NONES &kp N4 &kp N5 &kp N6 &none TRAILING_NONES >; }; symbols { label = "Symbol"; bindings = < LEADING_NONES &kp EXCL &kp BSLH &kp SEMI &kp GRAVE MIDDLE_NONES &mo LAYER_ID_SYMBOLS &kp QMARK &kp MINUS &kp EQUAL TRAILING_NONES >; }; parentheticals { label = "Paren"; bindings = < LEADING_NONES &mo LAYER_ID_PARENTHETICALS &kp LPAR &kp RPAR &kp LBRC MIDDLE_NONES &none &kp LBKT &kp RBKT &kp RBRC TRAILING_NONES >; }; navigation { label = "Nav"; bindings = < LEADING_NONES &kp HOME &kp UP &kp END &kp PG_UP MIDDLE_NONES &kp LEFT &kp DOWN &kp RIGHT &kp PG_DN TRAILING_NONES >; }; bt { label = "BT"; bindings = < LEADING_NONES &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 ARDUX_BT_TOP MIDDLE_NONES &bt BT_SEL 3 &bt BT_SEL 4 &bt BT_SEL 5 ARDUX_BT_BOTTOM TRAILING_NONES >; }; ARDUX_LAYER_CUSTOM #if defined ARDUX_BIG big_ardux_symbol { label = "*Symbol*"; bindings = < BIG_LEADING_NONES &kp GRAVE &kp HASH &kp LBRC &kp RBRC &kp CARET BIG_BETWEEN_ROW_ONE_TWO_NONES &kp BSLH &kp DLLR &kp LPAR &kp RPAR &kp AMPS BIG_BETWEEN_ROW_TWO_THREE_NONES &kp PIPE &kp PRCNT &kp LBKT &kp RBKT &kp ASTRK BIG_BETWEEN_ROW_THREE_THUMBS &trans &kp SEMI &none BIG_TRAILING_NONES >; }; big_ardux_function { label = "*Func*"; bindings = < BIG_LEADING_NONES &none &kp F1 &kp F2 &kp F3 &kp F4 BIG_BETWEEN_ROW_ONE_TWO_NONES &none &kp F5 &kp F6 &kp F7 &kp F8 BIG_BETWEEN_ROW_TWO_THREE_NONES &none &kp F9 &kp F10 &kp F11 &kp F12 BIG_BETWEEN_ROW_THREE_THUMBS &trans &none &none BIG_TRAILING_NONES >; }; #endif }; }; #endif /***************************************** * Standard ARDUX layer definitions * !!!!!!!!!! FOR LEFT HANDED USE !!!!!!!!!! *****************************************/ #if defined ARDUX_LEFT / { keymap { compatible = "zmk,keymap"; #if defined ARDUX_BIG base { label = "*ARDUX*"; bindings = < BIG_LEADING_NONES &layer_numbers_kp LAYER_ID_NUMBERS ARDUX_BASE_S &kp ARDUX_BASE_T &kp ARDUX_BASE_R &layer_parentheticals_kp LAYER_ID_PARENTHETICALS ARDUX_BASE_A &kp MINUS BIG_BETWEEN_ROW_ONE_TWO_NONES &layer_custom_kp LAYER_ID_CUSTOM ARDUX_BASE_O &kp ARDUX_BASE_I &kp ARDUX_BASE_Y &layer_symbols_kp LAYER_ID_SYMBOLS ARDUX_BASE_E &sk LSHFT BIG_BETWEEN_ROW_TWO_THREE_NONES &ctrl_alt_kp LALT LCTRL &kp AT &kp DEL &kp EQUAL &kp TAB BIG_BETWEEN_ROW_THREE_THUMBS &mo LAYER_ID_BIG_SYM &kp SPACE &kp ENTER BIG_TRAILING_NONES >; }; #else base { label = "ARDUX"; bindings = < LEADING_NONES &layer_numbers_kp LAYER_ID_NUMBERS ARDUX_BASE_S &kp ARDUX_BASE_T &kp ARDUX_BASE_R &layer_parentheticals_kp LAYER_ID_PARENTHETICALS ARDUX_BASE_A MIDDLE_NONES &layer_custom_kp LAYER_ID_CUSTOM ARDUX_BASE_O &kp ARDUX_BASE_I &kp ARDUX_BASE_Y &layer_symbols_kp LAYER_ID_SYMBOLS ARDUX_BASE_E TRAILING_NONES #if defined CUSTOM_THUMB CUSTOM_THUMB #endif >; }; #endif numbers { label = "Number"; bindings = < LEADING_NONES &mo LAYER_ID_NUMBERS &kp N3 &kp N2 &kp N1 MIDDLE_NONES &none &kp N6 &kp N5 &kp N4 TRAILING_NONES >; }; symbols { label = "Symbol"; bindings = < LEADING_NONES &kp GRAVE &kp SEMI &kp BSLH &kp EXCL MIDDLE_NONES &kp EQUAL &kp MINUS &kp QMARK &mo LAYER_ID_SYMBOLS TRAILING_NONES >; }; parentheticals { label = "Paren"; bindings = < LEADING_NONES &kp LBRC &kp LPAR &kp RPAR &mo LAYER_ID_PARENTHETICALS MIDDLE_NONES &kp RBRC &kp LBKT &kp RBKT &none TRAILING_NONES >; }; navigation { label = "Nav"; bindings = < LEADING_NONES &kp PG_UP &kp HOME &kp UP &kp END MIDDLE_NONES &kp PG_DN &kp LEFT &kp DOWN &kp RIGHT TRAILING_NONES >; }; bt { label = "BT"; bindings = < LEADING_NONES ARDUX_BT_TOP &bt BT_SEL 2 &bt BT_SEL 1 &bt BT_SEL 0 MIDDLE_NONES ARDUX_BT_BOTTOM &bt BT_SEL 5 &bt BT_SEL 4 &bt BT_SEL 3 TRAILING_NONES >; }; ARDUX_LAYER_CUSTOM #if defined ARDUX_BIG big_ardux_symbol { label = "*Symbol*"; bindings = < BIG_LEADING_NONES &kp CARET &kp LBRC &kp RBRC &kp HASH &kp GRAVE BIG_BETWEEN_ROW_ONE_TWO_NONES &kp AMPS &kp LPAR &kp RPAR &kp DLLR &kp BSLH BIG_BETWEEN_ROW_TWO_THREE_NONES &kp ASTRK &kp LBKT &kp RBKT &kp PRCNT &kp PIPE BIG_BETWEEN_ROW_THREE_THUMBS &none &kp SEMI &none BIG_TRAILING_NONES >; }; big_ardux_function { label = "*Func*"; bindings = < BIG_LEADING_NONES &kp F4 &kp F3 &kp F2 &kp F1 &none BIG_BETWEEN_ROW_ONE_TWO_NONES &kp F8 &kp F7 &kp F6 &kp F5 &none BIG_BETWEEN_ROW_TWO_THREE_NONES &kp F12 &kp F11 &kp F10 &kp F9 &none BIG_BETWEEN_ROW_THREE_THUMBS &none &none &none BIG_TRAILING_NONES >; }; #endif }; }; #endif