qmk

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

commit b2877470ced1deb9651ecb39f6a82f5ef380b399
parent e0c9cfad86a7c17863db08574472e866aa3d37b7
Author: Drashna Jaelre <drashna@live.com>
Date:   Mon, 16 Jul 2018 18:04:32 -0700

Update to drashna userspace and keymaps (#3172)

* Use string with delay

* Add skipped region to ergodox

* Add send string config

* Use default_layer_state instead of function

* Fully generalize keyboards

* old iris cleanup

* Fix Drashna keymap compile issues

By checking to see if secret.c exists before actually trying to add it

* Remove unnecessary references

* Add 4x12 ortho board

* Update userspace readme for secrets

* Make RGB more modular

* Fix iris keymap, since we don't need the lower left (Function keys)

* Fix includes

* Add Blanks

* Fix Ergodox lower layer

* Add suspend commands

* Add Maltron Layout

* Add additional layouts

* Finish adding gamepad to Iris

* Tweaks to iris gamepag layer

* make gaming layers more friendly

* minor gaming layer tweak

* Add Carplax

* Add modded key timer function

* Cleanup and macro documentation

* Add QMK DFU info

* Add 'old' keymap for 12 LED spare

* Update Pro Micro documentation

* Disable twinkling so it fits in firmware space

* Switch to QMK DFU bootloader, since it's better anyhow

* Write default layer state colors to EEPROM

Since we are writing to EEPROM anyways, and this way, it sticks on reboot

* Fix QMK DFU bootloader options

* More updates for QMK DFU support

* Use matrix scanning hack for startup_user until #3113 gets merged

* Fix indicator light consistency issue

* Add/readd ifdefs to indicators

* Add/readd alt indicator

* Remove RGB Twinkling from Viterbi macro pad

* Fix default layer color detection

* Fix rebase and detection issues

* Cleanup code so it will compile if RGBLIGHT is disabled

* Revert vsode settings

* Use Pragma Once instead of boilerplate code

Diffstat:
keyboards/iris/keymaps/drashna/config.h | 14+++++++-------
keyboards/iris/keymaps/drashna/keymap.c | 50+++++++++++++++++++++++++-------------------------
keyboards/iris/keymaps/drashna/rules.mk | 2++
keyboards/iris/keymaps/drashna_old/config.h | 8++++++--
keyboards/iris/keymaps/drashna_old/keymap.c | 90+------------------------------------------------------------------------------
keyboards/iris/keymaps/drashna_old/rules.mk | 4++++
keyboards/orthodox/keymaps/drashna/config.h | 14+++++++-------
keyboards/orthodox/keymaps/drashna/keymap.c | 56++++++++++++++++++++++----------------------------------
keyboards/orthodox/keymaps/drashna/rules.mk | 2++
keyboards/viterbi/keymaps/drashna/config.h | 11+++++------
keyboards/viterbi/keymaps/drashna/keymap.c | 13+++++++++----
keyboards/viterbi/keymaps/drashna/rules.mk | 3++-
keyboards/viterbi/keymaps/drashna_old/config.h | 86+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
keyboards/viterbi/keymaps/drashna_old/keymap.c | 2++
keyboards/viterbi/keymaps/drashna_old/rules.mk | 28++++++++++++++++++++++++++++
layouts/community/ergodox/drashna/config.h | 7++-----
layouts/community/ergodox/drashna/keymap.c | 43+++++++++++++++++++++++++++----------------
layouts/community/ergodox/drashna/rules.mk | 5+++--
layouts/community/ortho_4x12/drashna/config.h | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
layouts/community/ortho_4x12/drashna/keymap.c | 177+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
layouts/community/ortho_4x12/drashna/readme.md | 2++
layouts/community/ortho_4x12/drashna/rules.mk | 20++++++++++++++++++++
users/drashna/config.h | 6+++---
users/drashna/drashna.c | 96+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
users/drashna/drashna.h | 138+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
users/drashna/readme.md | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
users/drashna/rgb_stuff.c | 147++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
users/drashna/rules.mk | 9+++++++--
28 files changed, 883 insertions(+), 300 deletions(-)

diff --git a/keyboards/iris/keymaps/drashna/config.h b/keyboards/iris/keymaps/drashna/config.h @@ -15,10 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "config_common.h" +#pragma once /* Use I2C or Serial, not both */ @@ -52,6 +49,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #endif //RGBLIGHT_ENABLE #endif //AUDIO_ENABLE +#define QMK_ESC_OUTPUT F6 // usually COL +#define QMK_ESC_INPUT D7 // usually ROW +#define QMK_LED B0 +#define QMK_SPEAKER C6 #undef PRODUCT #ifdef KEYBOARD_iris_rev2 @@ -64,7 +65,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define CTRL_LED1 7 #define CTRL_LED2 10 -#define GUI_LED1 8 -#define GUI_LED2 9 +#define ALT_LED1 8 +#define GUI_LED1 9 -#endif diff --git a/keyboards/iris/keymaps/drashna/keymap.c b/keyboards/iris/keymaps/drashna/keymap.c @@ -43,47 +43,47 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______ ), + [_GAMEPAD] = LAYOUT_wrapper( + KC_ESC, KC_NO, KC_1, KC_2, KC_3, KC_P, _______, _______, _______, _______, _______, _______, + KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, _______, _______, _______, _______, _______, _______, + KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, _______, _______, _______, _______, _______, _______, + KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_H, TG_GAME, _______, _______, _______, _______, _______, _______, _______, + LOWER, KC_V, KC_SPC, _______, _______, _______ + ), + [_LOWER] = LAYOUT_wrapper( _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______, - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, - _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, - _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, + KC_TILD, _________________LOWER_L1__________________, _________________LOWER_R1__________________, _______, + _______, ___________________BLANK___________________, _________________LOWER_R2__________________, KC_PIPE, + _______, ___________________BLANK___________________, _______, _______, _________________LOWER_R3__________________, _______, _______, _______, _______, _______, _______, _______ ), [_RAISE] = LAYOUT_wrapper( _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______, - KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, _______, - _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, + KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______, + _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, + _______, _________________RAISE_L3__________________, _______, _______, _________________RAISE_R3__________________, _______, _______, _______, _______, _______, _______, _______ ), [_ADJUST] = LAYOUT_wrapper( - KC_MAKE, _______, _______, _______, _______, _______, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST, - VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, KC_NUKE, _______, _______, _______, _______, EPRM, - _______, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, TG(_MODS), - _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, + KC_MAKE, _______, _______, _______, _______, _______, _________________ADJUST_R1_________________, KC_RST, + VRSN, _________________ADJUST_L1_________________, KC_NUKE, _______, _______, _______, _______, EPRM, + _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG_MODS, + _______, _________________ADJUST_L3_________________, TG_GAME, _______, _________________ADJUST_R3_________________, KC_MPLY, _______, _______, _______, _______, _______, _______ ) }; -bool indicator_is_this_led_used(uint8_t index) { - switch (index) { -#ifdef INDICATOR_LIGHTS - case SHFT_LED1: - case SHFT_LED2: - case CTRL_LED1: - case CTRL_LED2: - case GUI_LED1: - case GUI_LED2: - return true; - break; -#endif - default: - return false; - } +void matrix_init_keymap(void) { + DDRD &= ~(1<<5); + PORTD &= ~(1<<5); + + DDRB &= ~(1<<0); + PORTB &= ~(1<<0); } + diff --git a/keyboards/iris/keymaps/drashna/rules.mk b/keyboards/iris/keymaps/drashna/rules.mk @@ -13,3 +13,5 @@ SWAP_HANDS_ENABLE = no INDICATOR_LIGHTS = yes MACROS_ENABLED = no RGBLIGHT_TWINKLE = yes + +BOOTLOADER = qmk-dfu diff --git a/keyboards/iris/keymaps/drashna_old/config.h b/keyboards/iris/keymaps/drashna_old/config.h @@ -52,6 +52,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #endif //RGBLIGHT_ENABLE #endif //AUDIO_ENABLE +#define QMK_ESC_OUTPUT F6 // usually COL +#define QMK_ESC_INPUT D7 // usually ROW +#define QMK_LED B0 +#define QMK_SPEAKER C6 #undef PRODUCT #ifdef KEYBOARD_iris_rev2 @@ -64,7 +68,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define CTRL_LED1 6 #define CTRL_LED2 9 -#define GUI_LED1 7 -#define GUI_LED2 8 +#define ALT_LED1 7 +#define GUI_LED1 8 #endif diff --git a/keyboards/iris/keymaps/drashna_old/keymap.c b/keyboards/iris/keymaps/drashna_old/keymap.c @@ -1,89 +1 @@ - -#include QMK_KEYBOARD_H -#include "drashna.h" - -#define KC_ALAP ALT_T(KC_APP) -#define KC_OSLG OSM(MOD_LGUI) -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - - [_QWERTY] = LAYOUT_wrapper( - KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, - KC_TAB , _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSLS, - KC_CCCV, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, - KC_MLSF, _________________QWERTY_L3_________________, KC_ALAP, KC_OSLG, _________________QWERTY_R3_________________, KC_MRSF, - LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE - ), - [_COLEMAK] = LAYOUT_wrapper( - KC_ESC , ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, - KC_TAB , _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSLS, - KC_CCCV, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT, - KC_MLSF, _________________COLEMAK_L3________________, KC_ALAP, KC_OSLG, _________________COLEMAK_R3________________, KC_MRSF, - LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE - ), - [_DVORAK] = LAYOUT_wrapper( - KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, - KC_TAB , _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSLS, - KC_CCCV, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_QUOT, - KC_MLSF, _________________DVORAK_L3_________________, KC_ALAP, KC_OSLG, _________________DVORAK_R3_________________, KC_MRSF, - LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE - ), - [_WORKMAN] = LAYOUT_wrapper( - KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, - KC_TAB , _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, KC_BSLS, - KC_CCCV, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, KC_QUOT, - KC_MLSF, _________________WORKMAN_L3________________, KC_ALAP, KC_OSLG, _________________WORKMAN_R3________________, KC_MRSF, - LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE - ), - - [_MODS] = LAYOUT_wrapper( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RSFT, - _______, _______, _______, _______, _______, _______ - ), - - - [_LOWER] = LAYOUT_wrapper( - _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______, - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, - _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, - _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, - _______, _______, _______, _______, _______, _______ - ), - - [_RAISE] = LAYOUT_wrapper( - _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______, - KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, _______, - _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, - _______, _______, _______, _______, _______, _______ - ), - - [_ADJUST] = LAYOUT_wrapper( - KC_MAKE, _______, _______, _______, _______, _______, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST, - VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, KC_NUKE, _______, _______, _______, _______, EPRM, - _______, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, TG(_MODS), - _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, - _______, _______, _______, _______, _______, _______ - ) - -}; - - -bool indicator_is_this_led_used(uint8_t index) { - switch (index) { -#ifdef INDICATOR_LIGHTS - case SHFT_LED1: - case SHFT_LED2: - case CTRL_LED1: - case CTRL_LED2: - case GUI_LED1: - case GUI_LED2: - return true; - break; -#endif - default: - return false; - } -} +// placeholder diff --git a/keyboards/iris/keymaps/drashna_old/rules.mk b/keyboards/iris/keymaps/drashna_old/rules.mk @@ -15,3 +15,7 @@ SWAP_HANDS_ENABLE = no INDICATOR_LIGHTS = yes MACROS_ENABLED = no RGBLIGHT_TWINKLE = yes + +SRC += ../drashna/keymap.c + +BOOTLOADER = qmk-dfu diff --git a/keyboards/orthodox/keymaps/drashna/config.h b/keyboards/orthodox/keymaps/drashna/config.h @@ -19,10 +19,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include QMK_KEYBOARD_CONFIG_H +#pragma once /* Use I2C or Serial, not both */ @@ -72,7 +69,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #endif #define QMK_ESC_OUTPUT D7 // usually COL +#ifdef KEYBOARD_orthodox_rev1 #define QMK_ESC_INPUT D4 // usually ROW +#else +#define QMK_ESC_INPUT D2 // usually ROW +#endif #define QMK_LED B0 #define QMK_SPEAKER C6 @@ -83,7 +84,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define CTRL_LED1 6 #define CTRL_LED2 9 -#define GUI_LED1 7 -#define GUI_LED2 8 +#define GUI_LED1 8 +#define ALT_LED1 7 -#endif diff --git a/keyboards/orthodox/keymaps/drashna/keymap.c b/keyboards/orthodox/keymaps/drashna/keymap.c @@ -45,25 +45,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = LAYOUT_wrapper(\ KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC, - KC_TAB, _________________QWERTY_L2_________________, ALT_APP, OS_LGUI, KC_LALT, OS_RGUI, _________________QWERTY_R2_________________, KC_QUOT, - KC_MLSF, _________________QWERTY_L3_________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________QWERTY_R3_________________, KC_MRSF + KC_TAB, _________________QWERTY_L2_________________, ___________ORTHODOX_THUMP_TOP_____________, _________________QWERTY_R2_________________, KC_QUOT, + KC_MLSF, _________________QWERTY_L3_________________, ___________________ORTHODOX_THUMB_BOTTOM____________________, _________________QWERTY_R3_________________, KC_MRSF ), [_COLEMAK] = LAYOUT_wrapper(\ KC_ESC, _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSPC, - KC_TAB, _________________COLEMAK_L2________________, ALT_APP, OS_LGUI, KC_LALT, OS_RGUI, _________________COLEMAK_R2________________, KC_QUOT, - KC_MLSF, _________________COLEMAK_L3________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________COLEMAK_R3________________, KC_MRSF + KC_TAB, _________________COLEMAK_L2________________, ___________ORTHODOX_THUMP_TOP_____________, _________________COLEMAK_R2________________, KC_QUOT, + KC_MLSF, _________________COLEMAK_L3________________, ___________________ORTHODOX_THUMB_BOTTOM____________________, _________________COLEMAK_R3________________, KC_MRSF ), [_DVORAK] = LAYOUT_wrapper(\ KC_ESC, _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSPC, - KC_TAB, _________________DVORAK_L2_________________, ALT_APP, OS_LGUI, KC_LALT, OS_RGUI, _________________DVORAK_R2_________________, KC_MINS, - KC_MLSF, _________________DVORAK_L3_________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________DVORAK_R3_________________, KC_MRSF + KC_TAB, _________________DVORAK_L2_________________, ___________ORTHODOX_THUMP_TOP_____________, _________________DVORAK_R2_________________, KC_MINS, + KC_MLSF, _________________DVORAK_L3_________________, ___________________ORTHODOX_THUMB_BOTTOM____________________, _________________DVORAK_R3_________________, KC_MRSF ), [_WORKMAN] = LAYOUT_wrapper(\ KC_ESC, _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, KC_BSPC, - KC_TAB, _________________WORKMAN_L2________________, ALT_APP, OS_LGUI, KC_LALT, OS_RGUI, _________________WORKMAN_R2________________, KC_MINS, - KC_MLSF, _________________WORKMAN_L3________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________WORKMAN_R3________________, KC_MRSF + KC_TAB, _________________WORKMAN_L2________________, ___________ORTHODOX_THUMP_TOP_____________, _________________WORKMAN_R2________________, KC_MINS, + KC_MLSF, _________________WORKMAN_L3________________, ___________________ORTHODOX_THUMB_BOTTOM____________________, _________________WORKMAN_R3________________, KC_MRSF ), [_MODS] = LAYOUT_wrapper(\ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -72,40 +72,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_LOWER] = LAYOUT_wrapper(\ - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, - KC_F11, _________________FUNC_LEFT_________________, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, - KC_F12, _________________FUNC_RIGHT________________, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______ + KC_TILD, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_BSPC, + KC_F11, _________________LOWER_L2__________________, _______, _______, _______, _______, _________________LOWER_R2__________________, KC_PIPE, + KC_F12, _________________LOWER_L3__________________, _______, _______, _______, _______, _______, _______, _________________LOWER_R3__________________, _______ ), [_RAISE] = LAYOUT_wrapper(\ - KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_BSPC, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______ + KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, KC_BSPC, + _______, _________________RAISE_L2__________________, _______, _______, _______, _______, _________________RAISE_R2__________________, KC_BSLS, + _______, _________________RAISE_L3__________________, _______, _______, _______, _______, _______, _______, _________________RAISE_R3__________________, _______ ), [_ADJUST] = LAYOUT_wrapper(\ - KC_MAKE, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RESET, - VRSN, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, KC_NUKE, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, EPRM, - TG(_MODS),RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, _______, _______, _______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY + KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RESET, + VRSN, _________________ADJUST_L2_________________, _______, _______, _______, KC_NUKE, _________________ADJUST_R2_________________, EPRM, + TG_MODS, _________________ADJUST_L3_________________, _______, _______, _______, _______, _______, _______, _________________ADJUST_R3_________________, KC_MPLY ) - - }; +void matrix_init_keymap(void) { + DDRD &= ~(1<<5); + PORTD &= ~(1<<5); -bool indicator_is_this_led_used(uint8_t index) { - switch (index) { -#ifdef INDICATOR_LIGHTS - case SHFT_LED1: - case SHFT_LED2: - case CTRL_LED1: - case CTRL_LED2: - case GUI_LED1: - case GUI_LED2: - return true; - break; -#endif - default: - return false; - } + DDRB &= ~(1<<0); + PORTB &= ~(1<<0); } diff --git a/keyboards/orthodox/keymaps/drashna/rules.mk b/keyboards/orthodox/keymaps/drashna/rules.mk @@ -11,3 +11,5 @@ NKRO_ENABLE = yes INDICATOR_LIGHTS = yes MACROS_ENABLED = no RGBLIGHT_TWINKLE = yes + +BOOTLOADER = qmk-dfu diff --git a/keyboards/viterbi/keymaps/drashna/config.h b/keyboards/viterbi/keymaps/drashna/config.h @@ -15,11 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include QMK_KEYBOARD_CONFIG_H - +#pragma once #ifdef RGBLIGHT_ENABLE #undef RGBLED_NUM @@ -78,4 +74,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. L40, L41, L42, L43, L44, L45, L46, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO \ ) -#endif +#define QMK_ESC_OUTPUT F5 // usually COL +#define QMK_ESC_INPUT D4 // usually ROW +#define QMK_LED B0 +#define QMK_SPEAKER C6 diff --git a/keyboards/viterbi/keymaps/drashna/keymap.c b/keyboards/viterbi/keymaps/drashna/keymap.c @@ -76,10 +76,8 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { //switch (keycode) { //case KC_P00: // if (!record->event.pressed) { - // register_code(KC_KP_0); - // unregister_code(KC_KP_0); - // register_code(KC_KP_0); - // unregister_code(KC_KP_0); + // tap(KC_KP_0); + // tap(KC_KP_0); // } // return false; // break; @@ -89,5 +87,12 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { +void matrix_init_keymap(void) { + DDRD &= ~(1<<5); + PORTD &= ~(1<<5); + + DDRB &= ~(1<<0); + PORTB &= ~(1<<0); +} diff --git a/keyboards/viterbi/keymaps/drashna/rules.mk b/keyboards/viterbi/keymaps/drashna/rules.mk @@ -11,7 +11,7 @@ NKRO_ENABLE = yes NO_SECRETS = yes MACROS_ENABLED = yes INDICATOR_LIGHTS = no -RGBLIGHT_TWINKLE = yes +RGBLIGHT_TWINKLE = no LAYOUTS = ortho_5x7 @@ -22,3 +22,4 @@ LAYOUTS = ortho_5x7 # SRC := $(filter-out split_util.c,$(SRC)) # SRC += quantum/matrix.c +BOOTLOADER = qmk-dfu diff --git a/keyboards/viterbi/keymaps/drashna_old/config.h b/keyboards/viterbi/keymaps/drashna_old/config.h @@ -0,0 +1,86 @@ +/* +Copyright 2017 Danny Nguyen <danny@hexwire.com> + +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 <http://www.gnu.org/licenses/>. +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include QMK_KEYBOARD_CONFIG_H + + +#ifdef RGBLIGHT_ENABLE +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 +#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2 +#define RGBLIGHT_EFFECT_SNAKE_LENGTH 2 +#define RGBLIGHT_EFFECT_BREATHE_CENTER 1 +#define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 300 +#define RGBLIGHT_EFFECT_CHRISTMAS_STEP 1 +#endif // RGBLIGHT_ENABLE + + +#undef LOCKING_SUPPORT_ENABLE +#undef LOCKING_RESYNC_ENABLE + +#ifndef NO_DEBUG +#define NO_DEBUG +#endif // !NO_DEBUG +#ifndef NO_PRINT +#define NO_PRINT +#endif // !NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#undef PRODUCT +#define PRODUCT Drashnas Viterbi Macro Pad + +#define USE_I2C + +#ifdef AUDIO_ENABLE +#define C6_AUDIO +#define NO_MUSIC_MODE +#endif + +#define LAYOUT_ortho_5x7( \ + L00, L01, L02, L03, L04, L05, L06, \ + L10, L11, L12, L13, L14, L15, L16, \ + L20, L21, L22, L23, L24, L25, L26, \ + L30, L31, L32, L33, L34, L35, L36, \ + L40, L41, L42, L43, L44, L45, L46 \ + ) \ + LAYOUT( \ + L00, L01, L02, L03, L04, L05, L06, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + L10, L11, L12, L13, L14, L15, L16, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + L20, L21, L22, L23, L24, L25, L26, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + L30, L31, L32, L33, L34, L35, L36, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + L40, L41, L42, L43, L44, L45, L46, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO \ + ) + +#endif + +#define QMK_ESC_OUTPUT F5 // usually COL +#define QMK_ESC_INPUT D4 // usually ROW +#define QMK_LED B0 +#define QMK_SPEAKER C6 diff --git a/keyboards/viterbi/keymaps/drashna_old/keymap.c b/keyboards/viterbi/keymaps/drashna_old/keymap.c @@ -0,0 +1 @@ +//placeholder+ \ No newline at end of file diff --git a/keyboards/viterbi/keymaps/drashna_old/rules.mk b/keyboards/viterbi/keymaps/drashna_old/rules.mk @@ -0,0 +1,28 @@ +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +TAP_DANCE_ENABLE = no +RGBLIGHT_ENABLE = yes +AUDIO_ENABLE = yes +NKRO_ENABLE = yes + +NO_SECRETS = yes +MACROS_ENABLED = yes +INDICATOR_LIGHTS = no +RGBLIGHT_TWINKLE = no + +LAYOUTS = ortho_5x7 + +# SRC := $(filter-out serial.c matrix.c i2c.c split_util.c,$(SRC)) +# SRC := $(filter-out serial.c,$(SRC)) +# SRC := $(filter-out matrix.c,$(SRC)) +# SRC := $(filter-out i2c.c,$(SRC)) +# SRC := $(filter-out split_util.c,$(SRC)) +# SRC += quantum/matrix.c + +USER_NAME := drashna +SRC += ../drashna/keymap.c + +BOOTLOADER = qmk-dfu diff --git a/layouts/community/ergodox/drashna/config.h b/layouts/community/ergodox/drashna/config.h @@ -1,10 +1,9 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H +#pragma once #include QMK_KEYBOARD_CONFIG_H #ifdef RGBLIGHT_ENABLE -#undef RGBLIGHT_SAT_STEP +#undef RGBLIGHT_SAT_STEP #define RGBLIGHT_SAT_STEP 12 #define RGBLIGHT_EFFECT_KNIGHT_LENGTH 7 #define RGBLIGHT_EFFECT_SNAKE_LENGTH 7 @@ -14,5 +13,3 @@ #undef PRODUCT #define PRODUCT DrashnaDox - Hacked ErgoDox EZ Shine - -#endif diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c @@ -196,11 +196,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------' `--------------------' */ [_GAMEPAD] = LAYOUT_ergodox_pretty_wrapper( - KC_ESC, KC_TRNS, KC_TRNS, KC_TRNS, HYPR(KC_D), HYPR(KC_Q), HYPR(KC_GRV), KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, + KC_ESC, KC_NO, KC_1, KC_2, KC_3, HYPR(KC_Q), HYPR(KC_GRV), KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, KC_I, KC_O, KC_NO, KC_NO, KC_NO, KC_NO, KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_TRNS, TG(_GAMEPAD), KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO, - KC_GRV, KC_U, KC_I, KC_Y, KC_T, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, + KC_GRV, KC_U, KC_I, KC_Y, KC_T, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, KC_O, KC_P, KC_HYPR, MAGIC_TOGGLE_NKRO, KC_LGUI, KC_NO, KC_V, KC_SPC, KC_H, KC_PGDN, KC_DEL, KC_ENTER @@ -239,32 +239,32 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_LOWER] = LAYOUT_ergodox_pretty_wrapper( - _______, _________________FUNC_LEFT_________________, _______, _______, _________________FUNC_RIGHT________________, KC_F11, - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, - _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_F12, _________________FUNC_LEFT_________________, _______, _______, _________________FUNC_RIGHT________________, KC_F11, + KC_TILD, _________________LOWER_L1__________________, _______, _______, _________________LOWER_R1__________________, _______, + _______, ___________________BLANK___________________, _________________LOWER_R2__________________, KC_PIPE, + _______, ___________________BLANK___________________, _______, _______, _________________LOWER_R3__________________, KC_PSCR, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PAUS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), [_RAISE] = LAYOUT_ergodox_pretty_wrapper( - _______, _________________FUNC_LEFT_________________, _______, _______, _________________FUNC_RIGHT________________, KC_F11, - KC_GRV, ________________NUMBER_LEFT________________, _______, _______, ________________NUMBER_RIGHT_______________, _______, - _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_SLCK, + KC_F12, _________________FUNC_LEFT_________________, _______, _______, _________________FUNC_RIGHT________________, KC_F11, + KC_GRV, _________________RAISE_L1__________________, _______, _______, _________________RAISE_R1__________________, _______, + _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, + _______, _________________RAISE_L3__________________, _______, _______, _________________RAISE_R3__________________, KC_PSCR, + _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_SLCK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), [_ADJUST] = LAYOUT_ergodox_pretty_wrapper( - KC_MAKE, _______, _______, _______, _______, _______, _______, KC_NUKE, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST, - VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, EPRM, - RGB_SMOD,RGB_HUI, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, TG(_MODS), - _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, + KC_MAKE, _______, _______, _______, _______, _______, _______, KC_NUKE, _________________ADJUST_R1_________________, KC_RST, + VRSN, _________________ADJUST_L1_________________, _______, _______, _______, _______, _______, _______, _______, EPRM, + _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG(_MODS), + _______, _________________ADJUST_L3_________________, _______, _______, _________________ADJUST_R3_________________, KC_MPLY, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -324,3 +324,14 @@ void matrix_scan_keymap(void) { // runs frequently to update info }; + +bool indicator_is_this_led_used_keyboard(uint8_t index) { + switch (index) { + case 13 ... 14: + return true; + break; + default: + return false; + } +} + diff --git a/layouts/community/ergodox/drashna/rules.mk b/layouts/community/ergodox/drashna/rules.mk @@ -1,8 +1,9 @@ TAP_DANCE_ENABLE = yes SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend COMMAND_ENABLE = yes # Commands for debug and configuration -ifdef KEYBOARD_ergodox_ez - RGBLIGHT_ENABLE = yes +ifeq ("$(KEYBOARD)","ergodox_ez") + RGBLIGHT_ENABLE = yes + RGB_MATRIX_ENABLE = no endif CONSOLE_ENABLE = no BOOTMAGIC_ENABLE = yes diff --git a/layouts/community/ortho_4x12/drashna/config.h b/layouts/community/ortho_4x12/drashna/config.h @@ -0,0 +1,56 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + + +#if defined(RGBLIGHT_ENABLE) && !defined(RGBLED_NUM) +#define RGB_DI_PIN D3 +#define RGBLED_NUM 16 // Number of LEDs +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_HUE_STEP 12 +#define RGBLIGHT_SAT_STEP 12 +#define RGBLIGHT_VAL_STEP 12 +#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2 +#define RGBLIGHT_EFFECT_SNAKE_LENGTH 2 +#define RGBLIGHT_EFFECT_BREATHE_CENTER 1 +#endif // RGBLIGHT_ENABLE + + +#if defined(KEYBOARD_lets_split_rev2) +#define USE_SERIAL +#undef USE_I2C + +#define EE_HANDS +#endif + +#if defined(KEYBOARD_planck_rev5) +#ifdef RGBLIGHT_ENABLE +#define NO_MUSIC_MODE +#endif // RGBLIGHT_ENABLE +#endif // KEYBOARD_planck_rev5 + + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* 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 + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 + +#endif diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c @@ -0,0 +1,177 @@ +/* Copyright 2015-2017 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 <http://www.gnu.org/licenses/>. + */ + +#include QMK_KEYBOARD_H +#include "drashna.h" + + +enum planck_keycodes { + BACKLIT = NEW_SAFE_RANGE, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = LAYOUT_ortho_4x12_wrapper( + KC_TAB, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC, + KC_ESC, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, + KC_LSFT, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_ENT, + BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Colemak + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_COLEMAK] = LAYOUT_ortho_4x12_wrapper( + KC_TAB, _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSPC, + KC_ESC, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT, + KC_LSFT, _________________COLEMAK_L3________________, _________________COLEMAK_R3________________, KC_ENT, + BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_DVORAK] = LAYOUT_ortho_4x12_wrapper( + KC_TAB, _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSPC, + KC_ESC, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_SLSH, + KC_LSFT, _________________DVORAK_L3_________________, _________________DVORAK_R3_________________, KC_ENT, + BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + + +[_WORKMAN] = LAYOUT_ortho_4x12_wrapper( + KC_TAB, _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, KC_BSPC, + KC_ESC, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, KC_QUOT, + KC_LSFT, _________________WORKMAN_L3________________, _________________WORKMAN_R3________________, KC_ENT, + BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = LAYOUT_ortho_4x12_wrapper( + KC_TILD, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_BSPC, + KC_DEL, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE, + _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______, + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = LAYOUT_ortho_4x12_wrapper( + KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, KC_BSPC, + KC_DEL, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, + _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = LAYOUT_ortho_4x12_wrapper( + _______, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_DEL, + _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, _______, + _______, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +) + + +}; + + +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + +#ifdef KEYBOARD_planck + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + PORTE &= ~(1<<6); + } else { + unregister_code(KC_RSFT); + PORTE |= (1<<6); + } + return false; + break; +#endif + } + return true; +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} diff --git a/layouts/community/ortho_4x12/drashna/readme.md b/layouts/community/ortho_4x12/drashna/readme.md @@ -0,0 +1,2 @@ +# The Default Planck Layout + diff --git a/layouts/community/ortho_4x12/drashna/rules.mk b/layouts/community/ortho_4x12/drashna/rules.mk @@ -0,0 +1,20 @@ +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +TAP_DANCE_ENABLE = no +RGBLIGHT_ENABLE = yes +AUDIO_ENABLE = yes + + +ifeq ($(strip $(PROTOCOL)), VUSB) +NKRO_ENABLE = no +else +NKRO_ENABLE = yes +endif + + +INDICATOR_LIGHTS = yes +MACROS_ENABLED = no +RGBLIGHT_TWINKLE = yes diff --git a/users/drashna/config.h b/users/drashna/config.h @@ -1,5 +1,4 @@ -#ifndef USERSPACE_CONFIG_H -#define USERSPACE_CONFIG_H +#pragma once #ifdef AUDIO_ENABLE @@ -71,5 +70,6 @@ #define DISABLE_LEADER -#endif // !USERSPACE_CONFIG_H +#define MACRO_TIMER 5 + diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c @@ -38,7 +38,7 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) { clear_keyboard(); tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); - send_string(str); + send_string_with_delay(str, MACRO_TIMER); wait_ms(50); tap(KC_ENTER); } @@ -48,6 +48,40 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) { void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); }; +bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed) { + static uint16_t this_timer; + if(pressed) { + this_timer= timer_read(); + } else { + if (timer_elapsed(this_timer) < TAPPING_TERM){ + register_code(code); + unregister_code(code); + } else { + register_code(mod_code); + register_code(code); + unregister_code(code); + unregister_code(mod_code); + } + } + return false; +} + +bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) { + if(pressed) { + this_timer= timer_read(); + } else { + if (timer_elapsed(this_timer) < TAPPING_TERM){ + register_code(code); + unregister_code(code); + } else { + register_code(mod_code); + register_code(code); + unregister_code(code); + unregister_code(mod_code); + } + } + return false; +} // Add reconfigurable functions here, for keymap customization // This allows for a global, userspace functions, and continued @@ -57,6 +91,15 @@ __attribute__ ((weak)) void matrix_init_keymap(void) {} __attribute__ ((weak)) +void startup_keymap(void) {} + +__attribute__ ((weak)) +void suspend_power_down_keymap(void) {} + +__attribute__ ((weak)) +void suspend_wakeup_init_keymap(void) {} + +__attribute__ ((weak)) void matrix_scan_keymap(void) {} __attribute__ ((weak)) @@ -69,12 +112,18 @@ bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; } + __attribute__ ((weak)) uint32_t layer_state_set_keymap (uint32_t state) { return state; } __attribute__ ((weak)) +uint32_t default_layer_state_set_keymap (uint32_t state) { + return state; +} + +__attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) {} @@ -99,14 +148,38 @@ void matrix_init_user(void) { #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) set_unicode_input_mode(UC_WINC); #endif //UNICODE_ENABLE - matrix_init_rgb(); matrix_init_keymap(); } +void startup_user (void) { + #ifdef RGBLIGHT_ENABLE + matrix_init_rgb(); + #endif //RGBLIGHT_ENABLE + startup_keymap(); +} + +void suspend_power_down_user(void) +{ + suspend_power_down_keymap(); +} + +void suspend_wakeup_init_user(void) +{ + suspend_wakeup_init_keymap(); + #ifdef KEYBOARD_ergodox_ez + wait_ms(10); + #endif +} + // No global matrix scan code, so just run keymap's matrix // scan function void matrix_scan_user(void) { + static bool has_ran_yet; + if (!has_ran_yet) { + has_ran_yet = true; + startup_user(); + } #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. run_diablo_macro_check(); @@ -160,7 +233,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader if (!record->event.pressed) { - SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP + send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) ":dfu" #elif defined(BOOTLOADER_HALFKAY) @@ -168,7 +241,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #elif defined(BOOTLOADER_CATERINA) ":avrdude" #endif // bootloader options - SS_TAP(X_ENTER)); + SS_TAP(X_ENTER)), 10); } return false; break; @@ -197,7 +270,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case VRSN: // Prints firmware version if (record->event.pressed) { - SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); + send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), MACRO_TIMER); } return false; break; @@ -256,7 +329,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { diablo_key_time[dtime] = diablo_times[0]; } } -#endif // TAP_DANCE_ENABLE#endif +#endif // TAP_DANCE_ENABLE return false; break; @@ -314,7 +387,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #endif // UNICODE_ENABLE } - return process_record_keymap(keycode, record) && process_record_secrets(keycode, record) && process_record_user_rgb(keycode, record); + return process_record_keymap(keycode, record) && +#ifdef RGBLIGHT_ENABLE + process_record_user_rgb(keycode, record) && +#endif // RGBLIGHT_ENABLE + process_record_secrets(keycode, record); } @@ -331,6 +408,11 @@ uint32_t layer_state_set_user(uint32_t state) { } +uint32_t default_layer_state_set_kb(uint32_t state) { + return default_layer_state_set_keymap (state); +} + + // Any custom LED code goes here. // So far, I only have keyboard specific code, // So nothing goes here. diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h @@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define USERSPACE #include "quantum.h" + // Define layer names enum userspace_layers { _QWERTY = 0, @@ -53,8 +54,8 @@ void rgblight_sethsv_default_helper(uint8_t index); #endif // RGBLIGHT_ENABLE void tap(uint16_t keycode); -bool process_record_secrets(uint16_t keycode, keyrecord_t *record); - +bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed); +bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); #define EECONFIG_USERSPACE (uint8_t *)19 @@ -69,15 +70,15 @@ typedef union { } userspace_config_t; enum userspace_custom_keycodes { - EPRM = SAFE_RANGE, // can always be here - VRSN, - KC_QWERTY, - KC_COLEMAK, - KC_DVORAK, - KC_WORKMAN, - KC_DIABLO_CLEAR, - KC_OVERWATCH, - KC_SALT, + EPRM = SAFE_RANGE, // Resets EEPROM do defaults (as in eeconfig_init) + VRSN, // Prints QMK Firmware and board info + KC_QWERTY, // Sets default layer to QWERTY + KC_COLEMAK, // Sets default layer to COLEMAK + KC_DVORAK, // Sets default layer to DVORAK + KC_WORKMAN, // Sets default layer to WORKMAN + KC_DIABLO_CLEAR, // Clears all Diablo Timers + KC_OVERWATCH, // Toggles game macro input mode (so in OW, it defaults to game chat) + KC_SALT, // See drashna.c for details KC_MORESALT, KC_SALTHARD, KC_GOODGAME, @@ -88,27 +89,28 @@ enum userspace_custom_keycodes { KC_AIM, KC_C9, KC_GGEZ, - KC_MAKE, - KC_RESET, - KC_RGB_T, - KC_SECRET_1, - KC_SECRET_2, - KC_SECRET_3, - KC_SECRET_4, - KC_SECRET_5, - KC_CCCV, - KC_NUKE, + KC_MAKE, // Run keyboard's customized make command + KC_RESET, // Resets keyboard, with red underglow + KC_RGB_T, // Toggles RGB Layer Indication mode + KC_SECRET_1, // test1 + KC_SECRET_2, // test2 + KC_SECRET_3, // test3 + KC_SECRET_4, // test4 + KC_SECRET_5, // test5 + KC_CCCV, // Hold to copy, tap to paste + KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! #ifdef UNICODE_ENABLE - UC_FLIP, + UC_FLIP, // Table flip (not working?) #endif //UNICODE_ENABLE - NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes + NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes }; #define LOWER MO(_LOWER) #define RAISE MO(_RAISE) #define ADJUST MO(_ADJUST) - +#define TG_MODS TG(_MODS) +#define TG_GAME TG(_GAMEPAD) #define KC_SEC1 KC_SECRET_1 #define KC_SEC2 KC_SECRET_2 @@ -184,7 +186,7 @@ enum { #define LAYOUT_ergodox_pretty_wrapper(...) LAYOUT_ergodox_pretty(__VA_ARGS__) #define KEYMAP_wrapper(...) LAYOUT(__VA_ARGS__) #define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) - +#define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__) // Blocks for each of the four major keyboard layouts // Organized so we can quickly adapt and modify all of them @@ -237,7 +239,7 @@ enum { #define _________________WORKMAN_R1________________ KC_J, KC_F, KC_U, KC_P, KC_SCLN #define _________________WORKMAN_R2________________ KC_Y, KC_N, KC_E, KC_O, KC_I -#define _________________WORKMAN_R3________________ KC_K, KC_L, KC_COMM, KC_DOT, CTL_T(KC_SLASH) +#define _________________WORKMAN_R3________________ KC_K, KC_L, KC_COMM, KC_DOT, CTL_T(KC_SLASH) #define _________________NORMAN_L1_________________ KC_Q, KC_W, KC_D, KC_F, KC_K @@ -248,11 +250,89 @@ enum { #define _________________NORMAN_R2_________________ KC_Y, KC_N, KC_I, KC_O, KC_U #define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH) + +#define _________________MALTRON_L1________________ KC_Q, KC_P, KC_Y, KC_C, KC_B +#define _________________MALTRON_L2________________ KC_A, KC_N, KC_I, KC_S, KC_F +#define _________________MALTRON_L3________________ CTL_T(KC_SCLN), KC_SLSH, KC_J KC_G, KC_COMM + +#define _________________MALTRON_R1________________ KC_V, KC_M, KC_U, KC_Z, KC_L +#define _________________MALTRON_R2________________ KC_D, KC_T, KC_D, KC_O, KC_R +#define _________________MALTRON_R3________________ KC_DOT, KC_W, KC_K, KC_MINS, CTL_T(KC_x) + + +#define _________________EUCALYN_L1________________ KC_SLSH, KC_COMM, KC_DOT, KC_F, KC_Q +#define _________________EUCALYN_L2________________ KC_A, KC_O, KC_E, KC_I, KC_U +#define _________________EUCALYN_L3________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_W + +#define _________________EUCALYN_R1________________ KC_M, KC_R, KC_D, KC_Y, KC_P +#define _________________EUCALYN_R2________________ KC_G, KC_T, KC_K, KC_S, KC_N +#define _________________EUCALYN_R3________________ KC_B, KC_H, KC_J, KC_L, CTL_T(KC_SCLN) + + +#define _____________CARPLAX_QFMLWY_L1_____________ KC_Q, KC_F, KC_M, KC_L, KC_W +#define _____________CARPLAX_QFMLWY_L2_____________ KC_D, KC_S, KC_T, KC_N, KC_R +#define _____________CARPLAX_QFMLWY_L3_____________ CTL_T(KC_Z), KC_V, KC_G, KC_C, KC_X + +#define _____________CARPLAX_QFMLWY_R1_____________ KC_Y, KC_U, KC_O, KC_B, KC_J +#define _____________CARPLAX_QFMLWY_R2_____________ KC_I, KC_A, KC_E, KC_H, KC_SCLN +#define _____________CARPLAX_QFMLWY_R3_____________ KC_P, KC_K, KC_COMM, KC_DOT, CTL_T(KC_SLSH) + + +#define _____________CARPLAX_QGMLWB_L1_____________ KC_Q, KC_G, KC_M, KC_L, KC_W +#define _____________CARPLAX_QGMLWB_L2_____________ KC_D, KC_S, KC_T, KC_N, KC_R +#define _____________CARPLAX_QGMLWB_L3_____________ CTL_T(KC_Z), KC_X, KC_C, KC_F, KC_J + +#define _____________CARPLAX_QGMLWB_R1_____________ KC_B, KC_Y, KC_U, KC_V, KC_SCLN +#define _____________CARPLAX_QGMLWB_R2_____________ KC_I, KC_A, KC_E, KC_O, KC_H +#define _____________CARPLAX_QGMLWB_R3_____________ KC_K, KC_P, KC_COMM, KC_DOT, CTL_T(KC_SLSH) + + +#define _____________CARPLAX_QGMLWY_L1_____________ KC_Q, KC_G, KC_M, KC_L, KC_W +#define _____________CARPLAX_QGMLWY_L2_____________ KC_D, KC_S, KC_T, KC_N, KC_R +#define _____________CARPLAX_QGMLWY_L3_____________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_J + +#define _____________CARPLAX_QGMLWY_R1_____________ KC_Y, KC_F, KC_U, KC_B, KC_SCLN +#define _____________CARPLAX_QGMLWY_R2_____________ KC_I, KC_A, KC_E, KC_O, KC_H +#define _____________CARPLAX_QGMLWY_R3_____________ KC_K, KC_P, KC_COMM, KC_DOT, CTL_T(KC_SLSH) + + #define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5 #define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0 #define _________________FUNC_LEFT_________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 #define _________________FUNC_RIGHT________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 +#define ___________________BLANK___________________ _______, _______, _______, _______, _______ + + +#define _________________LOWER_L1__________________ KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC +#define _________________LOWER_L2__________________ _________________FUNC_LEFT_________________ +#define _________________LOWER_L3__________________ _________________FUNC_RIGHT________________ + +#define _________________LOWER_R1__________________ KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN +#define _________________LOWER_R2__________________ _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR +#define _________________LOWER_R3__________________ _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + + + +#define _________________RAISE_L1__________________ ________________NUMBER_LEFT________________ +#define _________________RAISE_L2__________________ ___________________BLANK___________________ +#define _________________RAISE_L3__________________ ___________________BLANK___________________ + +#define _________________RAISE_R1__________________ ________________NUMBER_RIGHT_______________ +#define _________________RAISE_R2__________________ _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC +#define _________________RAISE_R3__________________ _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END + + + +#define _________________ADJUST_L1_________________ RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG +#define _________________ADJUST_L2_________________ _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM +#define _________________ADJUST_L3_________________ RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T + +#define _________________ADJUST_R1_________________ KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5 +#define _________________ADJUST_R2_________________ AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN +#define _________________ADJUST_R3_________________ MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT + + // Since we have 4 default layouts (QWERTY, DVORAK, COLEMAK and WORKMAN), // this allows us to quickly modify the bottom row for all of the layouts // so we don't have to alter it 4 times and hope that we haven't missed @@ -261,7 +341,11 @@ enum { #define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT -#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), OSM(MOD_LGUI), OSM(MOD_RGUI), CTL_T(KC_ESCAPE), \ +#define ___________ORTHODOX_THUMP_TOP_____________ ALT_APP, OS_LGUI, KC_LALT, OS_RGUI +#define ___________________ORTHODOX_THUMB_BOTTOM____________________ LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE + + +#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), OSM(MOD_LGUI), OSM(MOD_RGUI), CTL_T(KC_ESCAPE), \ KC_HOME, KC_PGUP, \ LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER) diff --git a/users/drashna/readme.md b/users/drashna/readme.md @@ -75,11 +75,12 @@ For critics that think this is cheating, search "diablo 3 num lock auto cast". Secret Macros ------------- -With help from gitter and Colinta, this adds the ability to add hidden strings to be used for macros. +With help from gitter and Colinta, this adds the ability to add hidden macros from other users. -I have a number of long strings that I need to use that are semi-private. This uses the `__has_include` function to check for the file. If it exists, then it includes the custom text. Otherwise, it uses some default values. +First, I have several files that are hidden/excluded from Git/GitHub. These contain everything needed for the macros. To hide these files, open `.git/info/exclude` and add `secrets.c` and `secrets.h` to that file, below the comments. + +And this requires `KC_SECRET_1` through `KC_SECRET_5` to be defined in your `<name>.h` file to define the keycodes for the new macros. -If you would *also* like to take advantage of this feature, you'll first want to make sure your "secrets" file isn't included in the repo. Open `.git/info/exclude` and add `secrets.h` to that file, below the comments. ###### .git/info/exclude ``` @@ -89,10 +90,44 @@ If you would *also* like to take advantage of this feature, you'll first want to # exclude patterns (uncomment them if you want to use them): # *.[oa] # *~ +/users/drashna/secrets.c /users/drashna/secrets.h ``` -Then you can create this file and add your macro strings to it: +Then you can create these files: + +###### secrets.c + +```c +#include "drashna.h" // replace with your keymap's "h" file, or whatever file stores the keycodes + +#if (__has_include("secrets.h") && !defined(NO_SECRETS)) +#include "secrets.h" +#else +// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware +// And I'm not familiar enough to know which is better or why... +static const char * const secret[] = { + "test1", + "test2", + "test3", + "test4", + "test5" +}; +#endif + +bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo + if (!record->event.pressed) { + clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); + send_string_with_delay(secret[keycode - KC_SECRET_1], MACRO_TIMER); + } + return false; + break; + } + return true; +} +``` ###### secrets.h ```c @@ -107,36 +142,33 @@ static const char * const secrets[] = { Replacing the strings with the codes that you need. +###### name.c + In the `<name>.c` file, you will want to add this to the top: ```c - -#if (__has_include("secrets.h") && !defined(NO_SECRETS)) -#include "secrets.h" -#else -// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware -// And I'm not familiar enough to know which is better or why... -static const char * const secrets[] = { - "test1", - "test2", - "test3", - "test4", - "test5" -}; -#endif +__attribute__ ((weak)) +bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { + return true; +} ``` +This is so that the function can be called here, and replaced in the `secrets.c` file, and so it won't error out if it doesn't exist. + -And then, in the `process_record_user` function, you'll want to add this block: +And then, in the `process_record_user` function, assuming you have `return process_record_keymap(keycode, record)` here, you'll want to replace the "final" return with the following. Otherwise, you want to replace the `return true;` with `return process_record_secrets(keycode, record);` ```c - case KC_SECRET_1 ... KC_SECRET_5: - if (!record->event.pressed) { - send_string_P(secret[keycode - KC_SECRET_1]); - } - return false; - break; + return process_record_keymap(keycode, record) && process_record_secrets(keycode, record); +} ``` -And this requires `KC_SECRET_1` through `KC_SECRET_5` to be defined in your `<name>.h` file fo the new macros, as well. +###### rules.mk + +Here, you want your `/users/<name>/rules.mk` file to "detect" the existence of the `secrets.c` file, and only add it if the file exists. To do so, add this block: +```c +ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") + SRC += secrets.c +endif +``` Additionally, if you want to make sure that you can disable the function without messing with the file, you need to add this to your `/users/<name>/rules.mk`, so that it catches the flag: ```c @@ -181,15 +213,15 @@ Pro Micro Hacking Well, you can get the QMK DFU bootloader working on the ProMicro. But you need to change fuses. -What worked to get into the firmware properly was: +What worked to get into the firmware properly was: ``` -Low: 0x5E High: 0x99 Extended: 0xF3 Lock: 0xFF +Low: 0x5E High: 0xD9 Extended: 0xC3 Lock: 0x3F ``` -But some of the columns and rows didn't work, like the pin mapping was wrong. Even when setting the bootloader settings. - - This is here for future reference. And the default fuse settings I believe were: +The reason that there was some issues before, is that JTAG was still enabled, and using some of the pins that the keyboard uses. Disabling JTAG (either by fuse, or modifying the matrix code for splits fixes the issue). + +And for reference, if you want to go back to caterina, the default fuse settings I believe were: ``` Low: 0xFF High: 0xD8 Extended: 0xC3 Lock: 0x3F diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c @@ -1,5 +1,6 @@ #include "drashna.h" #include "rgb_stuff.h" +#include "eeprom.h" extern rgblight_config_t rgblight_config; extern userspace_config_t userspace_config; @@ -22,25 +23,64 @@ uint8_t current_osm; void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { if (userspace_config.rgb_layer_change && biton32(layer_state) == 0) { if (this_mod & MODS_SHIFT_MASK || this_led & (1<<USB_LED_CAPS_LOCK) || this_osm & MODS_SHIFT_MASK) { - rgblight_sethsv_at(0, 255, 255, SHFT_LED1); - rgblight_sethsv_at(0, 255, 255, SHFT_LED2); + #ifdef SHFT_LED1 + rgblight_sethsv_at(120, 255, 255, SHFT_LED1); + #endif // SHFT_LED1 + #ifdef SHFT_LED2 + rgblight_sethsv_at(120, 255, 255, SHFT_LED2); + #endif // SHFT_LED2 } else { - rgblight_sethsv_default_helper(SHFT_LED1); - rgblight_sethsv_default_helper(SHFT_LED2); + #ifdef SHFT_LED1 + rgblight_sethsv_default_helper(SHFT_LED1); + #endif // SHFT_LED1 + #ifdef SHFT_LED2 + rgblight_sethsv_default_helper(SHFT_LED2); + #endif // SHFT_LED2 } if (this_mod & MODS_CTRL_MASK || this_osm & MODS_CTRL_MASK) { - rgblight_sethsv_at(51, 255, 255, CTRL_LED1); - rgblight_sethsv_at(51, 255, 255, CTRL_LED2); + #ifdef CTRL_LED1 + rgblight_sethsv_at(0, 255, 255, CTRL_LED1); + #endif // CTRL_LED1 + #ifdef CTRL_LED2 + rgblight_sethsv_at(0, 255, 255, CTRL_LED2); + #endif // CTRL_LED2 } else { - rgblight_sethsv_default_helper(CTRL_LED1); - rgblight_sethsv_default_helper(CTRL_LED2); + #ifdef CTRL_LED1 + rgblight_sethsv_default_helper(CTRL_LED1); + #endif // CTRL_LED1 + #ifdef CTRL_LED2 + rgblight_sethsv_default_helper(CTRL_LED2); + #endif // CTRL_LED2 } if (this_mod & MODS_GUI_MASK || this_osm & MODS_GUI_MASK) { - rgblight_sethsv_at(120, 255, 255, GUI_LED1); - rgblight_sethsv_at(120, 255, 255, GUI_LED2); + #ifdef GUI_LED1 + rgblight_sethsv_at(51, 255, 255, GUI_LED1); + #endif // GUI_LED1 + #ifdef GUI_LED2 + rgblight_sethsv_at(51, 255, 255, GUI_LED2); + #endif // GUI_LED2 } else { - rgblight_sethsv_default_helper(GUI_LED1); - rgblight_sethsv_default_helper(GUI_LED2); + #ifdef GUI_LED1 + rgblight_sethsv_default_helper(GUI_LED1); + #endif // GUI_LED1 + #ifdef GUI_LED2 + rgblight_sethsv_default_helper(GUI_LED2); + #endif // GUI_LED2 + } + if (this_mod & MODS_ALT_MASK || this_osm & MODS_ALT_MASK) { + #ifdef ALT_LED1 + rgblight_sethsv_at(240, 255, 255, ALT_LED1); + #endif // ALT_LED1 + #ifdef GUI_LED2 + rgblight_sethsv_at(240, 255, 255, ALT_LED2); + #endif // GUI_LED2 + } else { + #ifdef GUI_LED1 + rgblight_sethsv_default_helper(ALT_LED1); + #endif // GUI_LED1 + #ifdef GUI_LED2 + rgblight_sethsv_default_helper(ALT_LED2); + #endif // GUI_LED2 } } } @@ -63,7 +103,48 @@ void matrix_scan_indicator(void) { static rgblight_fadeout lights[RGBLED_NUM]; __attribute__ ((weak)) -bool indicator_is_this_led_used(uint8_t index) { return false; } +bool rgblight_twinkle_is_led_used_keymap(uint8_t index) { return false; } + +bool rgblight_twinkle_is_led_used(uint8_t index) { + switch (index) { +#ifdef INDICATOR_LIGHTS +#ifdef SHFT_LED1 + case SHFT_LED1: + return true; +#endif //SHFT_LED1 +#ifdef SHFT_LED2 + case SHFT_LED2: + return true; +#endif //SHFT_LED2 +#ifdef CTRL_LED1 + case CTRL_LED1: + return true; +#endif //CTRL_LED1 +#ifdef CTRL_LED2 + case CTRL_LED2: + return true; +#endif //CTRL_LED2 +#ifdef GUI_LED1 + case GUI_LED1: + return true; +#endif //GUI_LED1 +#ifdef GUI_LED2 + case GUI_LED2: + return true; +#endif //GUI_LED2 +#ifdef ALT_LED1 + case ALT_LED1: + return true; +#endif //ALT_LED1 +#ifdef ALT_LED2 + case ALT_LED2: + return true; +#endif //ALT_LED2 +#endif //INDICATOR_LIGHTS + default: + return rgblight_twinkle_is_led_used_keymap(index); + } +} void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive bool litup = false; @@ -97,7 +178,7 @@ void start_rgb_light(void) { uint8_t min_life = 0xFF; uint8_t min_life_index = -1; for (uint8_t index = 0 ; index < RGBLED_NUM ; ++index ) { - if (indicator_is_this_led_used(index)) { continue; } + if (rgblight_twinkle_is_led_used(index)) { continue; } if (lights[index].enabled) { if (min_life_index == -1 || lights[index].life < min_life) @@ -181,16 +262,16 @@ void matrix_init_rgb(void) { #endif if (userspace_config.rgb_layer_change) { - uint8_t default_layer = eeconfig_read_default_layer(); rgblight_enable_noeeprom(); - if (default_layer & (1UL << _COLEMAK)) { - rgblight_sethsv_magenta(); - } else if (default_layer & (1UL << _DVORAK)) { - rgblight_sethsv_green(); - } else if (default_layer & (1UL << _WORKMAN)) { - rgblight_sethsv_goldenrod(); - } else { - rgblight_sethsv_cyan(); + switch (biton32(eeconfig_read_default_layer())) { + case _COLEMAK: + rgblight_sethsv_noeeprom_magenta(); break; + case _DVORAK: + rgblight_sethsv_noeeprom_green(); break; + case _WORKMAN: + rgblight_sethsv_noeeprom_goldenrod(); break; + default: + rgblight_sethsv_noeeprom_cyan(); break; } } } @@ -209,7 +290,6 @@ void matrix_scan_rgb(void) { uint32_t layer_state_set_rgb(uint32_t state) { #ifdef RGBLIGHT_ENABLE - uint8_t default_layer = eeconfig_read_default_layer(); if (userspace_config.rgb_layer_change) { switch (biton32(state)) { case _MACROS: @@ -241,14 +321,15 @@ uint32_t layer_state_set_rgb(uint32_t state) { rgblight_mode_noeeprom(23); break; default: // for any other layers, or the default layer - if (default_layer & (1UL << _COLEMAK)) { - rgblight_sethsv_noeeprom_magenta(); - } else if (default_layer & (1UL << _DVORAK)) { - rgblight_sethsv_noeeprom_green(); - } else if (default_layer & (1UL << _WORKMAN)) { - rgblight_sethsv_noeeprom_goldenrod(); - } else { - rgblight_sethsv_noeeprom_cyan(); + switch (biton32(default_layer_state)) { + case _COLEMAK: + rgblight_sethsv_noeeprom_magenta(); break; + case _DVORAK: + rgblight_sethsv_noeeprom_green(); break; + case _WORKMAN: + rgblight_sethsv_noeeprom_goldenrod(); break; + default: + rgblight_sethsv_noeeprom_cyan(); break; } biton32(state) == _MODS ? rgblight_mode_noeeprom(2) : rgblight_mode_noeeprom(1); // if _MODS layer is on, then breath to denote it break; @@ -259,3 +340,5 @@ uint32_t layer_state_set_rgb(uint32_t state) { return state; } + + diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk @@ -1,5 +1,9 @@ -SRC += drashna.c secrets.c rgb_stuff.c +SRC += drashna.c + +ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") + SRC += secrets.c +endif ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) SRC += tap_dances.c @@ -11,7 +15,8 @@ ifeq ($(strip $(NO_SECRETS)), yes) OPT_DEFS += -DNO_SECRETS endif -ifdef RGBLIGHT_ENABLE +ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) + SRC += rgb_stuff.c ifeq ($(strip $(INDICATOR_LIGHTS)), yes) OPT_DEFS += -DINDICATOR_LIGHTS endif