From 855dd2d218ba875f1fb7bddfbce8bd260e96184e Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sat, 17 Oct 2020 11:46:57 -0700 Subject: [PATCH] [Keymap] Drashna Code Cleanup (#10656) * Add Launchpad keymap Note: RGB and Audio won't work when using B pins for audio * Add support for rgb matrix on launchpad * Update config for launchpag * Disable wait on layer change * Update config for ErgoDox EZ * Fixup rgb light userspace code * Move Corne layout to community layouts folder * Update config for corne to support community layouts * Add license header to files * Minor cleanup of userspace config * Update Pimironi Trackball code * Increase debounce time on ergodox * Fix keymap handling * Enable wait for USB for moonlander * Update/add license headers * fix review issues --- .../nano/keymaps/drashna/keymap.c | 16 + keyboards/c39/keymaps/drashna/config.h | 16 + keyboards/c39/keymaps/drashna/keymap.c | 16 + keyboards/gergo/keymaps/drashna/keymap.c | 16 + .../keebio/iris/keymaps/drashna/config.h | 31 +- .../keebio/iris/keymaps/drashna/keymap.c | 16 + .../keebio/iris/keymaps/drashna_lp/config.h | 31 +- .../keebio/iris/keymaps/drashna_old/config.h | 31 +- .../keebio/viterbi/keymaps/drashna/config.h | 31 +- .../keebio/viterbi/keymaps/drashna/keymap.c | 16 + keyboards/kyria/keymaps/drashna/config.h | 2 +- keyboards/kyria/keymaps/drashna/keymap.c | 16 + keyboards/launchpad/keymaps/drashna/config.h | 31 ++ keyboards/launchpad/keymaps/drashna/keymap.c | 107 +++++ keyboards/launchpad/keymaps/drashna/rules.mk | 6 + keyboards/moonlander/keymaps/drashna/config.h | 5 +- keyboards/moonlander/keymaps/drashna/keymap.c | 4 +- layouts/community/ergodox/drashna/config.h | 21 +- layouts/community/ergodox/drashna/keymap.c | 122 ++--- layouts/community/numpad_5x6/drashna/config.h | 16 + layouts/community/numpad_5x6/drashna/keymap.c | 16 + layouts/community/ortho_4x12/drashna/config.h | 16 + layouts/community/ortho_4x12/drashna/keymap.c | 16 + layouts/community/ortho_5x12/drashna/config.h | 16 + layouts/community/ortho_5x12/drashna/keymap.c | 16 + .../community/split_3x6_3}/drashna/config.h | 36 +- .../community/split_3x6_3}/drashna/glcdfont.c | 0 .../community/split_3x6_3}/drashna/keymap.c | 46 +- .../community/split_3x6_3}/drashna/rules.mk | 11 +- users/drashna/config.h | 28 +- users/drashna/drashna.c | 31 +- users/drashna/drashna.h | 31 +- users/drashna/oled_stuff.c | 16 + users/drashna/oled_stuff.h | 16 + users/drashna/pimoroni_trackball.c | 59 ++- users/drashna/pimoroni_trackball.h | 17 + users/drashna/process_records.c | 417 +++++++----------- users/drashna/process_records.h | 16 + users/drashna/rgb_matrix_stuff.c | 18 +- users/drashna/rgb_matrix_stuff.h | 16 + users/drashna/rgb_stuff.c | 74 ++-- users/drashna/rgb_stuff.h | 16 + users/drashna/rgblight_breathe_table.h | 16 + users/drashna/tap_dances.c | 16 + users/drashna/tap_dances.h | 16 + users/drashna/template.c | 16 + users/drashna/template.h | 16 + users/drashna/wrappers.h | 17 + 48 files changed, 1054 insertions(+), 521 deletions(-) create mode 100644 keyboards/launchpad/keymaps/drashna/config.h create mode 100644 keyboards/launchpad/keymaps/drashna/keymap.c create mode 100644 keyboards/launchpad/keymaps/drashna/rules.mk rename {keyboards/crkbd/keymaps => layouts/community/split_3x6_3}/drashna/config.h (68%) rename {keyboards/crkbd/keymaps => layouts/community/split_3x6_3}/drashna/glcdfont.c (100%) rename {keyboards/crkbd/keymaps => layouts/community/split_3x6_3}/drashna/keymap.c (86%) rename {keyboards/crkbd/keymaps => layouts/community/split_3x6_3}/drashna/rules.mk (88%) diff --git a/keyboards/40percentclub/nano/keymaps/drashna/keymap.c b/keyboards/40percentclub/nano/keymaps/drashna/keymap.c index f5d0787ee..b8947cce7 100644 --- a/keyboards/40percentclub/nano/keymaps/drashna/keymap.c +++ b/keyboards/40percentclub/nano/keymaps/drashna/keymap.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" #include "analog.h" #include "pointing_device.h" diff --git a/keyboards/c39/keymaps/drashna/config.h b/keyboards/c39/keymaps/drashna/config.h index 789b7cc14..73b0b8acf 100644 --- a/keyboards/c39/keymaps/drashna/config.h +++ b/keyboards/c39/keymaps/drashna/config.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 // place overrides here diff --git a/keyboards/c39/keymaps/drashna/keymap.c b/keyboards/c39/keymaps/drashna/keymap.c index 882938138..3fd3ef35e 100755 --- a/keyboards/c39/keymaps/drashna/keymap.c +++ b/keyboards/c39/keymaps/drashna/keymap.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" /* diff --git a/keyboards/gergo/keymaps/drashna/keymap.c b/keyboards/gergo/keymaps/drashna/keymap.c index d1e622406..7258d350d 100644 --- a/keyboards/gergo/keymaps/drashna/keymap.c +++ b/keyboards/gergo/keymaps/drashna/keymap.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" /* diff --git a/keyboards/keebio/iris/keymaps/drashna/config.h b/keyboards/keebio/iris/keymaps/drashna/config.h index 49381b60a..63f87b7c4 100644 --- a/keyboards/keebio/iris/keymaps/drashna/config.h +++ b/keyboards/keebio/iris/keymaps/drashna/config.h @@ -1,19 +1,18 @@ -/* -Copyright 2017 Danny Nguyen - -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 . -*/ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 diff --git a/keyboards/keebio/iris/keymaps/drashna/keymap.c b/keyboards/keebio/iris/keymaps/drashna/keymap.c index edfcd23e7..bc34ba822 100644 --- a/keyboards/keebio/iris/keymaps/drashna/keymap.c +++ b/keyboards/keebio/iris/keymaps/drashna/keymap.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" /* diff --git a/keyboards/keebio/iris/keymaps/drashna_lp/config.h b/keyboards/keebio/iris/keymaps/drashna_lp/config.h index 5370d88ed..414acab84 100644 --- a/keyboards/keebio/iris/keymaps/drashna_lp/config.h +++ b/keyboards/keebio/iris/keymaps/drashna_lp/config.h @@ -1,19 +1,18 @@ -/* -Copyright 2017 Danny Nguyen - -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 . -*/ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 diff --git a/keyboards/keebio/iris/keymaps/drashna_old/config.h b/keyboards/keebio/iris/keymaps/drashna_old/config.h index 5adf014e3..f08b22dca 100644 --- a/keyboards/keebio/iris/keymaps/drashna_old/config.h +++ b/keyboards/keebio/iris/keymaps/drashna_old/config.h @@ -1,19 +1,18 @@ -/* -Copyright 2017 Danny Nguyen - -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 . -*/ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 diff --git a/keyboards/keebio/viterbi/keymaps/drashna/config.h b/keyboards/keebio/viterbi/keymaps/drashna/config.h index 40a5bbd0e..5d7ffa8a1 100644 --- a/keyboards/keebio/viterbi/keymaps/drashna/config.h +++ b/keyboards/keebio/viterbi/keymaps/drashna/config.h @@ -1,19 +1,18 @@ -/* -Copyright 2017 Danny Nguyen - -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 . -*/ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 diff --git a/keyboards/keebio/viterbi/keymaps/drashna/keymap.c b/keyboards/keebio/viterbi/keymaps/drashna/keymap.c index 3b213418d..99e06b4de 100644 --- a/keyboards/keebio/viterbi/keymaps/drashna/keymap.c +++ b/keyboards/keebio/viterbi/keymaps/drashna/keymap.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" // Fillers to make layering more clear diff --git a/keyboards/kyria/keymaps/drashna/config.h b/keyboards/kyria/keymaps/drashna/config.h index 5e9d8b010..1af947e73 100644 --- a/keyboards/kyria/keymaps/drashna/config.h +++ b/keyboards/kyria/keymaps/drashna/config.h @@ -1,4 +1,4 @@ -/* Copyright 2019 Thomas Baart +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) * * 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 diff --git a/keyboards/kyria/keymaps/drashna/keymap.c b/keyboards/kyria/keymaps/drashna/keymap.c index 98afff19f..08f32812e 100644 --- a/keyboards/kyria/keymaps/drashna/keymap.c +++ b/keyboards/kyria/keymaps/drashna/keymap.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" uint8_t is_master; diff --git a/keyboards/launchpad/keymaps/drashna/config.h b/keyboards/launchpad/keymaps/drashna/config.h new file mode 100644 index 000000000..212b1da80 --- /dev/null +++ b/keyboards/launchpad/keymaps/drashna/config.h @@ -0,0 +1,31 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 + +/* Underlight Configuration */ +#undef RGB_DI_PIN +#define RGB_DI_PIN F5 +#define RGBLIGHT_ANIMATIONS +#undef RGBLED_NUM +#define RGBLED_NUM 8 // Number of LEDs +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 + +#define DRIVER_LED_TOTAL RGBLED_NUM +#define B7_AUDIO +#define AUDIO_CLICKY diff --git a/keyboards/launchpad/keymaps/drashna/keymap.c b/keyboards/launchpad/keymaps/drashna/keymap.c new file mode 100644 index 000000000..f8e4d1a41 --- /dev/null +++ b/keyboards/launchpad/keymaps/drashna/keymap.c @@ -0,0 +1,107 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 + +enum local_layers { + _QWERTY, + _RGB, + _FUNC, +}; + +// Defines for task manager and such +#define CALTDEL LCTL(LALT(KC_DEL)) +#define TSKMGR LCTL(LSFT(KC_ESC)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Qwerty + * ,-------------. + * | 1 | 2 | + * |------+------| + * | 3 | 4 | + * |------+------| + * | 5 | 6 | + * |------+------| + * | FUNC | RGB | + * `-------------' + */ + [_QWERTY] = LAYOUT( \ + KC_1, KC_2, \ + KC_3, KC_4, \ + KC_5, KC_6, \ + MO(_FUNC), TG(_RGB) \ + ), + + /* RGB + * ,-------------. + * | Mode-| Mode+| + * |------+------| + * | HUE- | HUE+ | + * |------+------| + * | SAT- | SAT+ | + * |------+------| + * |RGBTOG| | + * `-------------' + */ + [_RGB] = LAYOUT( \ + RGB_RMOD, RGB_MOD, \ + RGB_HUD, RGB_HUI, \ + RGB_SAD, RGB_SAI, \ + RGB_TOG, KC_TRNS \ + ), + + /* Function + * ,-------------. + * | Q |CALDEL| + * |------+------| + * | A |TSKMGR| + * |------+------| + * | Z | X | + * |------+------| + * | | C | + * `-------------' + */ + [_FUNC] = LAYOUT( \ + KC_Q, CALTDEL, \ + KC_A, TSKMGR, \ + KC_Z, KC_X, \ + _______, RESET \ + ) + +}; + + + + +#ifdef RGB_MATRIX_ENABLE + led_config_t g_led_config = { + { + { 7, 0 }, + { 6, 1 }, + { 5, 2 }, + { 4, 3 }, + },{ + { 121, 2 }, { 121, 23 }, + { 121, 41 }, { 121, 60 }, + { 103, 2 }, { 103, 23 }, + { 103, 41 }, { 103, 60 }, + },{ + 1, 1, 1, 1, + 1, 1, 1, 1, + } + }; +#endif diff --git a/keyboards/launchpad/keymaps/drashna/rules.mk b/keyboards/launchpad/keymaps/drashna/rules.mk new file mode 100644 index 000000000..463b85599 --- /dev/null +++ b/keyboards/launchpad/keymaps/drashna/rules.mk @@ -0,0 +1,6 @@ +BOOTLOADER = atmel-dfu + +RGBLIGHT_ENABLE = no +AUDIO_ENABLE = no +BOOTMAGIC_ENABLE = lite +RGB_MATRIX_ENABLE = WS2812 diff --git a/keyboards/moonlander/keymaps/drashna/config.h b/keyboards/moonlander/keymaps/drashna/config.h index dd49eaf4b..e022722fe 100644 --- a/keyboards/moonlander/keymaps/drashna/config.h +++ b/keyboards/moonlander/keymaps/drashna/config.h @@ -1,4 +1,4 @@ -/* Copyright 2020 Drashna Jael're +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) * * 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 @@ -15,7 +15,8 @@ */ - #pragma once #define TAPPING_TERM_PER_KEY +#define WAIT_FOR_USB +// #define NO_USB_STARTUP_CHECK diff --git a/keyboards/moonlander/keymaps/drashna/keymap.c b/keyboards/moonlander/keymaps/drashna/keymap.c index b8754673b..7daa5248f 100644 --- a/keyboards/moonlander/keymaps/drashna/keymap.c +++ b/keyboards/moonlander/keymaps/drashna/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2020 Drashna Jael're +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) * * 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 @@ -14,8 +14,6 @@ * along with this program. If not, see . */ - - #include "drashna.h" #ifndef UNICODE_ENABLE diff --git a/layouts/community/ergodox/drashna/config.h b/layouts/community/ergodox/drashna/config.h index 8ad589f93..a595a93c4 100644 --- a/layouts/community/ergodox/drashna/config.h +++ b/layouts/community/ergodox/drashna/config.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 RGBLIGHT_ENABLE @@ -15,7 +31,7 @@ #define PRODUCT DrashnaDox - Hacked ErgoDox EZ Hybrid Monstrosity #undef DEBOUNCE -#define DEBOUNCE 15 +#define DEBOUNCE 20 #define TAPPING_TERM_PER_KEY @@ -25,8 +41,7 @@ # undef RGB_MATRIX_LED_PROCESS_LIMIT # undef RGB_MATRIX_LED_FLUSH_LIMIT # if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) -# define RGBLIGHT_LIMIT_VAL 175 -# define RGB_MATRIX_MAXIMUM_BRIGHTNESS (RGBLIGHT_LIMIT_VAL + 25) +# define RGBLIGHT_LIMIT_VAL 100 # undef RGBLIGHT_SLEEP # endif #endif diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index 8f5aaf6cd..5f1c0c8a0 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" #ifdef UNICODEMAP_ENABLE @@ -6,9 +22,6 @@ #ifndef UNICODE_ENABLE # define UC(x) KC_NO #endif -#ifdef RGBLIGHT_ENABLE -extern rgblight_config_t rgblight_config; -#endif enum more_custom_keycodes { KC_SWAP_NUM = NEW_SAFE_RANGE, @@ -315,8 +328,21 @@ void keyboard_post_init_keymap(void) { void shutdown_keymap(void) { trackball_set_rgbw(RGB_RED, 0x00); } + +static bool mouse_button_one, trackball_button_one; + +void trackball_check_click(bool pressed, report_mouse_t* mouse) { + if (mouse_button_one | pressed) { + mouse->buttons |= MOUSE_BTN1; + } else { + mouse->buttons &= ~MOUSE_BTN1; + } + trackball_button_one = pressed; +} #endif + + bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case KC_1: @@ -358,33 +384,20 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { } run_trackball_cleanup(); break; -#if !defined(MOUSEKEY_ENABLE) && defined(POINTING_DEVICE_ENABLE) - case KC_BTN1 ... KC_BTN3: - { - report_mouse_t currentReport = pointing_device_get_report(); - if (record->event.pressed) { - currentReport.buttons |= (1 << (keycode - KC_BTN1)); // this is defined in report.h - } else { - currentReport.buttons &= ~(1 << (keycode - KC_BTN1)); - } - pointing_device_set_report(currentReport); - pointing_device_send(); - break; - } +#if !defined(MOUSEKEY_ENABLE) + case KC_MS_BTN1: + mouse_button_one = record->event.pressed; + trackball_register_button(mouse_button_one | trackball_button_one, MOUSE_BTN1); + break; + case KC_MS_BTN2: + trackball_register_button(record->event.pressed, MOUSE_BTN2); + break; + case KC_MS_BTN3: + trackball_register_button(record->event.pressed, MOUSE_BTN3); + break; # endif #endif } - // 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); - // } - // return false; - // break; - //} return true; } @@ -457,7 +470,8 @@ void rgb_matrix_indicators_user(void) { if (userspace_config.rgb_layer_change) # endif { - switch (get_highest_layer(layer_state)) { + bool mods_enabled = IS_LAYER_ON(_MODS); + switch (get_highest_layer(layer_state|default_layer_state)) { case _GAMEPAD: rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); break; @@ -473,36 +487,30 @@ void rgb_matrix_indicators_user(void) { case _ADJUST: rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); break; - default: { - bool mods_enabled = IS_LAYER_ON(_MODS); - switch (get_highest_layer(default_layer_state)) { - case _QWERTY: - rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); - break; - case _COLEMAK: - rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); - break; - case _DVORAK: - rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); - break; - case _WORKMAN: - rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); - break; - case _NORMAN: - rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); - break; - case _MALTRON: - rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); - break; - case _EUCALYN: - rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); - break; - case _CARPLAX: - rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); - break; - } + case _QWERTY: + rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + break; + case _COLEMAK: + rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + break; + case _DVORAK: + rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + break; + case _WORKMAN: + rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + break; + case _NORMAN: + rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + break; + case _MALTRON: + rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + break; + case _EUCALYN: + rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + break; + case _CARPLAX: + rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); break; - } } } } diff --git a/layouts/community/numpad_5x6/drashna/config.h b/layouts/community/numpad_5x6/drashna/config.h index 29045148e..97c1170d7 100644 --- a/layouts/community/numpad_5x6/drashna/config.h +++ b/layouts/community/numpad_5x6/drashna/config.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 B6_AUDIO diff --git a/layouts/community/numpad_5x6/drashna/keymap.c b/layouts/community/numpad_5x6/drashna/keymap.c index 3d325a4c1..5c87ebf76 100644 --- a/layouts/community/numpad_5x6/drashna/keymap.c +++ b/layouts/community/numpad_5x6/drashna/keymap.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" #define F2_MCRO LT(_GAMEPAD, KC_F2) diff --git a/layouts/community/ortho_4x12/drashna/config.h b/layouts/community/ortho_4x12/drashna/config.h index 5342549e5..6a99fcda0 100644 --- a/layouts/community/ortho_4x12/drashna/config.h +++ b/layouts/community/ortho_4x12/drashna/config.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 #if defined(RGBLIGHT_ENABLE) && !defined(RGBLED_NUM) diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index d2957d8fd..8070a7d35 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" #ifdef RGBLIGHT_ENABLE diff --git a/layouts/community/ortho_5x12/drashna/config.h b/layouts/community/ortho_5x12/drashna/config.h index 7504338ff..76bd642a3 100644 --- a/layouts/community/ortho_5x12/drashna/config.h +++ b/layouts/community/ortho_5x12/drashna/config.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 /* ws2812 RGB LED */ diff --git a/layouts/community/ortho_5x12/drashna/keymap.c b/layouts/community/ortho_5x12/drashna/keymap.c index 0ee9dfb10..98c349b2e 100644 --- a/layouts/community/ortho_5x12/drashna/keymap.c +++ b/layouts/community/ortho_5x12/drashna/keymap.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" /* diff --git a/keyboards/crkbd/keymaps/drashna/config.h b/layouts/community/split_3x6_3/drashna/config.h similarity index 68% rename from keyboards/crkbd/keymaps/drashna/config.h rename to layouts/community/split_3x6_3/drashna/config.h index 26af02957..7db51fb6e 100644 --- a/keyboards/crkbd/keymaps/drashna/config.h +++ b/layouts/community/split_3x6_3/drashna/config.h @@ -1,22 +1,18 @@ -/* -This is the c configuration file for the keymap - -Copyright 2012 Jun Wako -Copyright 2015 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 . -*/ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 @@ -70,7 +66,7 @@ along with this program. If not, see . #undef PRODUCT #define PRODUCT Drashna Hacked Corne Keyboard -#define OLED_FONT_H "keyboards/crkbd/keymaps/drashna/glcdfont.c" +#define OLED_FONT_H "layouts/community/split_3x6_3/drashna/glcdfont.c" // #define OLED_FONT_WIDTH 5 // #define OLED_FONT_HEIGHT 7 diff --git a/keyboards/crkbd/keymaps/drashna/glcdfont.c b/layouts/community/split_3x6_3/drashna/glcdfont.c similarity index 100% rename from keyboards/crkbd/keymaps/drashna/glcdfont.c rename to layouts/community/split_3x6_3/drashna/glcdfont.c diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/layouts/community/split_3x6_3/drashna/keymap.c similarity index 86% rename from keyboards/crkbd/keymaps/drashna/keymap.c rename to layouts/community/split_3x6_3/drashna/keymap.c index d9c1605ce..30e3958fe 100644 --- a/keyboards/crkbd/keymaps/drashna/keymap.c +++ b/layouts/community/split_3x6_3/drashna/keymap.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" extern uint8_t is_master; @@ -17,90 +33,90 @@ enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE }; * of use. K## is a placeholder to pass through the individual keycodes */ -#define LAYOUT_crkbd_base( \ +#define LAYOUT_split_3x6_3_base( \ K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \ ) \ - LAYOUT_wrapper( \ + LAYOUT_split_3x6_3_wrapper( \ KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ ALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(KC_QUOT), \ OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ KC_GRV, KC_SPC, BK_LWER, DL_RAIS, KC_ENT, OS_RGUI \ ) -#define LAYOUT_crkbd_base_wrapper(...) LAYOUT_crkbd_base(__VA_ARGS__) +#define LAYOUT_split_3x6_3_base_wrapper(...) LAYOUT_split_3x6_3_base(__VA_ARGS__) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_QWERTY] = LAYOUT_crkbd_base_wrapper( + [_QWERTY] = LAYOUT_split_3x6_3_base_wrapper( _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ ), - [_COLEMAK] = LAYOUT_crkbd_base_wrapper( + [_COLEMAK] = LAYOUT_split_3x6_3_base_wrapper( _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, _________________COLEMAK_L3________________, _________________COLEMAK_R3________________ ), - [_DVORAK] = LAYOUT_crkbd_base_wrapper( + [_DVORAK] = LAYOUT_split_3x6_3_base_wrapper( _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, _________________DVORAK_L3_________________, _________________DVORAK_R3_________________ ), - [_WORKMAN] = LAYOUT_crkbd_base_wrapper( + [_WORKMAN] = LAYOUT_split_3x6_3_base_wrapper( _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, _________________WORKMAN_L3________________, _________________WORKMAN_R3________________ ), - [_NORMAN] = LAYOUT_crkbd_base_wrapper( + [_NORMAN] = LAYOUT_split_3x6_3_base_wrapper( _________________NORMAN_L1_________________, _________________NORMAN_L1_________________, _________________NORMAN_L2_________________, _________________NORMAN_R2_________________, _________________NORMAN_L3_________________, _________________NORMAN_R3_________________ ), - [_MALTRON] = LAYOUT_crkbd_base_wrapper( + [_MALTRON] = LAYOUT_split_3x6_3_base_wrapper( _________________MALTRON_L1________________, _________________MALTRON_R1________________, _________________MALTRON_L2________________, _________________MALTRON_R2________________, _________________MALTRON_L3________________, _________________MALTRON_R3________________ ), - [_EUCALYN] = LAYOUT_crkbd_base_wrapper( + [_EUCALYN] = LAYOUT_split_3x6_3_base_wrapper( _________________EUCALYN_L1________________, _________________EUCALYN_R1________________, _________________EUCALYN_L2________________, _________________EUCALYN_R2________________, _________________EUCALYN_L3________________, _________________EUCALYN_R3________________ ), - [_CARPLAX] = LAYOUT_crkbd_base_wrapper( + [_CARPLAX] = LAYOUT_split_3x6_3_base_wrapper( _____________CARPLAX_QFMLWY_L1_____________, _____________CARPLAX_QFMLWY_R1_____________, _____________CARPLAX_QFMLWY_L2_____________, _____________CARPLAX_QFMLWY_R2_____________, _____________CARPLAX_QFMLWY_L3_____________, _____________CARPLAX_QFMLWY_R3_____________ ), - [_MODS] = LAYOUT_wrapper( + [_MODS] = LAYOUT_split_3x6_3_wrapper( _______, ___________________BLANK___________________, ___________________BLANK___________________, _______, _______, ___________________BLANK___________________, ___________________BLANK___________________, _______, KC_LSFT, ___________________BLANK___________________, ___________________BLANK___________________, KC_RSFT, _______, _______, _______, _______, _______, _______ ), - [_LOWER] = LAYOUT_wrapper( + [_LOWER] = LAYOUT_split_3x6_3_wrapper( KC_F11, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_F11, KC_F12, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE, _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______, _______, _______, _______, _______, _______, _______ ), - [_RAISE] = LAYOUT_wrapper( \ + [_RAISE] = LAYOUT_split_3x6_3_wrapper( \ _______, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______, _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______, _______, _______, _______, _______, _______, _______ ), - [_ADJUST] = LAYOUT_wrapper( \ + [_ADJUST] = LAYOUT_split_3x6_3_wrapper( \ KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RESET, VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EEP_RST, MG_NKRO, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, RGB_IDL, diff --git a/keyboards/crkbd/keymaps/drashna/rules.mk b/layouts/community/split_3x6_3/drashna/rules.mk similarity index 88% rename from keyboards/crkbd/keymaps/drashna/rules.mk rename to layouts/community/split_3x6_3/drashna/rules.mk index 492c17e20..6ac1554b3 100644 --- a/keyboards/crkbd/keymaps/drashna/rules.mk +++ b/layouts/community/split_3x6_3/drashna/rules.mk @@ -16,12 +16,13 @@ UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. SWAP_HANDS_ENABLE = no # Enable one-hand typing -RGB_MATRIX_ENABLE = WS2812 -HAPTIC_ENABLE = SOLENOID # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -BOOTLOADER = qmk-dfu - -OLED_DRIVER_ENABLE = yes +ifeq ($(strip $(KEYBOARD)), crkbd/rev1) + OLED_DRIVER_ENABLE = yes + RGB_MATRIX_ENABLE = WS2812 + HAPTIC_ENABLE = SOLENOID + BOOTLOADER = qmk-dfu +endif diff --git a/users/drashna/config.h b/users/drashna/config.h index 7d83c7884..9fc65e5c9 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 // Use custom magic number so that when switching branches, EEPROM always gets reset @@ -7,11 +23,6 @@ #define USB_POLLING_INTERVAL_MS 1 #ifdef AUDIO_ENABLE -# if __GNUC__ > 5 -# if __has_include("drashna_song_list.h") -# include "drashna_song_list.h" -# endif // if file exists -# endif // __GNUC__ # define AUDIO_CLICKY # define STARTUP_SONG SONG(RICK_ROLL) @@ -49,7 +60,7 @@ // # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 // # define EECONFIG_RGB_MATRIX (uint32_t *)16 -# if defined(__AVR__) && !defined(__AVR_AT90USB1286__) +# if defined(__AVR__) && !defined(__AVR_AT90USB1286__) && !defined(KEYBOARD_launchpad) # define DISABLE_RGB_MATRIX_ALPHAS_MODS # define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN # define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT @@ -63,7 +74,7 @@ # define DISABLE_RGB_MATRIX_CYCLE_ALL # define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT # define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN -# define DISABLE_RGB_MATRIX_CYCLE_OUT_IN +// # define DISABLE_RGB_MATRIX_CYCLE_OUT_IN // # define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL # define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON # define DISABLE_RGB_MATRIX_DUAL_BEACON @@ -100,7 +111,7 @@ #ifdef QMK_KEYS_PER_SCAN # undef QMK_KEYS_PER_SCAN -# define QMK_KEYS_PER_SCAN 1 +# define QMK_KEYS_PER_SCAN 2 #endif // !QMK_KEYS_PER_SCAN // this makes it possible to do rolling combos (zx) with keys that @@ -111,6 +122,7 @@ #undef PERMISSIVE_HOLD //#define TAPPING_FORCE_HOLD //#define RETRO_TAPPING +#define TAPPING_TERM_PER_KEY #define FORCE_NKRO diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 5c0f18027..ec6484621 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -1,19 +1,18 @@ -/* -Copyright 2017 Christopher Courtney @drashna - -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 . -*/ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index dd2b02258..772005a03 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -1,19 +1,18 @@ -/* -Copyright 2017 Christopher Courtney @drashna - -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 . -*/ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 #include QMK_KEYBOARD_H diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c index 6503b970e..46288aad2 100644 --- a/users/drashna/oled_stuff.c +++ b/users/drashna/oled_stuff.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" extern uint8_t is_master; diff --git a/users/drashna/oled_stuff.h b/users/drashna/oled_stuff.h index 662e206b7..7f2786d00 100644 --- a/users/drashna/oled_stuff.h +++ b/users/drashna/oled_stuff.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 #include "quantum.h" diff --git a/users/drashna/pimoroni_trackball.c b/users/drashna/pimoroni_trackball.c index c5bb560b3..9ae094c05 100644 --- a/users/drashna/pimoroni_trackball.c +++ b/users/drashna/pimoroni_trackball.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "pimoroni_trackball.h" #include "i2c_master.h" @@ -6,7 +22,7 @@ static int16_t x_offset = 0; static int16_t y_offset = 0; static int16_t h_offset = 0; static int16_t v_offset = 0; -static float precisionSpeed = 1; +static float precisionSpeed = 1; #ifndef I2C_TIMEOUT # define I2C_TIMEOUT 100 @@ -47,17 +63,37 @@ __attribute__((weak)) void trackball_check_click(bool pressed, report_mouse_t* m } } -float trackball_get_precision(void) { return precisionSpeed; } -void trackball_set_precision(float precision) { precisionSpeed = precision; } -bool trackball_is_scrolling(void) { return scrolling; } -void trackball_set_scrolling(bool scroll) { scrolling = scroll; } +void trackball_register_button(bool pressed, enum mouse_buttons button) { + report_mouse_t currentReport = pointing_device_get_report(); + if (pressed) { + currentReport.buttons |= button; + } else { + currentReport.buttons &= ~button; + } + pointing_device_set_report(currentReport); +} -__attribute__((weak)) void pointing_device_init(void) { trackball_set_rgbw(0x00,0x00,0x00,0x4F); } +float trackball_get_precision(void) { return precisionSpeed; } +void trackball_set_precision(float precision) { precisionSpeed = precision; } +bool trackball_is_scrolling(void) { return scrolling; } +void trackball_set_scrolling(bool scroll) { scrolling = scroll; } + +bool has_report_changed (report_mouse_t first, report_mouse_t second) { + return !( + (!first.buttons && first.buttons == second.buttons) && + (!first.x && first.x == second.x) && + (!first.y && first.y == second.y) && + (!first.h && first.h == second.h) && + (!first.v && first.v == second.v) ); +} + + +__attribute__((weak)) void pointing_device_init(void) { trackball_set_rgbw(0x00, 0x00, 0x00, 0x4F); } void pointing_device_task(void) { - static bool debounce; + static bool debounce; static uint16_t debounce_timer; - uint8_t state[5] = {}; + uint8_t state[5] = {}; if (i2c_readReg(TRACKBALL_WRITE, 0x04, state, 5, I2C_TIMEOUT) == I2C_STATUS_SUCCESS) { if (!state[4] && !debounce) { if (scrolling) { @@ -85,7 +121,7 @@ void pointing_device_task(void) { } } else { if (state[4]) { - debounce = true; + debounce = true; debounce_timer = timer_read(); } } @@ -97,7 +133,6 @@ void pointing_device_task(void) { trackball_check_click(state[4] & (1 << 7), &mouse); - #ifndef PIMORONI_TRACKBALL_ROTATE update_member(&mouse.x, &x_offset); update_member(&mouse.y, &y_offset); @@ -110,5 +145,7 @@ void pointing_device_task(void) { update_member(&mouse.v, &h_offset); #endif pointing_device_set_report(mouse); - pointing_device_send(); + if (has_report_changed(mouse, pointing_device_get_report())) { + pointing_device_send(); + } } diff --git a/users/drashna/pimoroni_trackball.h b/users/drashna/pimoroni_trackball.h index 7e8a7cc81..83d248d3f 100644 --- a/users/drashna/pimoroni_trackball.h +++ b/users/drashna/pimoroni_trackball.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 #include "quantum.h" @@ -11,6 +27,7 @@ void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white); void trackball_check_click(bool pressed, report_mouse_t *mouse); +void trackball_register_button(bool pressed, enum mouse_buttons button); float trackball_get_precision(void); void trackball_set_precision(float precision); diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c index 8e3d3356e..19bdef73f 100644 --- a/users/drashna/process_records.c +++ b/users/drashna/process_records.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" uint16_t copy_paste_timer; @@ -21,304 +37,171 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { process_record_user_oled(keycode, record); #endif // OLED - if (process_record_keymap(keycode, record) && process_record_secrets(keycode, record) + if (!(process_record_keymap(keycode, record) && process_record_secrets(keycode, record) #ifdef RGB_MATRIX_ENABLE && process_record_user_rgb_matrix(keycode, record) #endif #ifdef RGBLIGHT_ENABLE && process_record_user_rgb_light(keycode, record) #endif - ) { - switch (keycode) { - case KC_QWERTY ... KC_WORKMAN: - if (record->event.pressed) { - uint8_t mods = mod_config(get_mods() | get_oneshot_mods()); - if (!mods) { - set_single_persistent_default_layer(keycode - KC_QWERTY); - } else if (mods & MOD_MASK_SHIFT) { - set_single_persistent_default_layer(keycode - KC_QWERTY + 4); - } else if (mods & MOD_MASK_CTRL) { - set_single_persistent_default_layer(keycode - KC_QWERTY + 8); - } - } - break; + && true)) { + return false; + } - case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader - if (!record->event.pressed) { + switch (keycode) { + case KC_QWERTY ... KC_WORKMAN: + if (record->event.pressed) { + uint8_t mods = mod_config(get_mods() | get_oneshot_mods()); + if (!mods) { + set_single_persistent_default_layer(keycode - KC_QWERTY); + } else if (mods & MOD_MASK_SHIFT) { + set_single_persistent_default_layer(keycode - KC_QWERTY + 4); + } else if (mods & MOD_MASK_CTRL) { + set_single_persistent_default_layer(keycode - KC_QWERTY + 8); + } + } + break; + + case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader + if (!record->event.pressed) { #ifndef MAKE_BOOTLOADER - uint8_t temp_mod = mod_config(get_mods()); - uint8_t temp_osm = mod_config(get_oneshot_mods()); - clear_mods(); - clear_oneshot_mods(); + uint8_t temp_mod = mod_config(get_mods()); + uint8_t temp_osm = mod_config(get_oneshot_mods()); + clear_mods(); + clear_oneshot_mods(); #endif - send_string_with_delay_P(PSTR("qmk"), TAP_CODE_DELAY); + send_string_with_delay_P(PSTR("qmk"), TAP_CODE_DELAY); #ifndef MAKE_BOOTLOADER - if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) + if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) #endif - { - send_string_with_delay_P(PSTR(" flash "), TAP_CODE_DELAY); + { + send_string_with_delay_P(PSTR(" flash "), TAP_CODE_DELAY); #ifndef MAKE_BOOTLOADER - } else { - send_string_with_delay_P(PSTR(" compile "), TAP_CODE_DELAY); -#endif - } - send_string_with_delay_P(PSTR("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP), TAP_CODE_DELAY); -#ifdef RGB_MATRIX_SPLIT_RIGHT - send_string_with_delay_P(PSTR(" RGB_MATRIX_SPLIT_RIGHT=yes"), TAP_CODE_DELAY); -# ifndef OLED_DRIVER_ENABLE - send_string_with_delay_P(PSTR(" OLED_DRIVER_ENABLE=no"), TAP_CODE_DELAY); -# endif -#endif - send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY); - } - - break; - - case VRSN: // Prints firmware version - if (record->event.pressed) { - send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY); - } - break; - - case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them -#ifdef TAP_DANCE_ENABLE - if (record->event.pressed) { - for (uint8_t index = 0; index < 4; index++) { - diablo_timer[index].key_interval = 0; - } - } -#endif // TAP_DANCE_ENABLE - break; - - case KC_CCCV: // One key copy/paste - if (record->event.pressed) { - copy_paste_timer = timer_read(); } else { - if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy - tap_code16(LCTL(KC_C)); - } else { // Tap, paste - tap_code16(LCTL(KC_V)); - } - } - break; -#ifdef UNICODE_ENABLE - case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻ - if (record->event.pressed) { - send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻"); - } - break; - case UC_TABL: // ┬─┬ノ( º _ ºノ) - if (record->event.pressed) { - send_unicode_string("┬─┬ノ( º _ ºノ)"); - } - break; - case UC_SHRG: // ¯\_(ツ)_/¯ - if (record->event.pressed) { - send_unicode_string("¯\\_(ツ)_/¯"); - } - break; - case UC_DISA: // ಠ_ಠ - if (record->event.pressed) { - send_unicode_string("ಠ_ಠ"); - } - break; + send_string_with_delay_P(PSTR(" compile "), TAP_CODE_DELAY); #endif - case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal -#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) - if (record->event.pressed) { - userspace_config.rgb_layer_change ^= 1; - dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); - eeconfig_update_user(userspace_config.raw); - if (userspace_config.rgb_layer_change) { -# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) - rgblight_enable_noeeprom(); -# endif - layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) -# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) - } else { - rgblight_disable_noeeprom(); -# endif - } } + send_string_with_delay_P(PSTR("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP), TAP_CODE_DELAY); +#ifdef RGB_MATRIX_SPLIT_RIGHT + send_string_with_delay_P(PSTR(" RGB_MATRIX_SPLIT_RIGHT=yes"), TAP_CODE_DELAY); +# ifndef OLED_DRIVER_ENABLE + send_string_with_delay_P(PSTR(" OLED_DRIVER_ENABLE=no"), TAP_CODE_DELAY); +# endif +#endif + send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY); + } + + break; + + case VRSN: // Prints firmware version + if (record->event.pressed) { + send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY); + } + break; + + case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them +#ifdef TAP_DANCE_ENABLE + if (record->event.pressed) { + for (uint8_t index = 0; index < 4; index++) { + diablo_timer[index].key_interval = 0; + } + } +#endif // TAP_DANCE_ENABLE + break; + + case KC_CCCV: // One key copy/paste + if (record->event.pressed) { + copy_paste_timer = timer_read(); + } else { + if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy + tap_code16(LCTL(KC_C)); + } else { // Tap, paste + tap_code16(LCTL(KC_V)); + } + } + break; +#ifdef UNICODE_ENABLE + case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻ + if (record->event.pressed) { + send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻"); + } + break; + case UC_TABL: // ┬─┬ノ( º _ ºノ) + if (record->event.pressed) { + send_unicode_string("┬─┬ノ( º _ ºノ)"); + } + break; + case UC_SHRG: // ¯\_(ツ)_/¯ + if (record->event.pressed) { + send_unicode_string("¯\\_(ツ)_/¯"); + } + break; + case UC_DISA: // ಠ_ಠ + if (record->event.pressed) { + send_unicode_string("ಠ_ಠ"); + } + break; +#endif + case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal +#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) + if (record->event.pressed) { + userspace_config.rgb_layer_change ^= 1; + dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); + eeconfig_update_user(userspace_config.raw); + if (userspace_config.rgb_layer_change) { +# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) + rgblight_enable_noeeprom(); +# endif + layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) +# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) + } else { + rgblight_disable_noeeprom(); +# endif + } + } #endif // RGBLIGHT_ENABLE - break; + break; #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) - case RGB_TOG: - // Split keyboards need to trigger on key-up for edge-case issue + case RGB_TOG: + // Split keyboards need to trigger on key-up for edge-case issue # ifndef SPLIT_KEYBOARD - if (record->event.pressed) { + if (record->event.pressed) { # else - if (!record->event.pressed) { + if (!record->event.pressed) { # endif # if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_toggle(); + rgblight_toggle(); # endif # if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_toggle(); + rgb_matrix_toggle(); # endif - } - return false; - break; - case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions - if (record->event.pressed) { - bool is_eeprom_updated; + } + return false; + break; + case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions + if (record->event.pressed) { + bool is_eeprom_updated; # if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - // This disables layer indication, as it's assumed that if you're changing this ... you want that disabled - if (userspace_config.rgb_layer_change) { - userspace_config.rgb_layer_change = false; - dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); - is_eeprom_updated = true; - } + // This disables layer indication, as it's assumed that if you're changing this ... you want that disabled + if (userspace_config.rgb_layer_change) { + userspace_config.rgb_layer_change = false; + dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); + is_eeprom_updated = true; + } # endif # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) - if (userspace_config.rgb_matrix_idle_anim) { - userspace_config.rgb_matrix_idle_anim = false; - dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim); - is_eeprom_updated = true; - } -# endif - if (is_eeprom_updated) { - eeconfig_update_user(userspace_config.raw); - } + if (userspace_config.rgb_matrix_idle_anim) { + userspace_config.rgb_matrix_idle_anim = false; + dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim); + is_eeprom_updated = true; } - -# if defined(RGBLIGHT_DISABLE_KEYCODES) || defined(RGB_MATRIX_DISABLE_KEYCODES) - if (keycode == RGB_MODE_FORWARD && record->event.pressed) { - uint8_t shifted = get_mods() & (MOD_MASK_SHIFT); - if (shifted) { -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_step_reverse(); -# endif -# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_step_reverse(); -# endif - } else { -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_step(); -# endif -# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_step(); -# endif - } - } else if (keycode == RGB_MODE_REVERSE && record->event.pressed) { - uint8_t shifted = get_mods() & (MOD_MASK_SHIFT); - if (shifted) { -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_step(); -# endif -# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_step(); -# endif - } else { -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_step_reverse(); -# endif -# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_step_reverse(); -# endif - } - } else if (keycode == RGB_HUI) { -# ifndef SPLIT_KEYBOARD - if (record->event.pressed) { -# else - if (!record->event.pressed) { -# endif -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_increase_hue(); -# endif -# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_increase_hue(); -# endif - } - } else if (keycode == RGB_HUD) { -# ifndef SPLIT_KEYBOARD - if (record->event.pressed) { -# else - if (!record->event.pressed) { -# endif -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_decrease_hue(); -# endif -# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_decrease_hue(); -# endif - } - } else if (keycode == RGB_SAI) { -# ifndef SPLIT_KEYBOARD - if (record->event.pressed) { -# else - if (!record->event.pressed) { -# endif -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_increase_sat(); -# endif -# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_increase_sat(); -# endif - } - } else if (keycode == RGB_SAD) { -# ifndef SPLIT_KEYBOARD - if (record->event.pressed) { -# else - if (!record->event.pressed) { -# endif -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_decrease_sat(); -# endif -# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_decrease_sat(); -# endif - } - } else if (keycode == RGB_VAI) { -# ifndef SPLIT_KEYBOARD - if (record->event.pressed) { -# else - if (!record->event.pressed) { -# endif -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_increase_val(); -# endif -# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_increase_val(); -# endif - } - } else if (keycode == RGB_VAD) { -# ifndef SPLIT_KEYBOARD - if (record->event.pressed) { -# else - if (!record->event.pressed) { -# endif -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_decrease_val(); -# endif -# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_decrease_val(); -# endif - } - } else if (keycode == RGB_SPI) { - if (record->event.pressed) { -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_increase_speed(); -# endif -# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_increase_speed(); -# endif - } - } else if (keycode == RGB_SPD) { - if (record->event.pressed) { -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) - rgblight_decrease_speed(); -# endif -# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) - rgb_matrix_decrease_speed(); -# endif - } - } - return false; # endif + if (is_eeprom_updated) { + eeconfig_update_user(userspace_config.raw); + } + } #endif - } } return true; } diff --git a/users/drashna/process_records.h b/users/drashna/process_records.h index 999882d4b..d41be962d 100644 --- a/users/drashna/process_records.h +++ b/users/drashna/process_records.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 #include "drashna.h" diff --git a/users/drashna/rgb_matrix_stuff.c b/users/drashna/rgb_matrix_stuff.c index c9c3224fa..52e261234 100644 --- a/users/drashna/rgb_matrix_stuff.c +++ b/users/drashna/rgb_matrix_stuff.c @@ -1,5 +1,21 @@ -#include "drashna.h" +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" +#include "rgb_matrix.h" #include "lib/lib8tion/lib8tion.h" extern led_config_t g_led_config; diff --git a/users/drashna/rgb_matrix_stuff.h b/users/drashna/rgb_matrix_stuff.h index 35b01047b..592f9c9e6 100644 --- a/users/drashna/rgb_matrix_stuff.h +++ b/users/drashna/rgb_matrix_stuff.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 #include "quantum.h" diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index defee9ac1..d98f7cc2f 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "drashna.h" #include "rgb_stuff.h" #include "eeprom.h" @@ -152,14 +168,15 @@ void matrix_scan_rgb_light(void) { void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) { rgblight_sethsv_noeeprom(hue, sat, val); - wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly + // wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly rgblight_mode_noeeprom(mode); } layer_state_t layer_state_set_rgb_light(layer_state_t state) { #ifdef RGBLIGHT_ENABLE if (userspace_config.rgb_layer_change) { - switch (get_highest_layer(state)) { + uint8_t mode = layer_state_cmp(state,_MODS) ? RGBLIGHT_MODE_BREATHING : RGBLIGHT_MODE_STATIC_LIGHT; + switch (get_highest_layer(state|default_layer_state)) { case _MACROS: rgblight_set_hsv_and_mode(HSV_ORANGE, userspace_config.is_overwatch ? RGBLIGHT_MODE_SNAKE + 2 : RGBLIGHT_MODE_SNAKE + 3); break; @@ -181,37 +198,30 @@ layer_state_t layer_state_set_rgb_light(layer_state_t state) { case _ADJUST: rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_KNIGHT + 2); break; - default: // for any other layers, or the default layer - { - uint8_t mode = get_highest_layer(state) == _MODS ? RGBLIGHT_MODE_BREATHING : RGBLIGHT_MODE_STATIC_LIGHT; - switch (get_highest_layer(default_layer_state)) { - case _COLEMAK: - rgblight_set_hsv_and_mode(HSV_MAGENTA, mode); - break; - case _DVORAK: - rgblight_set_hsv_and_mode(HSV_SPRINGGREEN, mode); - break; - case _WORKMAN: - rgblight_set_hsv_and_mode(HSV_GOLDENROD, mode); - break; - case _NORMAN: - rgblight_set_hsv_and_mode(HSV_CORAL, mode); - break; - case _MALTRON: - rgblight_set_hsv_and_mode(HSV_YELLOW, mode); - break; - case _EUCALYN: - rgblight_set_hsv_and_mode(HSV_PINK, mode); - break; - case _CARPLAX: - rgblight_set_hsv_and_mode(HSV_BLUE, mode); - break; - default: - rgblight_set_hsv_and_mode(HSV_CYAN, mode); - break; - } + case _COLEMAK: + rgblight_set_hsv_and_mode(HSV_MAGENTA, mode); + break; + case _DVORAK: + rgblight_set_hsv_and_mode(HSV_SPRINGGREEN, mode); + break; + case _WORKMAN: + rgblight_set_hsv_and_mode(HSV_GOLDENROD, mode); + break; + case _NORMAN: + rgblight_set_hsv_and_mode(HSV_CORAL, mode); + break; + case _MALTRON: + rgblight_set_hsv_and_mode(HSV_YELLOW, mode); + break; + case _EUCALYN: + rgblight_set_hsv_and_mode(HSV_PINK, mode); + break; + case _CARPLAX: + rgblight_set_hsv_and_mode(HSV_BLUE, mode); + break; + default: + rgblight_set_hsv_and_mode(HSV_CYAN, mode); break; - } } } #endif // RGBLIGHT_ENABLE diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h index 98a552db1..0153adb54 100644 --- a/users/drashna/rgb_stuff.h +++ b/users/drashna/rgb_stuff.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 #include "quantum.h" diff --git a/users/drashna/rgblight_breathe_table.h b/users/drashna/rgblight_breathe_table.h index 4c6ae38fa..b6f7a13ac 100644 --- a/users/drashna/rgblight_breathe_table.h +++ b/users/drashna/rgblight_breathe_table.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 . + */ + #ifndef RGBLIGHT_EFFECT_BREATHE_TABLE #define RGBLIGHT_EFFECT_BREATHE_TABLE diff --git a/users/drashna/tap_dances.c b/users/drashna/tap_dances.c index 65019ab75..01873489d 100644 --- a/users/drashna/tap_dances.c +++ b/users/drashna/tap_dances.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "tap_dances.h" #define NUM_OF_DIABLO_KEYS 4 diff --git a/users/drashna/tap_dances.h b/users/drashna/tap_dances.h index 44fa0b934..7f73f2803 100644 --- a/users/drashna/tap_dances.h +++ b/users/drashna/tap_dances.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 #include "drashna.h" diff --git a/users/drashna/template.c b/users/drashna/template.c index 833447daa..f98964ae4 100644 --- a/users/drashna/template.c +++ b/users/drashna/template.c @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "template.h" // Add reconfigurable functions here, for keymap customization diff --git a/users/drashna/template.h b/users/drashna/template.h index 178f96e22..cb1ad75d8 100644 --- a/users/drashna/template.h +++ b/users/drashna/template.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 #include QMK_KEYBOARD_H diff --git a/users/drashna/wrappers.h b/users/drashna/wrappers.h index d22e2959c..ed4022aaa 100644 --- a/users/drashna/wrappers.h +++ b/users/drashna/wrappers.h @@ -1,3 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 #include "drashna.h" /* @@ -17,6 +33,7 @@ expanded before being used as arguments to the LAYOUT_xxx macro. #define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__) #define LAYOUT_ortho_5x12_wrapper(...) LAYOUT_ortho_5x12(__VA_ARGS__) #define LAYOUT_gergo_wrapper(...) LAYOUT_gergo(__VA_ARGS__) +#define LAYOUT_split_3x6_3_wrapper(...) LAYOUT_split_3x6_3(__VA_ARGS__) /* Blocks for each of the four major keyboard layouts