From 317b800bbb28c5ae91f413cfd17471a06de76c2f Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Sun, 13 Nov 2022 02:00:13 +0100 Subject: [Keymap] Update/refactor userspace and add keymaps for rmeli (#18398) Co-authored-by: Drashna Jaelre Co-authored-by: Ryan Co-authored-by: Elliot Powell --- keyboards/boardsource/lulu/keymaps/rmeli/config.h | 45 +++++ keyboards/boardsource/lulu/keymaps/rmeli/keymap.c | 108 ++++++++++ keyboards/boardsource/lulu/keymaps/rmeli/rules.mk | 9 + keyboards/crkbd/keymaps/rmeli/config.h | 25 +-- keyboards/crkbd/keymaps/rmeli/keymap.c | 101 +++++----- keyboards/crkbd/keymaps/rmeli/rules.mk | 6 +- keyboards/preonic/keymaps/rmeli/config.h | 45 +++++ keyboards/preonic/keymaps/rmeli/keymap.c | 231 ++++++++++++++++++++++ keyboards/preonic/keymaps/rmeli/readme.md | 1 + keyboards/preonic/keymaps/rmeli/rules.mk | 12 ++ 10 files changed, 509 insertions(+), 74 deletions(-) create mode 100644 keyboards/boardsource/lulu/keymaps/rmeli/config.h create mode 100644 keyboards/boardsource/lulu/keymaps/rmeli/keymap.c create mode 100644 keyboards/boardsource/lulu/keymaps/rmeli/rules.mk create mode 100644 keyboards/preonic/keymaps/rmeli/config.h create mode 100644 keyboards/preonic/keymaps/rmeli/keymap.c create mode 100644 keyboards/preonic/keymaps/rmeli/readme.md create mode 100644 keyboards/preonic/keymaps/rmeli/rules.mk (limited to 'keyboards') diff --git a/keyboards/boardsource/lulu/keymaps/rmeli/config.h b/keyboards/boardsource/lulu/keymaps/rmeli/config.h new file mode 100644 index 0000000000..4d8823d785 --- /dev/null +++ b/keyboards/boardsource/lulu/keymaps/rmeli/config.h @@ -0,0 +1,45 @@ +/* +Copyright 2022 Rocco Meli <@RMeli> + +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 MASTER_LEFT // Left side is the master +#define SPLIT_LED_STATE_ENABLE + +#ifdef RGB_MATRIX_ENABLE +// Configure RGB Matrix +# define RGB_MATRIX_KEYPRESSES // enable keypress effects +# define RGB_MATRIX_LED_FLUSH_LIMIT 16 +# define RGB_DISABLE_WHEN_USB_SUSPENDED +# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR +# define RGB_MATRIX_STARTUP_HUE 10 +# define RGB_MATRIX_STARTUP_SAT 255 +# define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS +// Disable RGB Matrix effects (from lulu/config.h) +# undef ENABLE_RGB_MATRIX_ALPHAS_MODS +# undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +# undef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +# undef ENABLE_RGB_MATRIX_BREATHING +# undef ENABLE_RGB_MATRIX_BAND_SAT +# undef ENABLE_RGB_MATRIX_BAND_VAL +// Enable RGB Matrix effects +# define ENABLE_RGB_MATRIX_BREATHING +# define ENABLE_RGB_MATRIX_TYPING_HEATMAP +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +# define ENABLE_RGB_MATRIX_SOLID_COLOR +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#endif diff --git a/keyboards/boardsource/lulu/keymaps/rmeli/keymap.c b/keyboards/boardsource/lulu/keymaps/rmeli/keymap.c new file mode 100644 index 0000000000..f9be18ee2d --- /dev/null +++ b/keyboards/boardsource/lulu/keymaps/rmeli/keymap.c @@ -0,0 +1,108 @@ +/* +Copyright 2022 Cole Smith +Copyright 2022 Rocco Meli <@RMeli> + +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 "rmeli.h" + +enum layers { + _QWERTY, + _COLEMAK_DH, + _RAISE, + _LOWER, + _ADJUST, +}; + +#define RAISE MO(_RAISE) +#define LOWER MO(_LOWER) + +#define QWY_DF DF(_QWERTY) +#define CMK_DF DF(_COLEMAK_DH) + +// clang-format off +#define __________THUMB_LEFT_x4___________ KC_LALT, KC_LGUI, LOWER, KC_SPC +#define __________THUMB_RIGHT_x4__________ KC_ENT, RAISE, KC_LCTL, KC_RGUI +// clang-format on + +/* LAYOUT + * + * ,-----------------------------. ,-----------------------------. + * | | | | | | | | | | | | | | + * |----+----+----+----+----+----| |----+----+----+----+----+----| + * | | | | | | | | | | | | | | + * |----+----+----+----+----+----| |----+----+----+----+----+----| + * | | | | | | |-----. ,-----| | | | | | | + * |----+----+----+----+----+----| | | |----+----+----+----+----+----| + * | | | | | | |-----| |-----| | | | | | | + * `----------------------------/ / \ \----------------------------' + * | | | | / / \ \ | | | | + * | | | |/ / \ \ | | | | + * `--------------''-----' '------''--------------' + */ + +// Define wrapper for standard LULU layout +#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = LAYOUT_wrapper( + ___________________NUMBER_LEFT_x6___________________, ___________________NUMBER_RIGHT_x6__________________, + ___________________QWERTY_L1_x6_____________________, ___________________QWERTY_R1_x6_____________________, + ___________________QWERTY_L2_x6_____________________, ___________________QWERTY_R2_x6_____________________, + ___________________QWERTY_L3_x6_____________________, KC_LBRC, KC_RBRC, ___________________QWERTY_R3_x6_____________________, + __________THUMB_LEFT_x4___________, __________THUMB_RIGHT_x4__________ + ), + + [_COLEMAK_DH] = LAYOUT_wrapper( + ___________________NUMBER_LEFT_x6___________________, ___________________NUMBER_RIGHT_x6__________________, + ________________COLEMAK_MOD_DH_L1_x6________________, ________________COLEMAK_MOD_DH_R1_x6________________, + ________________COLEMAK_MOD_DH_L2_x6________________, ________________COLEMAK_MOD_DH_R2_x6________________, + ________________COLEMAK_MOD_DH_L3_x6________________, KC_LBRC, KC_RBRC, ________________COLEMAK_MOD_DH_R3_x6________________, + __________THUMB_LEFT_x4___________, __________THUMB_RIGHT_x4__________ + ), + + [_LOWER] = LAYOUT_wrapper( + ____________________FUNC_LEFT_x6____________________, ____________________FUNC_RIGHT_x6___________________, + _______, ______________NUMBER_LEFT_x5_______________, ______________NUMBER_RIGHT_x5______________, _______, + _______, ______________UNICODE_L2_x5________________, ________________NAV_R2_x5__________________, XXXXXXX, + _______, ______________UNICODE_L3_x5________________, _______, _______, ________________NAV_R3_x5__________________, _______, + _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_RAISE] = LAYOUT_wrapper( + ___________________NUMBER_LEFT_x6___________________, ___________________NUMBER_RIGHT_x6__________________, + ___________________SYMBOL_LEFT_x6___________________, ___________________SYMBOL_RIGHT_x6__________________, + _______, ____________NAV_VIM_x4____________, XXXXXXX, ____________________SYMBOL_R2_x6____________________, + _______, _________________NONE_5x___________________, _______, _______, ____________________SYMBOL_R3_x6____________________, + _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_ADJUST] = LAYOUT_wrapper( + QK_BOOT, _________________NONE_5x___________________, ______________________NONE_6x_______________________, + XXXXXXX, _________________NONE_5x___________________, _______________CONFIG_R1_x5________________, QWY_DF, + RGB_TOG, ________________RGB_L2_x5__________________, _______________CONFIG_R2_x5________________, XXXXXXX, + XXXXXXX, ________________RGB_L3_x5__________________, _______, _______, _______________CONFIG_R3_x5________________, CMK_DF, + _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; +// clang-format on + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} diff --git a/keyboards/boardsource/lulu/keymaps/rmeli/rules.mk b/keyboards/boardsource/lulu/keymaps/rmeli/rules.mk new file mode 100644 index 0000000000..035e9814e2 --- /dev/null +++ b/keyboards/boardsource/lulu/keymaps/rmeli/rules.mk @@ -0,0 +1,9 @@ +TAP_DANCE_ENABLE = yes +AUTO_SHIFT_ENABLE = no // disable auto-shift with home row mods + +UNICODEMAP_ENABLE = yes +NKRO_ENABLE = yes +MAGIC_ENABLE = yes + +RGBLIGHT_ENABLE = no +RGB_MATRIX_ENABLE = yes \ No newline at end of file diff --git a/keyboards/crkbd/keymaps/rmeli/config.h b/keyboards/crkbd/keymaps/rmeli/config.h index 36fb755d00..2f06b82cc1 100644 --- a/keyboards/crkbd/keymaps/rmeli/config.h +++ b/keyboards/crkbd/keymaps/rmeli/config.h @@ -21,32 +21,19 @@ along with this program. If not, see . #pragma once -#define MASTER_LEFT // Left side is the master +#define MASTER_LEFT // Left side is the master #define SPLIT_LED_STATE_ENABLE -#define TAPPING_TERM 200 - -#define UNICODE_SELECTED_MODES UC_MAC, UC_LNX - -#define AUTO_SHIFT_REPEAT - -#ifdef RGBLIGHT_ENABLE -# define RGBLIGHT_LIMIT_VAL 120 -# define RGBLIGHT_HUE_STEP 10 -# define RGBLIGHT_SAT_STEP 17 -# define RGBLIGHT_VAL_STEP 17 -#endif - #ifdef RGB_MATRIX_ENABLE // RGB matrix options -# define RGB_MATRIX_KEYPRESSES // enable keypress effects +# define RGB_MATRIX_KEYPRESSES // enable keypress effects # define RGB_MATRIX_LED_FLUSH_LIMIT 16 # define RGB_DISABLE_WHEN_USB_SUSPENDED // Disable unwanted R2G effects (from r2g/config.h) # undef ENABLE_RGB_MATRIX_ALPHAS_MODS # undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN # undef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -# undef ENABLE_RGB_MATRIX_BREATHING +# define ENABLE_RGB_MATRIX_BREATHING # undef ENABLE_RGB_MATRIX_BAND_SAT # undef ENABLE_RGB_MATRIX_BAND_VAL # undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT @@ -57,8 +44,8 @@ along with this program. If not, see . # undef ENABLE_RGB_MATRIX_RAINDROPS # undef ENABLE_RGB_MATRIX_HUE_BREATHING # undef ENABLE_RGB_MATRIX_PIXEL_FRACTAL -//# undef ENABLE_RGB_MATRIX_TYPING_HEATMAP -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +# define ENABLE_RGB_MATRIX_TYPING_HEATMAP +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE # undef ENABLE_RGB_MATRIX_SOLID_REACTIVE # undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS # undef ENABLE_RGB_MATRIX_SPLASH @@ -77,4 +64,4 @@ along with this program. If not, see . #undef LOCKING_SUPPORT_ENABLE #undef LOCKING_RESYNC_ENABLE #define NO_MUSIC_MODE -#define LAYER_STATE_8BIT // Limit to 8 layers +#define LAYER_STATE_8BIT // Limit to 8 layers diff --git a/keyboards/crkbd/keymaps/rmeli/keymap.c b/keyboards/crkbd/keymaps/rmeli/keymap.c index f8d298bbdd..efef3c3d70 100644 --- a/keyboards/crkbd/keymaps/rmeli/keymap.c +++ b/keyboards/crkbd/keymaps/rmeli/keymap.c @@ -1,6 +1,6 @@ /* Copyright 2019 @foostan -Copyright 2020 Drashna Jaelre <@drashna> +Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) Copyright 2021 Rocco Meli <@RMeli> This program is free software: you can redistribute it and/or modify @@ -68,64 +68,61 @@ enum layer_names { #define _CMK 1 #define _CFG 4 +#define ______THUMB_LEFT_x3______ KC_LGUI, MO(_DWN), KC_SPC +#define ______THUMB_RIGHT_x3_____ KC_ENT, MO(_UP), KC_RCTL + +// LAYOUT +// +// |-----------------------------| |-----------------------------| +// | | | | | | | | | | | | | | +// |----+----+----+----+----+----| |----+----+----+----+----+----| +// | | | | | | | | | | | | | | +// |----+----+----+----+----+----| |----+----+----+----+----+----| +// | | | | | | | | | | | | | | +// |----+----+----+----+----+----+----| |----+----+----+----+----+----+----| +// | | | | | | | | +// |--------------| |--------------| + +// Define wrapper for standard CRKB layout +#define LAYOUT_wrapper(...) LAYOUT_split_3x6_3(__VA_ARGS__) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_QWERTY] = LAYOUT_split_3x6_3( - //|-----------------------------------------------------| |-----------------------------------------------------| - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - TD_ED, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - TD_LSPC, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, TD_RSPC, - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_LGUI,MO(_DWN), KC_SPC, KC_ENT,MO(_UP), KC_RCTL - //|--------------------------| |--------------------------| + + [_QWERTY] = LAYOUT_wrapper( + // clang-format off + ___________________QWERTY_L1_x6_____________________, ___________________QWERTY_R1_x6_____________________, + ___________________QWERTY_L2_x6_____________________, ___________________QWERTY_R2_x6_____________________, + ___________________QWERTY_L3_x6_____________________, ___________________QWERTY_R3_x6_____________________, + ______THUMB_LEFT_x3______, ______THUMB_RIGHT_x3_____ ), - [_COLEMAK_DH] = LAYOUT_split_3x6_3( - //|-----------------------------------------------------| |-----------------------------------------------------| - KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_SCLN, KC_P, KC_BSPC, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - TD_ED, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - TD_LSPC, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, TD_RSPC, - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_LGUI,MO(_DWN), KC_SPC, KC_ENT,MO(_UP), KC_RCTL - //|--------------------------| |--------------------------| + [_COLEMAK_DH] = LAYOUT_wrapper( + ________________COLEMAK_MOD_DH_L1_x6________________, ________________COLEMAK_MOD_DH_R1_x6________________, + ________________COLEMAK_MOD_DH_L2_x6________________, ________________COLEMAK_MOD_DH_R2_x6________________, + ________________COLEMAK_MOD_DH_L3_x6________________, ________________COLEMAK_MOD_DH_R3_x6________________, + ______THUMB_LEFT_x3______, ______THUMB_RIGHT_x3_____ ), - [_DWN] = LAYOUT_split_3x6_3( - //|-----------------------------------------------------| |-----------------------------------------------------| - _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, A_GRV, E_GRV, I_GRV, O_GRV, U_GRV, XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, KC_PGUP, XXXXXXX, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, A_UML, E_ACT, I_CIR, O_UML, U_UML, XXXXXXX, KC_LEFT, KC_DOWN,KC_RIGHT, KC_PGDN, _______, - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_LGUI, _______, _______, _______,MO(_CFG), _______ - //|--------------------------| |--------------------------| + [_DWN] = LAYOUT_wrapper( + _______, ______________NUMBER_LEFT_x5_______________, ______________NUMBER_RIGHT_x5______________, _______, + _______, ______________UNICODE_L2_x5________________, ________________NAV_R2_x5__________________, XXXXXXX, + _______, ______________UNICODE_L3_x5________________, ________________NAV_R3_x5__________________, _______, + KC_LGUI, _______, _______, _______,MO(_CFG), _______ ), - [_UP] = LAYOUT_split_3x6_3( - //|-----------------------------------------------------| |-----------------------------------------------------| - _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, XXXXXXX, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_GRV, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_TILD, - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - _______,MO(_CFG), _______, _______, _______, _______ - //|--------------------------| |--------------------------| + [_UP] = LAYOUT_wrapper( + ___________________SYMBOL_LEFT_x6___________________, ___________________SYMBOL_RIGHT_x6__________________, + _______, ____________NAV_VIM_x4____________, XXXXXXX, ____________________SYMBOL_R2_x6____________________, + _______, _________________NONE_5x___________________, ____________________SYMBOL_R3_x6____________________, + _______,MO(_CFG), _______, _______, _______, _______ ), - [_CONFIG] = LAYOUT_split_3x6_3( - //|-----------------------------------------------------| |-----------------------------------------------------| - QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, UC_MOD, KC_ASUP, NK_ON, XXXXXXX, XXXXXXX,DF(_QWY), - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, XXXXXXX, KC_ASTG, NK_TOGG, XXXXXXX, XXXXXXX, XXXXXXX, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - XXXXXXX,RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPD, UC_RMOD, KC_ASDN, NK_OFF, XXXXXXX, XXXXXXX,DF(_CMK), - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, _______, _______ - //|--------------------------| |--------------------------| + [_CONFIG] = LAYOUT_wrapper( + QK_BOOT, _________________NONE_5x___________________, _______________CONFIG_R1_x5________________,DF(_QWY), + RGB_TOG, ________________RGB_L2_x5__________________, _______________CONFIG_R2_x5________________, XXXXXXX, + XXXXXXX, ________________RGB_L3_x5__________________, _______________CONFIG_R3_x5________________,DF(_CMK), + _______, _______, _______, _______, _______, _______ ) -}; \ No newline at end of file +}; +// clang-format on diff --git a/keyboards/crkbd/keymaps/rmeli/rules.mk b/keyboards/crkbd/keymaps/rmeli/rules.mk index 8e9dbbf8cf..58a00ed6ba 100644 --- a/keyboards/crkbd/keymaps/rmeli/rules.mk +++ b/keyboards/crkbd/keymaps/rmeli/rules.mk @@ -2,11 +2,11 @@ OLED_ENABLE = yes OLED_DRIVER = SSD1306 TAP_DANCE_ENABLE = yes -AUTO_SHIFT_ENABLE = yes +AUTO_SHIFT_ENABLE = no // disable auto-shift with home row mods UNICODEMAP_ENABLE = yes +NKRO_ENABLE = yes +MAGIC_ENABLE = yes RGBLIGHT_ENABLE = no RGB_MATRIX_ENABLE = yes - -NKRO_ENABLE = yes diff --git a/keyboards/preonic/keymaps/rmeli/config.h b/keyboards/preonic/keymaps/rmeli/config.h new file mode 100644 index 0000000000..6f8b8b6c70 --- /dev/null +++ b/keyboards/preonic/keymaps/rmeli/config.h @@ -0,0 +1,45 @@ +/* Copyright 2015-2021 Jack Humbert + * + * 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 + +#ifdef AUDIO_ENABLE +# define STARTUP_SONG SONG(PREONIC_SOUND) +// #define STARTUP_SONG SONG(NO_SOUND) + +# define DEFAULT_LAYER_SONGS \ + { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND) } +#endif + +#define MUSIC_MASK (keycode != KC_NO) + +/* + * MIDI options + */ + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ + +#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED diff --git a/keyboards/preonic/keymaps/rmeli/keymap.c b/keyboards/preonic/keymaps/rmeli/keymap.c new file mode 100644 index 0000000000..da6269129e --- /dev/null +++ b/keyboards/preonic/keymaps/rmeli/keymap.c @@ -0,0 +1,231 @@ +/* Copyright 2015-2021 Jack Humbert + * Copyright 2022 Rocco Meli <@RMeli> + * + * 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" + +#include "rmeli.h" + +enum preonic_layers { _QWERTY, _COLEMAK, _LOWER, _RAISE, _ADJUST }; +enum preonic_keycodes { QWERTY = SAFE_RANGE, COLEMAK, LOWER, RAISE, BACKLIT }; + +#define ____________________BOTTOM_L_x6_____________________ BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC +#define ____________________BOTTOM_R_x6_____________________ KC_ENT, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + +/* LAYOUT + * + * ,-----------------------------------------------------------. + * | | | | | | | | | | | | | + * |----+----+----+----+----+----+----+----+----+----+----+----| + * | | | | | | | | | | | | | + * |----+----+----+----+----+----+----+----+----+----+----+----| + * | | | | | | | | | | | | | + * |----+----+----+----+----+----+----+----+----+----+----+----| + * | | | | | | | | | | | | | + * |----+----+----+----+----+----+----+----+----+----+----+----| + * | | | | | | | | | | | | | + * `----+----+----+----+----+----+----+----+----+----+----+----' + */ + +// Define wrapper for standard CRKB layout +#define LAYOUT_wrapper(...) LAYOUT_preonic_grid(__VA_ARGS__) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_QWERTY] = LAYOUT_wrapper( + ___________________NUMBER_LEFT_x6___________________, ___________________NUMBER_RIGHT_x6__________________, + ___________________QWERTY_L1_x6_____________________, ___________________QWERTY_R1_x6_____________________, + ___________________QWERTY_L2_x6_____________________, ___________________QWERTY_R2_x6_____________________, + ___________________QWERTY_L3_x6_____________________, ___________________QWERTY_R3_x6_____________________, + ____________________BOTTOM_L_x6_____________________, ____________________BOTTOM_R_x6_____________________ +), + +[_COLEMAK] = LAYOUT_wrapper( + ___________________NUMBER_LEFT_x6___________________, ___________________NUMBER_RIGHT_x6__________________, + ________________COLEMAK_MOD_DH_L1_x6________________, ________________COLEMAK_MOD_DH_R1_x6________________, + ________________COLEMAK_MOD_DH_L2_x6________________, ________________COLEMAK_MOD_DH_R2_x6________________, + ________________COLEMAK_MOD_DH_L3_x6________________, ________________COLEMAK_MOD_DH_R3_x6________________, + ____________________BOTTOM_L_x6_____________________, ____________________BOTTOM_R_x6_____________________ +), + +[_LOWER] = LAYOUT_wrapper( + ____________________FUNC_LEFT_x6____________________, ____________________FUNC_RIGHT_x6___________________, + ___________________NUMBER_LEFT_x6___________________, ___________________NUMBER_RIGHT_x6__________________, + _______, ______________UNICODE_L2_x5________________, ________________NAV_R2_x5__________________, XXXXXXX, + _______, ______________UNICODE_L3_x5________________, ________________NAV_R3_x5__________________, _______, + ______________________BLANK_6x______________________, ______________________BLANK_6x______________________ +), + +[_RAISE] = LAYOUT_wrapper( + ___________________NUMBER_LEFT_x6___________________, ___________________NUMBER_RIGHT_x6__________________, + ___________________SYMBOL_LEFT_x6___________________, ___________________SYMBOL_RIGHT_x6__________________, + _______, ____________NAV_VIM_x4____________, XXXXXXX, ____________________SYMBOL_R2_x6____________________, + _______, _________________NONE_5x___________________, ____________________SYMBOL_R3_x6____________________, + ______________________BLANK_6x______________________, ______________________BLANK_6x______________________ +), + +[_ADJUST] = LAYOUT_wrapper( + QK_BOOT, _________________NONE_5x___________________, ______________________NONE_6x_______________________, + XXXXXXX, MU_ON, AU_ON, MI_ON, XXXXXXX, XXXXXXX, _______________CONFIG_R1_x5________________, QWERTY, + RESET, MU_MOD, AU_TOG, MI_TOG, XXXXXXX, XXXXXXX, _______________CONFIG_R2_x5________________, XXXXXXX, + XXXXXXX, MU_OFF, AU_OFF, MI_OFF, XXXXXXX, XXXXXXX, _______________CONFIG_R3_x5________________, COLEMAK, + ______________________BLANK_6x______________________, ______________________BLANK_6x______________________ +) +}; +// clang-format on + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + 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; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); +#ifdef BACKLIGHT_ENABLE + backlight_step(); +#endif +#ifdef RGBLIGHT_ENABLE + rgblight_step(); +#endif +#ifdef __AVR__ + writePinLow(E6); +#endif + } else { + unregister_code(KC_RSFT); +#ifdef __AVR__ + writePinHigh(E6); +#endif + } + return false; + break; + } + return true; +}; + +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (muse_mode) { + if (IS_LAYER_ON(_RAISE)) { + if (clockwise) { + muse_offset++; + } else { + muse_offset--; + } + } else { + if (clockwise) { + muse_tempo += 1; + } else { + muse_tempo -= 1; + } + } + } else { + if (clockwise) { + register_code(KC_PGDN); + unregister_code(KC_PGDN); + } else { + register_code(KC_PGUP); + unregister_code(KC_PGUP); + } + } + return true; +} + +bool dip_switch_update_user(uint8_t index, bool active) { + switch (index) { + case 0: + if (active) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + break; + case 1: + if (active) { + muse_mode = true; + } else { + muse_mode = false; + } + } + return true; +} + +void matrix_scan_user(void) { +#ifdef AUDIO_ENABLE + if (muse_mode) { + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } else { + if (muse_counter) { + stop_all_notes(); + muse_counter = 0; + } + } +#endif +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} diff --git a/keyboards/preonic/keymaps/rmeli/readme.md b/keyboards/preonic/keymaps/rmeli/readme.md new file mode 100644 index 0000000000..e911968dd9 --- /dev/null +++ b/keyboards/preonic/keymaps/rmeli/readme.md @@ -0,0 +1 @@ +# The default Preonic layout - largely based on the Planck's \ No newline at end of file diff --git a/keyboards/preonic/keymaps/rmeli/rules.mk b/keyboards/preonic/keymaps/rmeli/rules.mk new file mode 100644 index 0000000000..3903cc1228 --- /dev/null +++ b/keyboards/preonic/keymaps/rmeli/rules.mk @@ -0,0 +1,12 @@ +TAP_DANCE_ENABLE = yes +AUTO_SHIFT_ENABLE = no + +MAGIC_ENABLE = yes + +UNICODEMAP_ENABLE = yes + +# Turn off rev3_drop options +RGBLIGHT_ENABLE = no +MOUSEKEY_ENABLE = no + +SRC += muse.c -- cgit v1.2.3