diff options
author | drashna <drashna@live.com> | 2017-10-10 10:11:05 -0700 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2017-10-10 07:11:05 -1000 |
commit | e0e80c0dc1be961999617a9eb0e1ae0f7988fae9 (patch) | |
tree | 021baf7d1950e4ccbc2d29cbb82d1e399645b2e5 /keyboards/orthodox/keymaps/drashna | |
parent | 34084b4ee63458789a3b84a956024291e404275b (diff) |
Cleanup of my keymaps (#1802)
* Add woodpad
* Cleanup
* Remove misc layouts for woodpad
* Move woodpad to handwired
* Updated RGB Underglow info
* Cleanup macros
* Fix odd merge issue
* Tweaked RGB lighting stuff
* Start to merge orthodox/ergodox keymaps (persistant layers)
* Add forced NKRO
* Added Colemak and Dvorak layers to default orthodox keymap
* Added default layer (qwerty/colemak/dvorak) detection to RGB Underglow
Diffstat (limited to 'keyboards/orthodox/keymaps/drashna')
-rw-r--r-- | keyboards/orthodox/keymaps/drashna/config.h | 20 | ||||
-rw-r--r-- | keyboards/orthodox/keymaps/drashna/keymap.c | 78 |
2 files changed, 98 insertions, 0 deletions
diff --git a/keyboards/orthodox/keymaps/drashna/config.h b/keyboards/orthodox/keymaps/drashna/config.h index 9e91753bd5..7cbbf1025a 100644 --- a/keyboards/orthodox/keymaps/drashna/config.h +++ b/keyboards/orthodox/keymaps/drashna/config.h @@ -39,4 +39,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define TAPPING_TERM 200 #endif + +#ifdef RGBLIGHT_ENABLE +#define RGB_DI_PIN D3 +#define RGBLED_NUM 12 // 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 + +#define FORCE_NKRO +#ifdef FORCE_NKRO +#define NKRO_EPSIZE 32 +#endif + +#define PERMISSIVE_HOLD + #endif
\ No newline at end of file diff --git a/keyboards/orthodox/keymaps/drashna/keymap.c b/keyboards/orthodox/keymaps/drashna/keymap.c index 196794076c..f761265279 100644 --- a/keyboards/orthodox/keymaps/drashna/keymap.c +++ b/keyboards/orthodox/keymaps/drashna/keymap.c @@ -49,6 +49,20 @@ enum custom_keycodes { #define _______ KC_TRNS #define XXXXXXX KC_NO +#ifdef RGBLIGHT_ENABLE +//define layer change stuff for underglow indicator +#define rgblight_set_blue rgblight_sethsv (0xFF, 0xFF, 0xFF); +#define rgblight_set_red rgblight_sethsv(0x00, 0xFF, 0xFF); +#define rgblight_set_green rgblight_sethsv (0x78, 0xFF, 0xFF); +#define rgblight_set_orange rgblight_sethsv (0x1E, 0xFF, 0xFF); +#define rgblight_set_teal rgblight_sethsv (0xC3, 0xFF, 0xFF); +#define rgblight_set_magenta rgblight_sethsv (0x12C, 0xFF, 0xFF); +#define rgblight_set_urine rgblight_sethsv (0x3C, 0xFF, 0xFF); + +//This is both for underglow, and Diablo 3 macros +bool has_layer_changed = true; +static uint8_t current_layer = 10; +#endif #ifdef TAP_DANCE_ENABLE enum { @@ -194,4 +208,68 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } +#ifdef RGBLIGHT_ENABLE + + + + +void matrix_scan_user(void) { // runs frequently to update info + uint8_t layer = biton32(layer_state); + + if (layer != current_layer) { + has_layer_changed = true; + current_layer = layer; + } + // Check layer, and apply color if its changed since last check + if (has_layer_changed) { + uint8_t default_layer = 0; + default_layer = eeconfig_read_default_layer(); + + if (default_layer & (1UL << _DVORAK)) { + l_dvorak = true; + } + else if (default_layer & (1UL << _COLEMAK)) { + l_colemak = true; + } + switch (layer) { + case _QWERTY: + if (l_colemak) { + rgblight_set_magenta; + } + else if (l_dvorak) { + rgblight_set_green; + } + else { + rgblight_set_teal; + } + rgblight_mode(1); + break; + case _COLEMAK: + rgblight_set_magenta; + rgblight_mode(1); + break; + case _DVORAK: + rgblight_set_green; + rgblight_mode(1); + break; + case _RAISE: + rgblight_set_blue; + rgblight_mode(2); + break; + case _LOWER: + rgblight_set_orange; + rgblight_mode(3); + break; + case _ADJUST: + rgblight_set_red; + rgblight_mode(17); + break; + case 6: + rgblight_set_urine; + break; + } + has_layer_changed = false; + } + }; +#endif
\ No newline at end of file |