summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2017-11-17 11:59:54 -0800
committerJack Humbert <jack.humb@gmail.com>2017-11-17 20:48:26 -0500
commitdbd33782f25ce1e0855add21cd92183336670213 (patch)
treea6b49a4fa70cb605e7f25cf1ddd68e1aa20f9954
parent1d703a476aa2cea2302c3d672b05b7e252e62c44 (diff)
Update to drashna keymaps (#4)
* Minor updates to keymaps * Minor updates to keymaps
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna/config.h1
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna/keymap.c172
-rw-r--r--keyboards/handwired/woodpad/keymaps/drashna/config.h3
-rw-r--r--keyboards/handwired/woodpad/keymaps/drashna/keymap.c168
-rw-r--r--keyboards/handwired/woodpad/keymaps/drashna/rules.mk4
-rw-r--r--keyboards/orthodox/keymaps/drashna/keymap.c12
-rw-r--r--keyboards/viterbi/keymaps/drashna/config.h5
-rw-r--r--keyboards/viterbi/keymaps/drashna/keymap.c128
-rw-r--r--keyboards/viterbi/keymaps/drashna/rules.mk1
-rw-r--r--users/drashna/drashna.c317
-rw-r--r--users/drashna/drashna.h38
11 files changed, 352 insertions, 497 deletions
diff --git a/keyboards/ergodox_ez/keymaps/drashna/config.h b/keyboards/ergodox_ez/keymaps/drashna/config.h
index 62becc7688..3d138e0721 100644
--- a/keyboards/ergodox_ez/keymaps/drashna/config.h
+++ b/keyboards/ergodox_ez/keymaps/drashna/config.h
@@ -13,5 +13,6 @@
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
#endif // RGBLIGHT_ENABLE
+#define FORCE_NKRO
#endif
diff --git a/keyboards/ergodox_ez/keymaps/drashna/keymap.c b/keyboards/ergodox_ez/keymaps/drashna/keymap.c
index 1f91612366..08c2447ddb 100644
--- a/keyboards/ergodox_ez/keymaps/drashna/keymap.c
+++ b/keyboards/ergodox_ez/keymaps/drashna/keymap.c
@@ -32,126 +32,18 @@ bool skip_leds = false;
#ifdef TAP_DANCE_ENABLE
-
-//define diablo macro timer variables
-static uint16_t diablo_timer[4];
-static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
-static uint8_t diablo_key_time[4];
-
-bool check_dtimer(uint8_t dtimer) {
- // has the correct number of seconds elapsed (as defined by diablo_times)
- return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true;
-};
-
-enum {
- TD_FLSH = 0,
- TD_DIABLO_1,
- TD_DIABLO_2,
- TD_DIABLO_3,
- TD_DIABLO_4
-};
-
-// on each tap, light up one led, from right to left
-// on the forth tap, turn them off from right to left
-
-void dance_flsh_each(qk_tap_dance_state_t *state, void *user_data) {
- if (!skip_leds) {
- ergodox_board_led_off();
- ergodox_right_led_1_off();
- ergodox_right_led_2_off();
- ergodox_right_led_3_off();
- skip_leds = true;
- }
- switch (state->count) {
- case 1:
- ergodox_right_led_1_on();
- break;
- case 2:
- ergodox_right_led_2_on();
- break;
- case 3:
- ergodox_right_led_3_on();
- break;
- case 4:
- ergodox_right_led_1_off();
- _delay_ms(50);
- ergodox_right_led_2_off();
- _delay_ms(50);
- ergodox_right_led_3_off();
-
- }
-}
-
-// on the fourth tap, set the keyboard on flash state
-// and set the underglow to red, because red == bad
-void dance_flsh_finished(qk_tap_dance_state_t *state, void *user_data) {
- if (state->count >= 4) {
-#ifdef RGBLIGHT_ENABLE
- rgblight_enable();
- rgblight_mode(1);
- rgblight_setrgb(0xff, 0x00, 0x00);
+#define KC_D3_1 TD(TD_D3_1)
+#define KC_D3_2 TD(TD_D3_2)
+#define KC_D3_3 TD(TD_D3_3)
+#define KC_D3_4 TD(TD_D3_4)
+#else
+#define KC_D3_1 KC_1
+#define KC_D3_2 KC_2
+#define KC_D3_3 KC_3
+#define KC_D3_4 KC_4
#endif
- reset_tap_dance(state);
- reset_keyboard();
- }
-}
-
-// Cycle through the times for the macro, starting at 0, for disabled.
-// Max of six values, so don't exceed
-void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
- if (state->count >= 7) {
- diablo_key_time[diablo_key] = diablo_times[0];
- reset_tap_dance(state);
- }
- else {
- diablo_key_time[diablo_key] = diablo_times[state->count - 1];
- }
-}
-// Would rather have one function for all of this, but no idea how to do that...
-void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) {
- diablo_tapdance_master(state, user_data, 0);
-}
-
-void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) {
- diablo_tapdance_master(state, user_data, 1);
-}
-
-void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) {
- diablo_tapdance_master(state, user_data, 2);
-}
-
-void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) {
- diablo_tapdance_master(state, user_data, 3);
-}
-
-
-// if the flash state didnt happen, then turn off leds, left to right
-void dance_flsh_reset(qk_tap_dance_state_t *state, void *user_data) {
- _delay_ms(200);
- ergodox_right_led_3_off();
- _delay_ms(200);
- ergodox_right_led_2_off();
- _delay_ms(200);
- ergodox_right_led_1_off();
- _delay_ms(500);
- skip_leds = false;
-}
-
-//Tap Dance Definitions
-qk_tap_dance_action_t tap_dance_actions[] = {
- //Once for Blue, Twice for Green, Thrice for Red, and four to flash
- [TD_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED(dance_flsh_each, dance_flsh_finished, dance_flsh_reset),
- // tap once to disable, and more to enable timed micros
- [TD_DIABLO_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
- [TD_DIABLO_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
- [TD_DIABLO_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
- [TD_DIABLO_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
-
-};
-#endif
-
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
*
@@ -430,9 +322,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_DIABLO] = LAYOUT_ergodox(
KC_ESCAPE, KC_V, KC_D, KC_LALT, KC_NO, KC_NO, KC_NO,
- KC_TAB, KC_S, KC_F, KC_I, KC_M, KC_T, KC_TRNS,
+ KC_TAB, KC_S, KC_I, KC_F, KC_M, KC_T, KC_TRNS,
KC_Q, KC_1, KC_2, KC_3, KC_4, KC_G,
- KC_LCTL, TD(TD_DIABLO_1), TD(TD_DIABLO_2), TD(TD_DIABLO_3), TD(TD_DIABLO_4), KC_Z, KC_NO,
+ KC_LCTL, KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, KC_Z, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_L, KC_J,
KC_F,
@@ -499,44 +391,6 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
-#ifdef TAP_DANCE_ENABLE
-
-// Sends the key press to system, but only if on the Diablo layer
-void send_diablo_keystroke(uint8_t diablo_key) {
- if (biton32(layer_state) == _DIABLO) {
- switch (diablo_key) {
- case 0:
- SEND_STRING("1");
- break;
- case 1:
- SEND_STRING("2");
- break;
- case 2:
- SEND_STRING("3");
- break;
- case 3:
- SEND_STRING("4");
- break;
- }
- }
-}
-
-// Checks each of the 4 timers/keys to see if enough time has elapsed
-// Runs the "send string" command if enough time has passed, and resets the timer.
-void run_diablo_macro_check(void) {
- uint8_t dtime;
-
- for (dtime = 0; dtime < 4; dtime++) {
- if (check_dtimer(dtime) && diablo_key_time[dtime]) {
- diablo_timer[dtime] = timer_read();
- send_diablo_keystroke(dtime);
- }
- }
-
-}
-
-#endif
-
void matrix_init_keymap(void) { // Runs boot tasks for keyboard
};
@@ -566,9 +420,5 @@ void matrix_scan_keymap(void) { // runs frequently to update info
}
- // Run Diablo 3 macro checking code.
-#ifdef TAP_DANCE_ENABLE
- run_diablo_macro_check();
-#endif
};
diff --git a/keyboards/handwired/woodpad/keymaps/drashna/config.h b/keyboards/handwired/woodpad/keymaps/drashna/config.h
index 780192cf3c..e505aac417 100644
--- a/keyboards/handwired/woodpad/keymaps/drashna/config.h
+++ b/keyboards/handwired/woodpad/keymaps/drashna/config.h
@@ -24,6 +24,7 @@
#endif // TAP_DANCE_ENABLE
+#define B5_AUDIO
#ifdef RGBLIGHT_ENABLE
@@ -38,6 +39,6 @@
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
#endif // RGBLIGHT_ENABLE
-
+#define FORCE_NKRO
#endif
diff --git a/keyboards/handwired/woodpad/keymaps/drashna/keymap.c b/keyboards/handwired/woodpad/keymaps/drashna/keymap.c
index e53c65f105..d0c748c434 100644
--- a/keyboards/handwired/woodpad/keymaps/drashna/keymap.c
+++ b/keyboards/handwired/woodpad/keymaps/drashna/keymap.c
@@ -24,78 +24,23 @@
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
-
-
-//define layer change stuff for underglow indicator
-bool skip_leds = false;
-
-
#ifdef TAP_DANCE_ENABLE
-//define diablo macro timer variables
-static uint16_t diablo_timer[4];
-static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
-static uint8_t diablo_key_time[4];
-
-
-bool check_dtimer(uint8_t dtimer) {
- // has the correct number of seconds elapsed (as defined by diablo_times)
- return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true;
-};
+#define KC_D3_1 TD(TD_D3_1)
+#define KC_D3_2 TD(TD_D3_2)
+#define KC_D3_3 TD(TD_D3_3)
+#define KC_D3_4 TD(TD_D3_4)
+#else
+#define KC_D3_1 KC_1
+#define KC_D3_2 KC_2
+#define KC_D3_3 KC_3
+#define KC_D3_4 KC_4
#endif
+//define layer change stuff for underglow indicator
+bool skip_leds = false;
-#ifdef TAP_DANCE_ENABLE
-enum {
- TD_D3_1 = 0,
- TD_D3_2,
- TD_D3_3,
- TD_D3_4
-};
-
-
-// Cycle through the times for the macro, starting at 0, for disabled.
-// Max of six values, so don't exceed
-void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
- if (state->count >= 7) {
- diablo_key_time[diablo_key] = diablo_times[0];
- reset_tap_dance(state);
- }
- else {
- diablo_key_time[diablo_key] = diablo_times[state->count - 1];
- }
-}
-
-
-// Would rather have one function for all of this, but no idea how to do that...
-void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) {
- diablo_tapdance_master(state, user_data, 0);
-}
-
-void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) {
- diablo_tapdance_master(state, user_data, 1);
-}
-
-void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) {
- diablo_tapdance_master(state, user_data, 2);
-}
-
-void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) {
- diablo_tapdance_master(state, user_data, 3);
-}
-
-
-
-//Tap Dance Definitions
-qk_tap_dance_action_t tap_dance_actions[] = {
- // tap once to disable, and more to enable timed micros
- [TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
- [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
- [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
- [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
-};
-#endif
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_NUMLOCK] = KEYMAP( /* Base */
@@ -112,38 +57,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_END, KC_DOWN, KC_PGDN, _______, \
KC_INS, KC_DEL, _______, _______ \
),
-#ifdef TAP_DANCE_ENABLE
-[_DIABLO] = KEYMAP( /* Base */
- KC_ESC, _______, _______, _______,\
- KC_S, KC_F, KC_I, KC_M, \
- KC_1, KC_2, KC_3, KC_4, \
- TD(TD_D3_1), TD(TD_D3_2), TD(TD_D3_3), TD(TD_D3_4), \
- _______, KC_DIABLO_CLEAR, KC_Q, SFT_T(KC_SPACE) \
-),
-#else
[_DIABLO] = KEYMAP( /* Base */
- KC_ESC, _______, _______, _______,\
- KC_S, KC_F, KC_I, KC_M, \
+ KC_ESC, _______, XXXXXXX, _______,\
+ KC_S, KC_I, KC_F, KC_M, \
KC_1, KC_2, KC_3, KC_4, \
- XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
- _______, KC_DIABLO_CLEAR, KC_Q, SFT_T(KC_SPACE) \
+ KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, \
+ XXXXXXX, KC_DIABLO_CLEAR, KC_Q, SFT_T(KC_SPACE) \
),
-#endif
-
[_MACROS] = KEYMAP( /* Base */
- KC_OVERWATCH, _______, _______, XXXXXXX,\
- XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
- XXXXXXX, XXXXXXX, XXXXXXX, KC_JUSTGAME, \
- KC_SYMM, KC_TORB, XXXXXXX, KC_GOODGAME, \
- KC_SALT, KC_MORESALT, KC_SALTHARD, KC_GLHF \
+ KC_OVERWATCH, XXXXXXX, _______, XXXXXXX,\
+ KC_JUSTGAME, XXXXXXX, XXXXXXX, KC_C9, \
+ XXXXXXX, XXXXXXX, KC_AIM, KC_GGEZ, \
+ KC_SYMM, KC_TORB, XXXXXXX, KC_GOODGAME, \
+ KC_SALT, KC_MORESALT, KC_SALTHARD, KC_GLHF \
),
[_MEDIA] = KEYMAP( /* Base */
KC_RESET, KC_MUTE, KC_VOLD, KC_VOLU,\
KC_MAKE, _______, RGB_HUI, RGB_HUD, \
KC_MPLY, KC_MSTP, KC_MPRV, KC_MNXT, \
- RGB_TOG, RGB_MOD, RGB_SAI, RGB_VAI, \
- _______, _______, RGB_SAD, RGB_VAD \
+ RGB_TOG, RGB_SMOD, RGB_SAI, RGB_VAI, \
+ _______, KC_RGB_T, RGB_SAD, RGB_VAD \
),
};
@@ -158,60 +92,7 @@ void numlock_led_off(void) {
}
-bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
- switch (keycode) {
-#ifdef TAP_DANCE_ENABLE
- case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them
- if (record->event.pressed) {
- uint8_t dtime;
-
- for (dtime = 0; dtime < 4; dtime++) {
- diablo_key_time[dtime] = diablo_times[0];
- }
- }
- return false;
- break;
-#endif
- }
- return true;
-}
-
-#ifdef TAP_DANCE_ENABLE
-
-// Sends the key press to system, but only if on the Diablo layer
-void send_diablo_keystroke(uint8_t diablo_key) {
- if (biton32(layer_state) == _DIABLO) {
- switch (diablo_key) {
- case 0:
- SEND_STRING("1");
- break;
- case 1:
- SEND_STRING("2");
- break;
- case 2:
- SEND_STRING("3");
- break;
- case 3:
- SEND_STRING("4");
- break;
- }
- }
-}
-
-// Checks each of the 4 timers/keys to see if enough time has elapsed
-// Runs the "send string" command if enough time has passed, and resets the timer.
-void run_diablo_macro_check(void) {
- uint8_t dtime;
-
- for (dtime = 0; dtime < 4; dtime++) {
- if (check_dtimer(dtime) && diablo_key_time[dtime]) {
- diablo_timer[dtime] = timer_read();
- send_diablo_keystroke(dtime);
- }
- }
-}
-#endif
void matrix_init_keymap(void) {
// set Numlock LED to output and low
DDRF |= (1 << 7);
@@ -226,13 +107,10 @@ void matrix_init_keymap(void) {
void matrix_scan_keymap(void) {
numlock_led_off();
- if ((is_overwatch && biton32(layer_state) == _MACROS) || (biton32(layer_state) == _NAV)) {
+ if ((is_overwatch && biton32(layer_state) == _MACROS) || (biton32(layer_state) == _NUMLOCK)) {
numlock_led_on();
}
// Run Diablo 3 macro checking code.
-#ifdef TAP_DANCE_ENABLE
- run_diablo_macro_check();
-#endif
}
diff --git a/keyboards/handwired/woodpad/keymaps/drashna/rules.mk b/keyboards/handwired/woodpad/keymaps/drashna/rules.mk
index bee3ecf505..ed7d2e7c6d 100644
--- a/keyboards/handwired/woodpad/keymaps/drashna/rules.mk
+++ b/keyboards/handwired/woodpad/keymaps/drashna/rules.mk
@@ -1,10 +1,10 @@
TAP_DANCE_ENABLE = yes
-SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
-COMMAND_ENABLE = yes # Commands for debug and configuration
+COMMAND_ENABLE = no # Commands for debug and configuration
RGBLIGHT_ENABLE = yes
MIDI_ENABLE = no
CONSOLE_ENABLE = no
NKRO_ENABLE = yes
+MOUSEKEY_ENABLE = no
EXTRAFLAGS = -flto
diff --git a/keyboards/orthodox/keymaps/drashna/keymap.c b/keyboards/orthodox/keymaps/drashna/keymap.c
index ca4e6dc2cd..33e65ac24b 100644
--- a/keyboards/orthodox/keymaps/drashna/keymap.c
+++ b/keyboards/orthodox/keymaps/drashna/keymap.c
@@ -61,7 +61,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_LOWER] = KEYMAP(\
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, XXXXXXX, KC_F12, _______, XXXXXXX, KC_RCTL, XXXXXXX, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
- TD(TD_FLSH),KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_HOME, KC_COMM, KC_DOT, KC_END, _______ \
+ _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_HOME, KC_COMM, KC_DOT, KC_END, _______ \
),
[_RAISE] = KEYMAP(\
@@ -72,15 +72,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_ADJUST] = KEYMAP(\
KC_MAKE,KC_RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
- _______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, XXXXXXX, _______, _______, XXXXXXX, _______, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, _______, \
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, MAGIC_TOGGLE_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY \
+ RGB_SMOD,RGB_HUI, _______, AU_ON, AU_OFF, AG_NORM, _______, XXXXXXX, _______, _______, XXXXXXX, _______, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, _______, \
+ KC_RGB_T,RGB_HUD, MU_ON, MU_OFF, MU_TOG, MU_MOD, _______, _______, _______, _______, _______, _______, MAGIC_TOGGLE_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY \
)
};
#ifdef FAUXCLICKY_ENABLE
-float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A4, 0.0625); // (_D4, 0.25);
-float fauxclicky_released_note[2] = MUSICAL_NOTE(_A4, 0.0625); // (_C4, 0.125);
-float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C6, 0.25); // (_C4, 0.25);
+float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25);
+float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125);
+float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C6, 2); // (_C4, 0.25);
#endif
diff --git a/keyboards/viterbi/keymaps/drashna/config.h b/keyboards/viterbi/keymaps/drashna/config.h
index 13c17b7bab..8ac492a8a2 100644
--- a/keyboards/viterbi/keymaps/drashna/config.h
+++ b/keyboards/viterbi/keymaps/drashna/config.h
@@ -42,4 +42,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
+#ifdef AUDIO_ENABLE
+#define C6_AUDIO
+#endif
+
+
#endif
diff --git a/keyboards/viterbi/keymaps/drashna/keymap.c b/keyboards/viterbi/keymaps/drashna/keymap.c
index 48a146958e..89621fa200 100644
--- a/keyboards/viterbi/keymaps/drashna/keymap.c
+++ b/keyboards/viterbi/keymaps/drashna/keymap.c
@@ -21,73 +21,9 @@ extern keymap_config_t keymap_config;
#define MEDIA TG(_MEDIA)
#define COVECUBE TG(_COVECUBE)
-
-
-
-#ifdef TAP_DANCE_ENABLE
-//define diablo macro timer variables
-static uint16_t diablo_timer[4];
-static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
-static uint8_t diablo_key_time[4];
-
-
-bool check_dtimer(uint8_t dtimer) {
- // has the correct number of seconds elapsed (as defined by diablo_times)
- return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true;
-};
-
-
-enum {
- TD_D3_1 = 0,
- TD_D3_2,
- TD_D3_3,
- TD_D3_4
-};
-
-
-// Cycle through the times for the macro, starting at 0, for disabled.
-// Max of six values, so don't exceed
-void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
- if (state->count >= 7) {
- diablo_key_time[diablo_key] = diablo_times[0];
- reset_tap_dance(state);
- }
- else {
- diablo_key_time[diablo_key] = diablo_times[state->count - 1];
- }
-}
-
-
-// Would rather have one function for all of this, but no idea how to do that...
-void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) {
- diablo_tapdance_master(state, user_data, 0);
-}
-
-void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) {
- diablo_tapdance_master(state, user_data, 1);
-}
-
-void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) {
- diablo_tapdance_master(state, user_data, 2);
-}
-
-void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) {
- diablo_tapdance_master(state, user_data, 3);
-}
-
-
-
-//Tap Dance Definitions
-qk_tap_dance_action_t tap_dance_actions[] = {
- // tap once to disable, and more to enable timed micros
- [TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
- [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
- [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
- [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
-
+enum more_custom_keycodes {
+ KC_KP_00 = NEW_SAFE_RANGE
};
-#endif
-
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -95,8 +31,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LMACRO, DIABLO, GAMEPAD, KC_NLCK, KC_SLCK, KC_COLN, KC_PSLS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
MEDIA, KC_CALC, COVECUBE, KC_P7, KC_P8, KC_P9, KC_PAST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
KC_HOME, KC_DEL, KC_PGUP, KC_P4, KC_P5, KC_P6, KC_PMNS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
- KC_END, KC_UP, KC_PGDN, KC_P1, KC_P2, KC_P3, KC_PPLS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
- KC_LEFT, KC_DOWN, K C_RGHT, KC_P0, KC_KP_00,KC_PDOT, KC_PENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \
+ KC_END, KC_UP, KC_PGDN, KC_P1, KC_P2, KC_P3, KC_PPLS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
+ KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_KP_00,KC_PDOT, KC_PENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \
),
[_DIABLO] = KEYMAP(
@@ -143,68 +79,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
-
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
-#ifdef TAP_DANCE_ENABLE
- case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them
+ case KC_KP_00:
if (record->event.pressed) {
- uint8_t dtime;
-
- for (dtime = 0; dtime < 4; dtime++) {
- diablo_key_time[dtime] = diablo_times[0];
- }
+ register_code(KC_KP_0);
+ unregister_code(KC_KP_0);
+ register_code(KC_KP_0);
+ unregister_code(KC_KP_0);
}
return false;
break;
-#endif
}
return true;
}
-#ifdef TAP_DANCE_ENABLE
-
-// Sends the key press to system, but only if on the Diablo layer
-void send_diablo_keystroke(uint8_t diablo_key) {
- if (biton32(layer_state) == _DIABLO) {
- switch (diablo_key) {
- case 0:
- SEND_STRING("1");
- break;
- case 1:
- SEND_STRING("2");
- break;
- case 2:
- SEND_STRING("3");
- break;
- case 3:
- SEND_STRING("4");
- break;
- }
- }
-}
-
-// Checks each of the 4 timers/keys to see if enough time has elapsed
-// Runs the "send string" command if enough time has passed, and resets the timer.
-void run_diablo_macro_check(void) {
- uint8_t dtime;
-
- for (dtime = 0; dtime < 4; dtime++) {
- if (check_dtimer(dtime) && diablo_key_time[dtime]) {
- diablo_timer[dtime] = timer_read();
- send_diablo_keystroke(dtime);
- }
- }
-}
-#endif
-void matrix_scan_keymap(void) { // runs frequently to update info
-#ifdef TAP_DANCE_ENABLE
- // Run Diablo 3 macro checking code.
- run_diablo_macro_check();
-#endif
-};
-
diff --git a/keyboards/viterbi/keymaps/drashna/rules.mk b/keyboards/viterbi/keymaps/drashna/rules.mk
index dd5747f1d0..34b1903709 100644
--- a/keyboards/viterbi/keymaps/drashna/rules.mk
+++ b/keyboards/viterbi/keymaps/drashna/rules.mk
@@ -1,4 +1,5 @@
CONSOLE_ENABLE = no
+COMMAND_ENABLE = no # Commands for debug and configuration
TAP_DANCE_ENABLE = yes
RGBLIGHT_ENABLE = yes
MOUSEKEY_ENABLE = no
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 30da7414ee..31f58a430c 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -1,8 +1,84 @@
+/*
+Copyright 2017 Christopher Courtney <drashna@live.com> @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 <http://www.gnu.org/licenses/>.
+*/
+
#include "drashna.h"
#include "quantum.h"
#include "action.h"
#include "version.h"
+#ifdef TAP_DANCE_ENABLE
+//define diablo macro timer variables
+static uint16_t diablo_timer[4];
+static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
+static uint8_t diablo_key_time[4];
+
+
+bool check_dtimer(uint8_t dtimer) {
+ // has the correct number of seconds elapsed (as defined by diablo_times)
+ return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true;
+};
+
+
+
+
+// Cycle through the times for the macro, starting at 0, for disabled.
+// Max of six values, so don't exceed
+void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
+ if (state->count >= 7) {
+ diablo_key_time[diablo_key] = diablo_times[0];
+ reset_tap_dance(state);
+ }
+ else {
+ diablo_key_time[diablo_key] = diablo_times[state->count - 1];
+ }
+}
+
+
+// Would rather have one function for all of this, but no idea how to do that...
+void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) {
+ diablo_tapdance_master(state, user_data, 0);
+}
+
+void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) {
+ diablo_tapdance_master(state, user_data, 1);
+}
+
+void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) {
+ diablo_tapdance_master(state, user_data, 2);
+}
+
+void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) {
+ diablo_tapdance_master(state, user_data, 3);
+}
+
+
+
+//Tap Dance Definitions
+qk_tap_dance_action_t tap_dance_actions[] = {
+ // tap once to disable, and more to enable timed micros
+ [TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
+ [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
+ [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
+ [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
+
+};
+#endif
+
+
// Add reconfigurable functions here, for keymap customization
// This allows for a global, userspace functions, and continued
// customization of the keymap. Use _keymap instead of _user
@@ -17,12 +93,22 @@ __attribute__ ((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
+
__attribute__ ((weak))
uint32_t layer_state_set_keymap (uint32_t state) {
return state;
}
+__attribute__ ((weak))
+void led_set_keymap(uint8_t usb_led) {}
+
bool is_overwatch = false;
+#ifdef RGBLIGHT_ENABLE
+bool rgb_layer_change = true;
+#endif
+
+
+
// Call user matrix init, set default RGB colors and then
// call the keymap's init function
@@ -54,13 +140,56 @@ void matrix_init_user(void) {
#endif
matrix_init_keymap();
}
+#ifdef TAP_DANCE_ENABLE
+// Sends the key press to system, but only if on the Diablo layer
+void send_diablo_keystroke(uint8_t diablo_key) {
+ if (biton32(layer_state) == _DIABLO) {
+ switch (diablo_key) {
+ case 0:
+ SEND_STRING("1");
+ break;
+ case 1:
+ SEND_STRING("2");
+ break;
+ case 2:
+ SEND_STRING("3");
+ break;
+ case 3:
+ SEND_STRING("4");
+ break;
+ }
+ }
+}
+
+// Checks each of the 4 timers/keys to see if enough time has elapsed
+// Runs the "send string" command if enough time has passed, and resets the timer.
+void run_diablo_macro_check(void) {
+ uint8_t dtime;
+
+ for (dtime = 0; dtime < 4; dtime++) {
+ if (check_dtimer(dtime) && diablo_key_time[dtime]) {
+ diablo_timer[dtime] = timer_read();
+ send_diablo_keystroke(dtime);
+ }
+ }
+
+}
+#endif
// No global matrix scan code, so just run keymap's matix
// scan function
void matrix_scan_user(void) {
+#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
+ run_diablo_macro_check();
+#endif
matrix_scan_keymap();
}
+void led_set_user(uint8_t usb_led) {
+ led_set_keymap(usb_led);
+}
+
+
#ifdef AUDIO_ENABLE
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
@@ -201,7 +330,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
SEND_STRING("Good game, everyone!");
register_code(KC_ENTER);
unregister_code(KC_ENTER);
- }
+ }
return false;
break;
case KC_GLHF:
@@ -254,11 +383,47 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
_delay_ms(50);
SEND_STRING("That aim is absolutely amazing. It's almost like you're a machine!" SS_TAP(X_ENTER));
- _delay_ms(50);
+ _delay_ms(3000);
+ register_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
SEND_STRING("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!" SS_TAP(X_ENTER));
}
return false;
break;
+ case KC_C9:
+ if (!record->event.pressed) {
+ register_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ _delay_ms(50);
+ SEND_STRING("OMG!!! C9!!!");
+ register_code(KC_ENTER);
+ unregister_code(KC_ENTER);
+ }
+ return false;
+ break;
+ case KC_GGEZ:
+ if (!record->event.pressed) {
+ register_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ _delay_ms(50);
+ SEND_STRING("That was a fantastic game, though it was a bit easy. Try harder next time!");
+ register_code(KC_ENTER);
+ unregister_code(KC_ENTER);
+ }
+ return false;
+ break;
+#endif
+#ifdef TAP_DANCE_ENABLE
+ case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them
+ if (record->event.pressed) {
+ uint8_t dtime;
+
+ for (dtime = 0; dtime < 4; dtime++) {
+ diablo_key_time[dtime] = diablo_times[0];
+ }
+ }
+ return false;
+ break;
#endif
case KC_MAKE:
if (!record->event.pressed) {
@@ -310,6 +475,33 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
+ case KC_RGB_T: // Because I want the option to go back to normal RGB mode rather than always layer indication
+ if (record->event.pressed) {
+ rgb_layer_change = !rgb_layer_change;
+ }
+ return false;
+ break;
+ case RGB_MOD:
+ case RGB_SMOD:
+ case RGB_HUI:
+ case RGB_HUD:
+ case RGB_SAI:
+ case RGB_SAD:
+ case RGB_VAI:
+ case RGB_VAD:
+ case RGB_MODE_PLAIN:
+ case RGB_MODE_BREATHE:
+ case RGB_MODE_RAINBOW:
+ case RGB_MODE_SWIRL:
+ case RGB_MODE_SNAKE:
+ case RGB_MODE_KNIGHT:
+ case RGB_MODE_XMAS:
+ case RGB_MODE_GRADIENT:
+ if (record->event.pressed) {
+ rgb_layer_change = false;
+ }
+ return true;
+ break;
}
return process_record_keymap(keycode, record);
}
@@ -317,70 +509,73 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// Runs state check and changes underglow color and animation
// on layer change, no matter where the change was initiated
// Then runs keymap's layer change check
-uint32_t layer_state_set_user (uint32_t state) {
+uint32_t layer_state_set_user(uint32_t state) {
#ifdef RGBLIGHT_ENABLE
uint8_t default_layer = eeconfig_read_default_layer();
-
- switch (biton32(state)) {
- case _NAV:
- rgblight_set_blue;
- rgblight_mode(1);
- break;
- case _SYMB:
- rgblight_set_blue;
- rgblight_mode(2);
- break;
- case _MOUS:
- rgblight_set_yellow;
- rgblight_mode(1);
- break;
- case _MACROS:
- rgblight_set_orange;
- is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
- break;
- case _MEDIA:
- rgblight_set_green;
- rgblight_mode(22);
- break;
- case _OVERWATCH:
- rgblight_set_orange;
- rgblight_mode(17);
- break;
- case _DIABLO:
- rgblight_set_red;
- rgblight_mode(5);
- break;
- case _RAISE:
- rgblight_set_yellow;
- rgblight_mode(5);
- break;
- case _LOWER:
- rgblight_set_orange;
- rgblight_mode(5);
- break;
- case _ADJUST:
- rgblight_set_red;
- rgblight_mode(23);
- break;
- case _COVECUBE:
- rgblight_set_green;
- rgblight_mode(2);
- default:
- if (default_layer & (1UL << _COLEMAK)) {
- rgblight_set_magenta;
- }
- else if (default_layer & (1UL << _DVORAK)) {
+ if (rgb_layer_change) {
+ switch (biton32(state)) {
+ case _NAV:
+ rgblight_set_blue;
+ rgblight_mode(1);
+ break;
+ case _SYMB:
+ rgblight_set_blue;
+ rgblight_mode(2);
+ break;
+ case _MOUS:
+ rgblight_set_yellow;
+ rgblight_mode(1);
+ break;
+ case _MACROS:
+ rgblight_set_orange;
+ is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
+ break;
+ case _MEDIA:
rgblight_set_green;
+ rgblight_mode(22);
+ break;
+ case _OVERWATCH:
+ rgblight_set_orange;
+ rgblight_mode(17);
+ break;
+ case _DIABLO:
+ rgblight_set_red;
+ rgblight_mode(5);
+ break;
+ case _RAISE:
+ rgblight_set_yellow;
+ rgblight_mode(5);
+ break;
+ case _LOWER:
+ rgblight_set_orange;
+ rgblight_mode(5);
+ break;
+ case _ADJUST:
+ rgblight_set_red;
+ rgblight_mode(23);
+ break;
+ case _COVECUBE:
+ rgblight_set_green;
+ rgblight_mode(2);
+ default:
+ if (default_layer & (1UL << _COLEMAK)) {
+ rgblight_set_magenta;
+ }
+ else if (default_layer & (1UL << _DVORAK)) {
+ rgblight_set_green;
+ }
+ else if (default_layer & (1UL << _WORKMAN)) {
+ rgblight_set_purple;
+ }
+ else {
+ rgblight_set_teal;
+ }
+ rgblight_mode(1);
+ break;
}
- else if (default_layer & (1UL << _WORKMAN)) {
- rgblight_set_purple;
- }
- else {
- rgblight_set_teal;
- }
- rgblight_mode(1);
- break;
}
#endif
return layer_state_set_keymap (state);
}
+
+
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index 6e897ad997..002af3dd43 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -1,3 +1,20 @@
+/*
+Copyright 2017 Christopher Courtney <drashna@live.com> @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 <http://www.gnu.org/licenses/>.
+*/
+
#ifndef USERSPACE
#define USERSPACE
@@ -26,6 +43,7 @@
#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
+#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
#ifdef RGBLIGHT_ENABLE
#define rgblight_set_blue rgblight_sethsv (0xFF, 0xFF, 0xFF);
@@ -39,8 +57,9 @@
#endif
extern bool is_overwatch;
+extern bool rgb_layer_change;
-enum custom_keycodes {
+enum userrpace_custom_keycodes {
PLACEHOLDER = SAFE_RANGE, // can always be here
EPRM,
VRSN,
@@ -62,9 +81,24 @@ enum custom_keycodes {
KC_GLHF,
KC_TORB,
KC_AIM,
+ KC_C9,
+ KC_GGEZ,
KC_MAKE,
KC_RESET,
- NEWPLACEHOLDER //use "NEWPLACEHOLDER for keymap specific codes
+ KC_RGB_T,
+ NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes
+};
+
+#ifdef TAP_DANCE_ENABLE
+enum {
+ TD_D3_1 = 0,
+ TD_D3_2,
+ TD_D3_3,
+ TD_D3_4
};
+#endif
+
+
+
#endif