From eb91c962886b1bb52c2d457a574cba09e2a8b0f0 Mon Sep 17 00:00:00 2001
From: Drashna Jaelre <drashna@live.com>
Date: Wed, 20 Nov 2019 12:37:24 -0800
Subject: [Keymap] All about (ARM) RGB and OLEDs (drashna keymaps) (#7354)

* Add Kyria Keymap

* Enable all RGBLIGHT Animations for ARM and high capacity AVR

* Reduce GNUC version for __has_include

* Cleanup Ortho 4x12 Community layout

* Update Collide 39 keymap

* Cleanup Keymaps

* Enable full 30 LEDs for Ergodox

* Change EEPROM Load timing

* Use RGB Matrix on Planck Rev6

* Use correct keymap swap

* Enable everything for ARM

* Only enable rgb sleep on avr until crash is fixed

* Add additional Kyria keymap config

* Overhaul Kyria OLED display

* Improve kyria keymap based on usage

* Minor tweaks to rules

* Update OLED code to truncate properly

* Fix RGB Light layer indication

* Switch all of biton32 to get_highest_layer function

* Fix OLED Keylogger display

* Run qmk cformat over all of my user files

* Slight tweak to kyria based on usage

* Move around LALT_T config

* Add comments about base wrappers to keymaps

* Another cformat pass

* Temp fix for VUSB boards and NKRO

* Convert tabs to spaces in rules.mk files

* Only enable RGBLight if it's enabled

* Add Encoder Flip setting

* Update OLED font file
---
 keyboards/c39/keymaps/drashna/config.h |   9 ++-
 keyboards/c39/keymaps/drashna/keymap.c | 132 +++++++++++++++++++++++----------
 keyboards/c39/keymaps/drashna/rules.mk |   4 +-
 3 files changed, 102 insertions(+), 43 deletions(-)
 mode change 100755 => 100644 keyboards/c39/keymaps/drashna/config.h

(limited to 'keyboards/c39/keymaps')

diff --git a/keyboards/c39/keymaps/drashna/config.h b/keyboards/c39/keymaps/drashna/config.h
old mode 100755
new mode 100644
index 361f68a78..5d53fe54b
--- a/keyboards/c39/keymaps/drashna/config.h
+++ b/keyboards/c39/keymaps/drashna/config.h
@@ -2,6 +2,11 @@
 
 // place overrides here
 #undef MATRIX_COL_PINS
-#define MATRIX_COL_PINS { A3, A2, A1, A0, B13, B14, B15, B9, B3, B2, B4, A10, A9 }
+#define MATRIX_COL_PINS \
+    { A3, A2, A1, A0, B13, B14, B15, B9, B3, B2, B4, A10, A9 }
 #undef MATRIX_ROW_PINS
-#define MATRIX_ROW_PINS { B7, B1, B0 }
+#define MATRIX_ROW_PINS \
+    { B7, B1, B0 }
+
+#define RGB_DI_PIN B10
+#define RGBLED_NUM 15
diff --git a/keyboards/c39/keymaps/drashna/keymap.c b/keyboards/c39/keymaps/drashna/keymap.c
index 9de75190d..882938138 100755
--- a/keyboards/c39/keymaps/drashna/keymap.c
+++ b/keyboards/c39/keymaps/drashna/keymap.c
@@ -1,45 +1,97 @@
-#include QMK_KEYBOARD_H
+#include "drashna.h"
 
-// Each layer gets a name for readability, which is then used in the keymap matrix below.
-// The underscores don't mean anything - you can have a layer called STUFF or any other name.
-// Layer names don't all need to be of the same length, obviously, and you can also skip them
-// entirely and just use numbers.
-#define _QWERTY 0
-#define _FN1 1
-
-// Defines for task manager and such
-#define CALTDEL LCTL(LALT(KC_DEL))
-#define TSKMGR LCTL(LSFT(KC_ESC))
+/*
+ * The `LAYOUT_base` macro is a template to allow the use of identical
+ * modifiers for the default layouts (eg QWERTY, Colemak, Dvorak, etc), so
+ * that there is no need to set them up for each layout, and modify all of
+ * them if I want to change them.  This helps to keep consistency and ease
+ * of use. K## is a placeholder to pass through the individual keycodes
+ */
+// clang-format off
+#define LAYOUT_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( \
+    KC_ESC,  K01,    K02,     K03,      K04,     K05,     KC_NO,   K06,     K07,     K08,     K09,     K0A,     KC_DEL, \
+    ALT_T(KC_TAB), K11, K12,  K13,      K14,     K15,     KC_BSPC, K16,     K17,     K18,     K19,     K1A, RALT_T(KC_QUOT), \
+    KC_MLSF, CTL_T(K21), K22, K23,   K24, LT(_LOWER,K25), KC_SPC, LT(_RAISE,K26), K27, K28,   K29, RCTL_T(K2A), KC_ENT \
+  )
+#define LAYOUT_base_wrapper(...)       LAYOUT_base(__VA_ARGS__)
 
 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 
-/* Qwerty
- * ,----------------------------------------------------------------------------.  ,-------------.
- * |   Q  |   W  |   E  |   R  |   T  | Bksp |   Y  |   U  |   I  |   O  |   P  |  |  M1  |  M2  |
- * |------+------+------+------+------+------+------+------+------+------+------+  |------+------|
- * |   A  |   S  |   D  |   F  |   G  | Enter|   H  |   J  |   K  |   L  |   ;  |  |  M3  |  M4  |
- * |------+------+------+------+------+------+------+------+------+------+------+  |------+------|
- * |   Z  |   X  |   C  |   V  |   B  |  FN1 |   N  |   M  |   ,  |   .  |   /  |  |  M5  |  M6  |
- * `----------------------------------------------------------------------------'  `-------------'
- */
-[_QWERTY] = LAYOUT(
-    KC_Q, KC_W, KC_E, KC_R, KC_T, KC_BSPC,                KC_Y, KC_U, KC_I,    KC_O,   KC_P,      KC_1, KC_2,
-    KC_A, KC_S, KC_D, KC_F, KC_G, MT(MOD_LSFT, KC_ENT),   KC_H, KC_J, KC_K,    KC_L,   KC_SCLN,   KC_3, KC_4,
-    KC_Z, KC_X, KC_C, KC_V, KC_B, LT(_FN1, KC_SPC),       KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH,   KC_5, KC_6
-),
-
-/* FN1
- * ,----------------------------------------------------------------------------.  ,-------------.
- * |   1  |   2  |   3  |   4  |   5  | Bksp |   6  |   7  |   8  |   9  |   0  |  |  M1  |  M2  |
- * |------+------+------+------+------+------+------+------+------+------+------+  |------+------|
- * |   4  |   5  |   6  |   +  |      | Enter|      |      |      |      |      |  |  M3  |  M4  |
- * |------+------+------+------+------+------+------+------+------+------+------+  |------+------|
- * |   7  |   8  |   9  |   0  |      |  FN1 |      |      |      |      |      |  |  M5  |  M6  |
- * `----------------------------------------------------------------------------'  `-------------'
- */
-[_FN1] = LAYOUT(
-    KC_1, KC_2, KC_3, KC_4,    KC_5,    KC_BSPC, KC_6,    KC_7,    KC_8,    KC_9,    KC_0,      KC_1, KC_2,
-    KC_4, KC_5, KC_6, KC_PLUS, _______, KC_ENT,  _______, _______, _______, _______, _______,   KC_3, KC_4,
-    KC_7, KC_8, KC_9, KC_0,    _______, _______, _______, _______, _______, _______, _______,   KC_5, KC_6
-),
+  [_QWERTY] = LAYOUT_base_wrapper(
+    _________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
+    _________________QWERTY_L2_________________, _________________QWERTY_R2_________________,
+    _________________QWERTY_L3_________________, _________________QWERTY_R3_________________
+  ),
+
+  [_COLEMAK] = LAYOUT_base_wrapper(
+    _________________COLEMAK_L1________________, _________________COLEMAK_R1________________,
+    _________________COLEMAK_L2________________, _________________COLEMAK_R2________________,
+    _________________COLEMAK_L3________________, _________________COLEMAK_R3________________
+  ),
+
+  [_DVORAK] = LAYOUT_base_wrapper(
+    _________________DVORAK_L1_________________, _________________DVORAK_R1_________________,
+    _________________DVORAK_L2_________________, _________________DVORAK_R2_________________,
+    _________________DVORAK_L3_________________, _________________DVORAK_R3_________________
+  ),
+
+  [_WORKMAN] = LAYOUT_base_wrapper(
+    _________________WORKMAN_L1________________, _________________WORKMAN_R1________________,
+    _________________WORKMAN_L2________________, _________________WORKMAN_R2________________,
+    _________________WORKMAN_L3________________, _________________WORKMAN_R3________________
+  ),
+
+  [_NORMAN] = LAYOUT_base_wrapper(
+    _________________NORMAN_L1_________________, _________________NORMAN_L1_________________,
+    _________________NORMAN_L2_________________, _________________NORMAN_R2_________________,
+    _________________NORMAN_L3_________________, _________________NORMAN_R3_________________
+  ),
+
+  [_MALTRON] = LAYOUT_base_wrapper(
+    _________________MALTRON_L1________________, _________________MALTRON_R1________________,
+    _________________MALTRON_L2________________, _________________MALTRON_R2________________,
+    _________________MALTRON_L3________________, _________________MALTRON_R3________________
+  ),
+
+  [_EUCALYN] = LAYOUT_base_wrapper(
+    _________________EUCALYN_L1________________, _________________EUCALYN_R1________________,
+    _________________EUCALYN_L2________________, _________________EUCALYN_R2________________,
+    _________________EUCALYN_L3________________, _________________EUCALYN_R3________________
+  ),
+
+  [_CARPLAX] = LAYOUT_base_wrapper(
+    _____________CARPLAX_QFMLWY_L1_____________, _____________CARPLAX_QFMLWY_R1_____________,
+    _____________CARPLAX_QFMLWY_L2_____________, _____________CARPLAX_QFMLWY_R2_____________,
+    _____________CARPLAX_QFMLWY_L3_____________, _____________CARPLAX_QFMLWY_R3_____________
+  ),
+
+  [_MODS] = LAYOUT_wrapper(
+    _______, ___________________BLANK___________________, _______, ___________________BLANK___________________, _______,
+    _______, ___________________BLANK___________________, _______, ___________________BLANK___________________, _______,
+    KC_LSFT, ___________________BLANK___________________, _______, ___________________BLANK___________________, _______
+  ),
+
+  [_LOWER] = LAYOUT_wrapper(
+    KC_TILD, _________________LOWER_L1__________________, _______, _________________LOWER_R1__________________, KC_BSPC,
+    KC_DEL,  _________________LOWER_L2__________________, _______, _________________LOWER_R2__________________, KC_PIPE,
+    _______, _________________LOWER_L3__________________, _______, _________________LOWER_R3__________________, _______
+  ),
+
+  [_RAISE] = LAYOUT_wrapper(
+    KC_GRV,  _________________RAISE_L1__________________, _______, _________________RAISE_R1__________________, KC_BSPC,
+    KC_DEL,  _________________RAISE_L2__________________, _______, _________________RAISE_R2__________________, KC_BSLS,
+    _______, _________________RAISE_L3__________________, _______, _________________RAISE_R3__________________, _______
+  ),
+
+  [_ADJUST] = LAYOUT_wrapper(
+    KC_MAKE, _________________ADJUST_L1_________________, KC_NUKE, _________________ADJUST_R1_________________, KC_RST,
+    VRSN,    _________________ADJUST_L2_________________, MG_NKRO, _________________ADJUST_R2_________________, EEP_RST,
+    TG_MODS, _________________ADJUST_L3_________________, KC_RGB_T,_________________ADJUST_R3_________________, RGB_IDL
+  )
 };
+// clang-format on
diff --git a/keyboards/c39/keymaps/drashna/rules.mk b/keyboards/c39/keymaps/drashna/rules.mk
index ae0cc9efe..d216f6abe 100644
--- a/keyboards/c39/keymaps/drashna/rules.mk
+++ b/keyboards/c39/keymaps/drashna/rules.mk
@@ -15,4 +15,6 @@ MIDI_ENABLE = no            # MIDI controls
 UNICODE_ENABLE = yes         # Unicode
 BLUETOOTH_ENABLE = no       # Enable Bluetooth with the Adafruit EZ-Key HID
 AUDIO_ENABLE = yes           # Audio output on port C6
-RGBLIGHT_ENABLE = no        # RGB Enable / Disable
+RGBLIGHT_ENABLE = yes       # RGB Enable / Disable
+
+RGBLIGHT_STARTUP_ANIMATION = yes
-- 
cgit v1.2.3