[Keymap] Drashna's Feature madness (#6128)

* Fix my Tap Dance issues after I broke them

* Cleanup and organization of userspace documentation

As well as some additional cleanup of functions due to review of documentation.

* Enable Tapdance on Glow and remove more animations

* Revert to Eager PR debouncing

* Add better check for startup animation

* Move where RGB Matrix defines are listed

* Limit RGB Matrix max val

* Update keyboard for Iris Rev 3 conflicts

* Enable encoder support on planck ez

* Remove is_master check from corne\'s OLED code

* Overhaul OLED screens for my Corne

* One last removal

* Show RGB valu On both sides

* Updates for OLED display info

* Fix compile issues for rgb config

* Disabled Space Cadet for all drashna keymaps

* Fix OLED Screen configs

* Minor OLED Tweaks

* Revert some Iris changes

* Fix song include

* Handle MAKE macro for the Corne boards better

* Add super hacky-hack for eeconfig initialization

* Add audio support for Fractal since Elite Cs support it

* Add defines for keycode steps

* Add White layout

* Update Corne RGB info

* Add fun effects to layer indication for RGB Matrix enabled boards

* Use proper define for product name detection

* Update formatting

* Use custom timeout mechanism for OLED timeout

* Fix up OLED screen HSV code for new HSV structure

* Better handle turning off RGB Matrix when sleeping

* Disable MultiSplash Animation

* Change Iris back to using serial

* Why was RGB disabled?!?!?!

* Limit val in rgb_matrix_layer_helper function

* Remove EECONFIG setting for RGB matrix
master
Drashna Jaelre 2019-07-22 20:22:33 -07:00 committed by MechMerlin
parent 840b9090a0
commit d41961c9ed
38 changed files with 1451 additions and 1190 deletions

View File

@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
/* Select hand configuration */
// #define MASTER_LEFT
@ -41,43 +40,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define RGBLIGHT_HUE_STEP 8
# define RGBLIGHT_SAT_STEP 8
# define RGBLIGHT_VAL_STEP 8
# define RGBLIGHT_LIMIT_VAL 100
# define RGBLIGHT_VAL_STEP 5
# define RGBLIGHT_LIMIT_VAL 150
#endif
#ifdef RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES // reacts to keypresses
// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
// # define DISABLE_RGB_MATRIX_ALPHAS_MODS
# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
# define DISABLE_RGB_MATRIX_BREATHING
# 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_DUAL
# define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
# define DISABLE_RGB_MATRIX_DUAL_BEACON
# define DISABLE_RGB_MATRIX_RAINBOW_BEACON
# define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
// # define DISABLE_RGB_MATRIX_RAINDROPS
// # define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
// # define DISABLE_RGB_MATRIX_TYPING_HEATMAP
// # define DISABLE_RGB_MATRIX_DIGITAL_RAIN
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
# define DISABLE_RGB_MATRIX_SPLASH
// # define DISABLE_RGB_MATRIX_MULTISPLASH
# define DISABLE_RGB_MATRIX_SOLID_SPLASH
# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
// # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
// # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255
# define RGB_MATRIX_HUE_STEP 8
# define RGB_MATRIX_SAT_STEP 8
# define RGB_MATRIX_VAL_STEP 5
# define RGB_MATRIX_SPD_STEP 10
#endif
#ifdef AUDIO_ENABLE
@ -92,4 +70,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define OLED_FONT_WIDTH 5
// #define OLED_FONT_HEIGHT 7
#define OLED_DISABLE_TIMEOUT
#define TAPPING_TERM_PER_KEY

View File

@ -9,10 +9,9 @@ extern uint8_t is_master;
extern rgblight_config_t rgblight_config;
#endif
enum crkbd_keycodes {
RGBRST = NEW_SAFE_RANGE
};
enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE };
// clang-format off
#define LAYOUT_crkbd_base( \
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
@ -103,60 +102,30 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, KC_NUKE, _______, _______, TG_MODS, _______
)
};
void matrix_init_keymap(void) {
#ifndef CONVERT_TO_PROTON_C
setPinOutput(D5);
writePinHigh(D5);
setPinOutput(B0);
writePinHigh(B0);
#endif
}
// clang-format on
#ifdef OLED_DRIVER_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (is_master) {
return OLED_ROTATION_270;
} else {
return rotation;
}
}
oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; }
uint16_t oled_timer;
void render_crkbd_logo(void) {
static const char PROGMEM crkbd_logo[] = {
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
0};
oled_write_P(crkbd_logo, false);
}
#define KEYLOG_LEN (int)(32 / OLED_FONT_WIDTH)
char keylog_str[KEYLOG_LEN] = {};
char keylog_str[5] = {};
uint8_t keylogs_str_idx = 0;
uint16_t log_timer = 0;
const char code_to_name[60] = {
' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\',
'#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '};
const char code_to_name[60] = {' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '};
void add_keylog(uint16_t keycode) {
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) ||
(keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { keycode = keycode & 0xFF; }
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
keycode = keycode & 0xFF;
}
for (uint8_t i = KEYLOG_LEN - 1; i > 0; i--) {
for (uint8_t i = 4; i > 0; i--) {
keylog_str[i] = keylog_str[i - 1];
}
if (keycode < 60) {
keylog_str[0] = code_to_name[keycode];
}
keylog_str[KEYLOG_LEN] = 0;
keylog_str[5] = 0;
log_timer = timer_read();
}
@ -167,94 +136,153 @@ void update_log(void) {
}
}
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { add_keylog(keycode); }
if (record->event.pressed) {
add_keylog(keycode);
oled_timer = timer_read();
}
return true;
}
void render_status(void) {
oled_write_P(PSTR("Layer"), false);
switch (biton32(layer_state)) {
case 0:
oled_write_P(PSTR("Base "), false);
break;
case _RAISE:
oled_write_P(PSTR("Raise"), false);
break;
case _LOWER:
oled_write_P(PSTR("Lower"), false);
break;
case _ADJUST:
oled_write_P(PSTR("Adjst"), false);
break;
default:
oled_write_P(PSTR("Unkn "), false);
break;
void render_rgb_status(void) {
oled_write_ln("RGB:", false);
static char temp[20] = {0};
snprintf(temp, sizeof(temp) + 1, "M:%3dH:%3dS:%3dV:%3d", rgb_matrix_config.mode, rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
oled_write(temp, false);
}
oled_write_P(PSTR("Lyout"), false);
void render_status_main(void) {
/* Show Keyboard Layout */
oled_write("Lyout", false);
switch (biton32(default_layer_state)) {
case _QWERTY:
oled_write_P(PSTR("QWRTY"), false);
oled_write(" QRTY", false);
break;
case _COLEMAK:
oled_write_P(PSTR("COLMK"), false);
oled_write(" COLE", false);
break;
case _DVORAK:
oled_write_P(PSTR("DVRAK"), false);
oled_write(" DVRK", false);
break;
case _WORKMAN:
oled_write_P(PSTR("WRKMN"), false);
oled_write(" WKMN", false);
break;
case _NORMAN:
oled_write_P(PSTR("NORMN"), false);
oled_write(" NORM", false);
break;
case _MALTRON:
oled_write_P(PSTR("MLTRN"), false);
oled_write(" MLTN", false);
break;
case _EUCALYN:
oled_write_P(PSTR("ECLYN"), false);
oled_write(" ECLN", false);
break;
case _CARPLAX:
oled_write_P(PSTR("CRPLX"), false);
oled_write(" CRPX", false);
break;
}
uint8_t modifiers = get_mods();
uint8_t one_shot = get_oneshot_mods();
oled_write_P(PSTR("Mods:"), false);
oled_write_P( (modifiers & MOD_MASK_SHIFT || one_shot & MOD_MASK_SHIFT) ? PSTR(" SFT ") : PSTR(" "), false);
oled_write_P( (modifiers & MOD_MASK_CTRL || one_shot & MOD_MASK_CTRL ) ? PSTR(" CTL ") : PSTR(" "), false);
oled_write_P( (modifiers & MOD_MASK_ALT || one_shot & MOD_MASK_ALT ) ? PSTR(" ALT ") : PSTR(" "), false);
oled_write_P( (modifiers & MOD_MASK_GUI || one_shot & MOD_MASK_GUI ) ? PSTR(" GUI ") : PSTR(" "), false);
oled_write_P(PSTR("BTMGK"), false);
if (keymap_config.swap_lalt_lgui) {
oled_write_P(PSTR(" Mac "), false);
} else {
oled_write_P(PSTR(" Win "), false);
}
/* Show Lock Status (only work on master side) */
uint8_t led_usb_state = host_keyboard_leds();
oled_write_P(PSTR("Lock:"), false);
oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR(" NUM ") : PSTR(" "), false);
oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR(" CAPS") : PSTR(" "), false);
oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR(" SCRL") : PSTR(" "), false);
oled_write("Lock:", false);
oled_write(" ", false);
oled_write_ln("NUM", led_usb_state & (1 << USB_LED_NUM_LOCK));
oled_write(" ", false);
oled_write("CAPS", led_usb_state & (1 << USB_LED_CAPS_LOCK));
oled_write(" ", false);
oled_write("SCRL", led_usb_state & (1 << USB_LED_SCROLL_LOCK));
/* Show Alt-Gui Swap options */
oled_write("BTMGK", false);
oled_write(" ", false);
oled_write_ln("Win", !keymap_config.swap_lalt_lgui);
oled_write(" ", false);
oled_write_ln("Mac", keymap_config.swap_lalt_lgui);
# if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
/* Show RGB Options */
render_rgb_status();
# endif
oled_write(keylog_str, false);
}
void render_status_secondary(void) {
/* Show Keyboard Layout */
oled_write("Lyout", false);
switch (biton32(default_layer_state)) {
case _QWERTY:
oled_write(" QRTY", false);
break;
case _COLEMAK:
oled_write(" COLE", false);
break;
case _DVORAK:
oled_write(" DVRK", false);
break;
case _WORKMAN:
oled_write(" WKMN", false);
break;
case _NORMAN:
oled_write(" NORM", false);
break;
case _MALTRON:
oled_write(" MLTN", false);
break;
case _EUCALYN:
oled_write(" ECLN", false);
break;
case _CARPLAX:
oled_write(" CRPX", false);
break;
}
/* Show Activate layer */
oled_write("Layer", false);
switch (biton32(layer_state)) {
case _RAISE:
oled_write("Raise", false);
break;
case _LOWER:
oled_write("Lower", false);
break;
case _ADJUST:
oled_write("Adjst", false);
break;
default:
oled_write("Dflt ", false);
break;
}
/* Show Mod */
uint8_t modifiers = get_mods() | get_oneshot_mods();
oled_write("Mods:", false);
oled_write(" ", false);
oled_write_ln("SFT", (modifiers & MOD_MASK_SHIFT));
oled_write(" ", false);
oled_write_ln("CTL", (modifiers & MOD_MASK_CTRL));
oled_write(" ", false);
oled_write_ln("ALT", (modifiers & MOD_MASK_ALT));
oled_write(" ", false);
oled_write_ln("GUI", (modifiers & MOD_MASK_GUI));
# if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
render_rgb_status();
# endif
/* Show logged Keys */
oled_write(keylog_str, false);
}
void oled_task_user(void) {
if (timer_elapsed(oled_timer) > 60000) {
oled_off();
return;
}
if (is_master) {
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
} else {
render_crkbd_logo();
oled_scroll_left(); // Turns on scrolling
render_status_secondary();
}
}
@ -272,14 +300,25 @@ uint16_t get_tapping_term(uint16_t keycode) {
#ifdef RGB_MATRIX_ENABLE
static bool is_suspended;
static bool rgb_matrix_enabled;
void suspend_power_down_keymap(void) {
rgb_matrix_set_suspend_state(true);
if (!is_suspended) {
is_suspended = true;
rgb_matrix_enabled = (bool)rgb_matrix_config.enable;
rgb_matrix_disable_noeeprom();
}
}
void suspend_wakeup_init_keymap(void) {
rgb_matrix_set_suspend_state(false);
is_suspended = false;
if (rgb_matrix_enabled) {
rgb_matrix_enable_noeeprom();
}
}
void rgb_matrix_indicators_user(void) {
if (userspace_config.rgb_layer_change &&
# ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
@ -292,36 +331,50 @@ void rgb_matrix_indicators_user(void) {
# endif
) {
switch (biton32(layer_state)) {
case _MODS:
rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_UNDERGLOW); break;
case _GAMEPAD:
rgb_matrix_layer_helper(0xFF, 0x80, 0x00, LED_FLAG_UNDERGLOW); break;
rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
case _DIABLO:
rgb_matrix_layer_helper(0xFF, 0x00, 0x00, LED_FLAG_UNDERGLOW); break;
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
case _RAISE:
rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_UNDERGLOW); break;
rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
case _LOWER:
rgb_matrix_layer_helper(0x00, 0xFF, 0x00, LED_FLAG_UNDERGLOW); break;
rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
case _ADJUST:
rgb_matrix_layer_helper(0xFF, 0x00, 0x00, LED_FLAG_UNDERGLOW); break;
default:
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
default: {
bool mods_enabled = IS_LAYER_ON(_MODS);
switch (biton32(default_layer_state)) {
case _QWERTY:
rgb_matrix_layer_helper(0x00, 0xFF, 0xFF, LED_FLAG_UNDERGLOW); break;
rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
case _COLEMAK:
rgb_matrix_layer_helper(0xFF, 0x00, 0xFF, LED_FLAG_UNDERGLOW); break;
rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
case _DVORAK:
rgb_matrix_layer_helper(0x00, 0xFF, 0x00, LED_FLAG_UNDERGLOW); break;
rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
case _WORKMAN:
rgb_matrix_layer_helper(0xD9, 0xA5, 0x21, LED_FLAG_UNDERGLOW); break;
rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
case _NORMAN:
rgb_matrix_layer_helper(0xFF, 0x7C, 0x4D, LED_FLAG_UNDERGLOW); break;
rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
case _MALTRON:
rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_UNDERGLOW); break;
rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
case _EUCALYN:
rgb_matrix_layer_helper(0xFF, 0x80, 0xBF, LED_FLAG_UNDERGLOW); break;
rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
case _CARPLAX:
rgb_matrix_layer_helper(0x00, 0x00, 0xFF, LED_FLAG_UNDERGLOW); break;
rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW);
break;
}
break;
}
}
}

View File

@ -16,7 +16,6 @@ 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
RGBLIGHT_STARTUP_ANIMATION = yes
RGB_MATRIX_ENABLE = WS2812
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
@ -25,7 +24,3 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
BOOTLOADER = qmk-dfu
OLED_DRIVER_ENABLE = yes
ifneq ($(strip $(OLED_DRIVER_ENABLE)), yes)
RGB_MATRIX_SPLIT_RIGHT=yes
endif

View File

@ -9,7 +9,7 @@
#include QMK_KEYBOARD_H
#include "drashna.h"
// clang-format off
#define LAYOUT_gergo_base( \
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
@ -111,3 +111,4 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
*/
// clang-format on

View File

@ -19,8 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Use I2C or Serial, not both */
// #define USE_SERIAL
#define USE_I2C
#define USE_SERIAL
// #define USE_I2C
/* Select hand configuration */
@ -31,10 +31,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef RGBLIGHT_ENABLE
# undef RGBLED_NUM
# define RGBLED_NUM 18 // Number of LEDs
# undef RGBLED_SPLIT
# define RGBLED_SPLIT { 9, 9 }
# define RGBLIGHT_HUE_STEP 12
# define RGBLIGHT_SAT_STEP 12
# define RGBLIGHT_VAL_STEP 12
# define RGBLIGHT_HUE_STEP 8
# define RGBLIGHT_SAT_STEP 8
# define RGBLIGHT_VAL_STEP 8
# define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2
# define RGBLIGHT_EFFECT_SNAKE_LENGTH 2
@ -48,14 +49,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# endif // RGBLIGHT_ENABLE
#endif // AUDIO_ENABLE
#ifndef KEYBOARD_keebio_iris_rev3
# define QMK_ESC_OUTPUT F6 // usually COL
# define QMK_ESC_INPUT D7 // usually ROW
# define QMK_LED B0
# define QMK_SPEAKER C6
#endif
#undef PRODUCT
#ifdef KEYBOARD_keebio_iris_rev2
# define PRODUCT Drashna Hacked Iris Rev .2
#elif defined(KEYBOARD_keebio_iris_rev3)
# define PRODUCT Drashna Hacked Iris Rev .3
#endif
#define SHFT_LED1 6

View File

@ -2,7 +2,7 @@
#include QMK_KEYBOARD_H
#include "drashna.h"
// clang-format off
#define LAYOUT_iris_base( \
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
@ -110,7 +110,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
// clang-format on
void matrix_init_keymap(void) {
#ifndef CONVERT_TO_PROTON_C
@ -122,7 +122,6 @@ void matrix_init_keymap(void) {
#endif
}
void keyboard_post_init_keymap(void) {
#if BACKLIGHT_ENABLE
backlight_enable();

View File

@ -14,6 +14,6 @@ SPACE_CADET_ENABLE = no
INDICATOR_LIGHTS = no
MACROS_ENABLED = no
RGBLIGHT_TWINKLE = no
RGBLIGHT_STARTUP_ANIMATION = yes
RGBLIGHT_STARTUP_ANIMATION = no
BOOTLOADER = qmk-dfu

View File

@ -30,7 +30,7 @@ uint8_t last_led;
uint8_t last_osm;
#endif
// clang-format off
#define LAYOUT_orthodox_base( \
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
@ -121,6 +121,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
// clang-format on
void matrix_init_keymap(void) {
#ifndef CONVERT_TO_PROTON_C

View File

@ -26,13 +26,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
extern userspace_config_t userspace_config;
enum more_custom_keycodes {
KC_SWAP_NUM = NEW_SAFE_RANGE
};
enum more_custom_keycodes { KC_SWAP_NUM = NEW_SAFE_RANGE };
// define layer change stuff for underglow indicator
bool skip_leds = false;
// clang-format off
#define LAYOUT_ergodox_pretty_base( \
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
@ -301,9 +300,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
// clang-format on
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_1:
if (IS_LAYER_ON(_GAMEPAD) && userspace_config.swapped_numbers) {
@ -372,12 +371,9 @@ void matrix_scan_keymap(void) { // runs frequently to update info
ergodox_right_led_3_on();
ergodox_right_led_3_set(10);
}
}
}
bool indicator_is_this_led_used_keyboard(uint8_t index) {
switch (index) {
case 13 ... 14:
@ -388,16 +384,11 @@ bool indicator_is_this_led_used_keyboard(uint8_t index) {
}
}
#ifdef RGB_MATRIX_ENABLE
void suspend_power_down_keymap(void) {
rgb_matrix_set_suspend_state(true);
}
void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); }
void suspend_wakeup_init_keymap(void) {
rgb_matrix_set_suspend_state(false);
}
void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); }
void rgb_matrix_indicators_user(void) {
if (userspace_config.rgb_layer_change &&
@ -411,10 +402,8 @@ void rgb_matrix_indicators_user(void) {
# endif
) {
switch (biton32(layer_state)) {
case _MODS:
rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
case _GAMEPAD:
rgb_matrix_layer_helper(0xFF, 0x80, 0x00, LED_FLAG_MODIFIER);
rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
rgb_matrix_set_color(32, 0x00, 0xFF, 0x00); // Q
rgb_matrix_set_color(31, 0x00, 0xFF, 0xFF); // W
rgb_matrix_set_color(30, 0xFF, 0x00, 0x00); // E
@ -427,34 +416,48 @@ void rgb_matrix_indicators_user(void) {
rgb_matrix_set_color(userspace_config.swapped_numbers ? 27 : 26, 0xFF, 0xFF, 0xFF); // 1
rgb_matrix_set_color(userspace_config.swapped_numbers ? 26 : 27, 0x00, 0xFF, 0x00); // 2
rgb_matrix_set_color(25, 0x7A, 0x00, 0xFF); // 3
break;
case _DIABLO:
rgb_matrix_layer_helper(0xFF, 0x00, 0x00, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER);
break;
case _RAISE:
rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _LOWER:
rgb_matrix_layer_helper(0x00, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _ADJUST:
rgb_matrix_layer_helper(0xFF, 0x00, 0x00, LED_FLAG_MODIFIER); break;
default:
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
default: {
bool mods_enabled = IS_LAYER_ON(_MODS);
switch (biton32(default_layer_state)) {
case _QWERTY:
rgb_matrix_layer_helper(0x00, 0xFF, 0xFF, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _COLEMAK:
rgb_matrix_layer_helper(0xFF, 0x00, 0xFF, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _DVORAK:
rgb_matrix_layer_helper(0x00, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _WORKMAN:
rgb_matrix_layer_helper(0xD9, 0xA5, 0x21, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _NORMAN:
rgb_matrix_layer_helper(0xFF, 0x7C, 0x4D, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _MALTRON:
rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _EUCALYN:
rgb_matrix_layer_helper(0xFF, 0x80, 0xBF, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _CARPLAX:
rgb_matrix_layer_helper(0x00, 0x00, 0xFF, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
}
break;
}
}
}

View File

@ -17,4 +17,4 @@ RGBLIGHT_TWINKLE = no
INDICATOR_LIGHTS = no
RGBLIGHT_STARTUP_ANIMATION = yes
DEBOUNCE_TYPE = eager_pk
DEBOUNCE_TYPE = eager_pr

View File

@ -4,25 +4,3 @@
#undef PRODUCT
#define PRODUCT DrashnaDox - Hacked ErgoDox EZ Glow
#ifdef RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot)
// #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened)
// #define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
# define RGB_DISABLE_WHEN_USB_SUSPENDED true// turn off effects when suspended
// #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
# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
# define DISABLE_RGB_MATRIX_CYCLE_ALL
# define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
# define DISABLE_RGB_MATRIX_DUAL_BEACON
# define DISABLE_RGB_MATRIX_RAINBOW_BEACON
# define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
# define DISABLE_RGB_MATRIX_DIGITAL_RAIN
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
#endif

View File

@ -9,5 +9,5 @@ SRC += $(CORRECTED_LAYOUT)/keymap.c
ifneq (,$(findstring ergodox_ez,$(KEYBOARD)))
RGBLIGHT_ENABLE = no
RGB_MATRIX_ENABLE = yes
TAP_DANCE_ENABLE = no
# TAP_DANCE_ENABLE = no
endif

View File

@ -3,6 +3,7 @@
#define F2_MCRO LT(_GAMEPAD, KC_F2)
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_NUMLOCK] = LAYOUT_numpad_5x6(
KC_F1, F2_MCRO, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
@ -20,3 +21,4 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
RGB_VAI, RGB_VAD, _______, _______, _______
),
};
// clang-format on

View File

@ -1,6 +1,5 @@
#pragma once
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLED_NUM)
# define RGB_DI_PIN B3
# define RGBLED_NUM 13 // Number of LEDs
@ -21,9 +20,6 @@
// #define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
// #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 RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
# ifndef KEYBOARD_planck_ez
# define EECONFIG_RGB_MATRIX (uint32_t *)15
# endif
#endif
#if defined(KEYBOARD_lets_split_rev2)
@ -38,14 +34,13 @@
# endif // RGBLIGHT_ENABLE
#endif // KEYBOARD_planck_light
#if defined(KEYBOARD_planck)
# undef PRODUCT
# if defined(KEYBOARD_planck_light)
# define PRODUCT Drashna Hacked RGB Beacon(Planck Light)
# elif defined(KEYBOARD_planck_rev6)
# define PRODUCT Drashna Hacked Planck Rev6
# elif defined(KEYBOARD_planck_EZ)
# elif defined(KEYBOARD_planck_ez)
# define PRODUCT Drashna Hacked Planck EZ
# endif
#endif

View File

@ -21,7 +21,6 @@
extern rgblight_config_t rgblight_config;
#endif
#ifdef BACKLIGHT_ENABLE
enum planck_keycodes {
BACKLIT = NEW_SAFE_RANGE,
@ -42,6 +41,7 @@ enum planck_keycodes {
# define PLNK_4 ET_RAIS
#endif
// clang-format off
#define LAYOUT_ortho_4x12_base( \
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
@ -135,7 +135,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
// clang-format on
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
@ -172,6 +172,7 @@ bool music_mask_user(uint16_t keycode) {
#ifdef RGB_MATRIX_ENABLE
// clang-format off
void suspend_power_down_keymap(void) {
rgb_matrix_set_suspend_state(true);
}
@ -179,6 +180,7 @@ void suspend_power_down_keymap(void) {
void suspend_wakeup_init_keymap(void) {
rgb_matrix_set_suspend_state(false);
}
// clang-format on
void rgb_matrix_indicators_user(void) {
uint8_t this_mod = get_mods();
@ -200,43 +202,67 @@ void rgb_matrix_indicators_user(void) {
# endif
) {
switch (biton32(layer_state)) {
case _GAMEPAD:
rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _DIABLO:
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER);
break;
case _RAISE:
rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _LOWER:
rgb_matrix_layer_helper(0x00, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _ADJUST:
rgb_matrix_layer_helper(0xFF, 0x00, 0x00, LED_FLAG_MODIFIER); break;
default:
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
default: {
bool mods_enabled = IS_LAYER_ON(_MODS);
switch (biton32(default_layer_state)) {
case _QWERTY:
rgb_matrix_layer_helper(0x00, 0xFF, 0xFF, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _COLEMAK:
rgb_matrix_layer_helper(0xFF, 0x00, 0xFF, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _DVORAK:
rgb_matrix_layer_helper(0x00, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _WORKMAN:
rgb_matrix_layer_helper(0xD9, 0xA5, 0x21, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _NORMAN:
rgb_matrix_layer_helper(0xFF, 0x7C, 0x4D, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _MALTRON:
rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _EUCALYN:
rgb_matrix_layer_helper(0xFF, 0x80, 0xBF, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _CARPLAX:
rgb_matrix_layer_helper(0x00, 0x00, 0xFF, LED_FLAG_MODIFIER); break;
rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
}
break;
}
}
}
switch (biton32(default_layer_state)) {
case _QWERTY:
rgb_matrix_set_color(is_ez ? 41 : 42, 0x00, 0xFF, 0xFF); break;
rgb_matrix_set_color(is_ez ? 41 : 42, 0x00, 0xFF, 0xFF);
break;
case _COLEMAK:
rgb_matrix_set_color(is_ez ? 41 : 42, 0xFF, 0x00, 0xFF); break;
rgb_matrix_set_color(is_ez ? 41 : 42, 0xFF, 0x00, 0xFF);
break;
case _DVORAK:
rgb_matrix_set_color(is_ez ? 41 : 42, 0x00, 0xFF, 0x00); break;
rgb_matrix_set_color(is_ez ? 41 : 42, 0x00, 0xFF, 0x00);
break;
case _WORKMAN:
rgb_matrix_set_color(is_ez ? 41 : 42, 0xD9, 0xA5, 0x21); break;
rgb_matrix_set_color(is_ez ? 41 : 42, 0xD9, 0xA5, 0x21);
break;
}
if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) {
rgb_matrix_set_color(24, 0x00, 0xFF, 0x00);
@ -246,7 +272,6 @@ void rgb_matrix_indicators_user(void) {
rgb_matrix_set_color(25, 0xFF, 0x00, 0x00);
rgb_matrix_set_color(34, 0xFF, 0x00, 0x00);
rgb_matrix_set_color(37, 0xFF, 0x00, 0x00);
}
if ((this_mod | this_osm) & MOD_MASK_GUI) {
rgb_matrix_set_color(39, 0xFF, 0xD9, 0x00);
@ -280,7 +305,7 @@ void encoder_update(bool clockwise) {
break;
case _LOWER:
# ifdef RGB_MATRIX_ENABLE
clockwise ? rgb_matrix_step() : rgblight_step_reverse();
clockwise ? rgb_matrix_step() : rgb_matrix_step_reverse();
# else
clockwise ? tap_code(KC_PGDN) : tap_code(KC_PGUP);
# endif
@ -303,10 +328,18 @@ void encoder_update(bool clockwise) {
void dip_update(uint8_t index, bool active) {
switch (index) {
case 0:
if(active) { audio_on(); } else { audio_off(); }
if (active) {
audio_on();
} else {
audio_off();
}
break;
case 1:
if(active) { clicky_on(); } else { clicky_off(); }
if (active) {
clicky_on();
} else {
clicky_off();
}
break;
case 2:
keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = active;
@ -320,7 +353,6 @@ void dip_update(uint8_t index, bool active) {
#ifdef KEYBOARD_planck_ez
layer_state_t layer_state_set_keymap(layer_state_t state) {
palClearPad(GPIOB, 8);
palClearPad(GPIOB, 9);
switch (biton32(state)) {

View File

@ -21,7 +21,7 @@ endif
ifneq (,$(findstring planck/ez,$(KEYBOARD))) # Make sure it IS the Planck Light
RGBLIGHT_ENABLE = no
# SERIAL_LINK_ENABLE = yes
ENCODER_ENABLE = no
ENCODER_ENABLE = yes
RGB_MATRIX_ENABLE = IS31FL3737
INDICATOR_LIGHTS = yes
RGBLIGHT_TWINKLE = yes

View File

@ -1,6 +1,5 @@
#pragma once
/* ws2812 RGB LED */
#if defined(KEYBOARD_fractal)
# define RGB_DI_PIN D2
@ -18,4 +17,6 @@
# define RGBLIGHT_EFFECT_KNIGHT_OFFSET 3
# define RGBLIGHT_EFFECT_KNIGHT_LED_NUM 14
# define B7_AUDIO
# define NO_MUSIC_MODE
#endif

View File

@ -19,6 +19,7 @@
#include QMK_KEYBOARD_H
#include "drashna.h"
// clang-format off
#define LAYOUT_ortho_5x12_base( \
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
@ -135,22 +136,5 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, TG_MODS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)
};
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
}
return true;
};
void matrix_init_keymap(void) {
#ifdef KEYBOARD_fractal
setPinOutput(D5);
writePinHigh(D5);
setPinOutput(B0);
writePinHigh(B0);
#endif
}
// clang-format on

View File

@ -7,7 +7,7 @@ TAP_DANCE_ENABLE = no
AUDIO_ENABLE = yes
ifneq (,$(findstring fractal,$(KEYBOARD))) # Make sure it IS the Planck Light
RGB_MATRIX_ENABLE = no
AUDIO_ENABLE = no
AUDIO_ENABLE = yes
RGBLIGHT_ENABLE = yes
RGBLIGHT_TWINKLE = yes
BOOTLOADER = qmk-dfu

View File

@ -1,15 +1,17 @@
#pragma once
#ifdef AUDIO_ENABLE
# if __GNUC__ > 7
# 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)
# define GOODBYE_SONG SONG(SONIC_RING)
# define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
SONG(COLEMAK_SOUND), \
SONG(DVORAK_SOUND), \
SONG(OVERWATCH_THEME) \
}
# define DEFAULT_LAYER_SONGS \
{ SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(OVERWATCH_THEME) }
# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f
@ -18,7 +20,6 @@
# define UNICODE_SONG_WIN SONG(RICK_ROLL)
# define UNICODE_SONG_BSD SONG(RICK_ROLL)
# define UNICODE_SONG_WINC SONG(RICK_ROLL)
#endif // !AUDIO_ENABLE
#ifdef RGBLIGHT_ENABLE
@ -29,6 +30,55 @@
# define RGBLIGHT_EFFECT_KNIGHT
#endif // RGBLIGHT_ENABLE
#ifdef RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot)
// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened)
# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
// # 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__)
# define DISABLE_RGB_MATRIX_ALPHAS_MODS
# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
# define DISABLE_RGB_MATRIX_BREATHING
# define DISABLE_RGB_MATRIX_BAND_SAT
# define DISABLE_RGB_MATRIX_BAND_VAL
# define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
# define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
# define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
# define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
# 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_DUAL
# define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
# define DISABLE_RGB_MATRIX_DUAL_BEACON
# define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
# define DISABLE_RGB_MATRIX_CYCLE_SPIRAL
# define DISABLE_RGB_MATRIX_RAINBOW_BEACON
# define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
# define DISABLE_RGB_MATRIX_RAINDROPS
# define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
// # define DISABLE_RGB_MATRIX_TYPING_HEATMAP
# define DISABLE_RGB_MATRIX_DIGITAL_RAIN
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
# define DISABLE_RGB_MATRIX_SPLASH
# define DISABLE_RGB_MATRIX_MULTISPLASH
# define DISABLE_RGB_MATRIX_SOLID_SPLASH
# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
# endif // AVR
#endif // RGB_MATRIX_ENABLE
#ifndef ONESHOT_TAP_TOGGLE
# define ONESHOT_TAP_TOGGLE 2
#endif // !ONESHOT_TAP_TOGGLE
@ -41,8 +91,6 @@
# define QMK_KEYS_PER_SCAN 4
#endif // !QMK_KEYS_PER_SCAN
// this makes it possible to do rolling combos (zx) with keys that
// convert to other keys on hold (z becomes ctrl when you hold it,
// and when this option isn't enabled, z rapidly followed by x
@ -69,7 +117,6 @@
# define TAPPING_TERM 175
#endif
#define TAP_CODE_DELAY 5
/* Disable unused and unneeded features to reduce on firmware size */

View File

@ -25,7 +25,6 @@ userspace_config_t userspace_config;
# define DRASHNA_UNICODE_MODE 2
#endif
// This block is for all of the gaming macros, as they were all doing
// the same thing, but with differring text sent.
bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
@ -161,7 +160,6 @@ void suspend_wakeup_init_user(void) {
suspend_wakeup_init_keymap();
}
__attribute__((weak))
void matrix_scan_keymap(void) {}
@ -185,11 +183,8 @@ void matrix_scan_user(void) {
matrix_scan_keymap();
}
__attribute__((weak))
layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}
layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
// on layer change, no matter where the change was initiated
// Then runs keymap's layer change check
@ -201,11 +196,8 @@ layer_state_t layer_state_set_user(layer_state_t state) {
return layer_state_set_keymap(state);
}
__attribute__((weak))
layer_state_t default_layer_state_set_keymap (layer_state_t state) {
return state;
}
layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; }
// Runs state check and changes underglow color and animation
layer_state_t default_layer_state_set_user(layer_state_t state) {
@ -241,4 +233,6 @@ void eeconfig_init_user(void) {
#else
eeprom_update_byte(EECONFIG_UNICODEMODE, DRASHNA_UNICODE_MODE);
#endif
eeconfig_init_keymap();
keyboard_init();
}

View File

@ -27,11 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
# include "rgb_stuff.h"
#endif
#if defined(AUDIO_ENABLE) && __GNUC__ > 7
# if __has_include("drashna_song_list.h")
# include "drashna_song_list.h"
# endif
#endif
/* Define layer names */
enum userspace_layers {
@ -58,7 +53,6 @@ enum userspace_layers {
define modifiers here, since MOD_* doesn't seem to work for these
*/
bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed);
bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
bool send_game_macro(const char *str, keyrecord_t *record, bool override);
@ -85,7 +79,6 @@ typedef union {
extern userspace_config_t userspace_config;
/*
Custom Keycodes for Diablo 3 layer
But since TD() doesn't work when tap dance is disabled

View File

@ -3,19 +3,14 @@
uint16_t copy_paste_timer;
__attribute__((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
__attribute__((weak))
bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
return true;
}
bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; }
// Defines actions tor my global custom keycodes. Defined in drashna.h file
// Then runs the _keymap's record handier if not processed here
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// If console is enabled, it will print the matrix position and status of each key pressed
#ifdef KEYLOGGER_ENABLE
# if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_keebio_iris_rev2)
@ -36,7 +31,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!record->event.pressed) {
uint8_t temp_mod = get_mods();
uint8_t temp_osm = get_oneshot_mods();
clear_mods(); clear_oneshot_mods();
clear_mods();
clear_oneshot_mods();
send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), TAP_CODE_DELAY);
#ifndef MAKE_BOOTLOADER
if ((temp_mod | temp_osm) & MOD_MASK_SHIFT)
@ -52,9 +48,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
send_string_with_delay_P(PSTR(":avrdude"), TAP_CODE_DELAY);
#endif // bootloader options
}
if ( ( temp_mod | temp_osm ) & MOD_MASK_CTRL) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), TAP_CODE_DELAY); }
if ((temp_mod | temp_osm) & MOD_MASK_CTRL) {
send_string_with_delay_P(PSTR(" -j8 --output-sync"), TAP_CODE_DELAY);
}
#ifdef RGB_MATRIX_SPLIT_RIGHT
send_string_with_delay_P(PSTR(" RGB_MATRIX_SPLIT_RIGHT=yes OLED_DRIVER_ENABLE=no"), TAP_CODE_DELAY);
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);
}
@ -72,7 +73,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// to save on firmware space, since it's limited.
#ifdef MACROS_ENABLED
case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros
if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeconfig_update_user(userspace_config.raw); }
if (record->event.pressed) {
userspace_config.is_overwatch ^= 1;
eeconfig_update_user(userspace_config.raw);
}
# ifdef RGBLIGHT_ENABLE
userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18);
# endif // RGBLIGHT_ENABLE
@ -102,19 +106,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!", record, false);
#endif // MACROS_ENABLED
case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them
#ifdef TAP_DANCE_ENABLE
if (record->event.pressed) {
uint8_t dtime;
for (dtime = 0; dtime < 4; dtime++) {
diablo_timer[dtime].key_time = diablo_times[0];
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();

View File

@ -49,8 +49,6 @@ enum userspace_custom_keycodes {
bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
#define ADJUST MO(_ADJUST)

View File

@ -2,192 +2,14 @@
This is my personal userspace file. Most of my code exists here, as it's heavily shared.
## Custom userspace handlers
* [RGB Customization](readme_rgb.md)
* [Diablo Tap Dancing](readme_tap_dance.md)
* [Keymap Wrappers](readme_wrappers.md)
* [Custom Function Handlers](readme_handlers.md)
* [Secret Macros](readme_secrets.md)
* [Custom Keycodes](readme_keycodes.md)
Specifically QMK works by using customized handlers for everything. This allows for multiple levels of customization.
`matrix_scan` calls `matrix_scan_quantum`, which alls `matrix_scan_kb`, which calls `matrix_scan_user`.
`process_record` calls a bunch of stuff, but eventually calls `process_record_kb` which calls `process_record_user`
The same goes for `matrix_init`, `layer_state_set`, `led_set`, and a few other functions.
All (most) `_user` functions are handled here instead. To allow keyboard specific configuration, I've created `_keymap` functions that can be called by the keymap.c files instead.
This allows for keyboard specific configuration while maintaining the ability to customize the board.
My [Ergodox EZ Keymap](https://github.com/qmk/qmk_firmware/blob/master/layouts/community/ergodox/drashna/keymap.c#L297) is a good example of this, as it uses the LEDs as modifier indicators.
## Keyboard Layout Templates
This borrows from @jola5's "Not quite neo" code. This allows me to maintain blocks of keymaps in the userspace, so that I can modify the userspace, and this is reflected in all of the keyboards that use it, at once.
This makes adding tap/hold mods, or other special keycodes or functions to all keyboards super easy, as it's done to all of them at once.
The caveat here is that the keymap needs a processor/wrapper, as it doesn't like the substitutions. However, this is as simple as just pushing it through a define. For instance:
`#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__)`
Once that's been done and you've switched the keymaps to use the "wrapper", it will read the substitution blocks just fine.
Credit goes to @jola5 for first implementing this awesome idea.
## Custom Keycodes
Keycodes are defined in the drashna.h file and need to be included in the keymap.c files, so that they can be used there.
A bunch of macros are present and are only included on boards that are not the Ergodox EZ or Orthodox, as they are not needed for those boards.
Included is a custom macro for compiling my keyboards. This includes the bootloader target (`:teensy`, `:avrdude`, or `:dfu`), and keeps RGBLIGHT, AUDIO and/or FAUXCLICKY enabled, if it previously was (regardless of the rules file).
This also includes a modified RESET keycode as well, that sets the underglow to red.
## Layer Indication
This uses the `layer_state_set_*` command to change the layer color, to indicate which layer it is on. This includes the default keymap, as well.
Since this is done via userspace, it is the same between all systems.
Additionally, there is a custom keycode to toggle layer indication. And all RGB keycodes disable layer indication by default, as well. This way, I can leave special effects doing when I want.
Also. I use `rgblight_sethsv` since it works with animation modes (that support it).
## Diablo Layer
This layer has some special handling.
When Tap Dances are enabled, this layer has the ability to "spam" keypresses.
For instance, tapping the TD "1" twice causes the layer to hit "1" ever 1 second (appoximately). This is useful for auto-hotkeying skills (such as bone armor or devour).
Tappind once disables this, and switching layers temporarily disables this, until you switch back to the layer.
For critics that think this is cheating, search "diablo 3 num lock auto cast". This is just a simpler method, since I no longer own a normal (non QMK) numpad.
## Secret Macros
With help from gitter and Colinta, this adds the ability to add hidden macros from other users.
First, I have several files that are hidden/excluded from Git/GitHub. These contain everything needed for the macros. To hide these files, open `.git/info/exclude` and add `secrets.c` and `secrets.h` to that file, below the comments.
And this requires `KC_SECRET_1` through `KC_SECRET_5` to be defined in your `<name>.h` file to define the keycodes for the new macros.
### .git/info/exclude
```
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
/users/drashna/secrets.c
/users/drashna/secrets.h
```
Then you can create these files:
### secrets.c
```c
#include "drashna.h" // replace with your keymap's "h" file, or whatever file stores the keycodes
#if (__has_include("secrets.h") && !defined(NO_SECRETS))
#include "secrets.h"
#else
// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware
// And I'm not familiar enough to know which is better or why...
static const char * const secret[] = {
"test1",
"test2",
"test3",
"test4",
"test5"
};
#endif
bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo
if (!record->event.pressed) {
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
send_string_with_delay(secret[keycode - KC_SECRET_1], MACRO_TIMER);
}
return false;
break;
}
return true;
}
```
### secrets.h
```c
static const char * const secrets[] = {
"secret1",
"secret2",
"secret3",
"secret4",
"secret5"
};
```
Replacing the strings with the codes that you need.
### name.c
In the `<name>.c` file, you will want to add this to the top:
```c
__attribute__ ((weak))
bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
return true;
}
```
This is so that the function can be called here, and replaced in the `secrets.c` file, and so it won't error out if it doesn't exist.
And then, in the `process_record_user` function, assuming you have `return process_record_keymap(keycode, record)` here, you'll want to replace the "final" return with the following. Otherwise, you want to replace the `return true;` with `return process_record_secrets(keycode, record);`
```c
return process_record_keymap(keycode, record) && process_record_secrets(keycode, record);
}
```
### rules.mk
Here, you want your `/users/<name>/rules.mk` file to "detect" the existence of the `secrets.c` file, and only add it if the file exists. To do so, add this block:
```make
ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
SRC += secrets.c
endif
```
Additionally, if you want to make sure that you can disable the function without messing with the file, you need to add this to your `/users/<name>/rules.mk`, so that it catches the flag:
```make
ifeq ($(strip $(NO_SECRETS)), yes)
OPT_DEFS += -DNO_SECRETS
endif
```
Then, if you run `make keyboard:name NO_SECRETS=yes`, it will default to the test strings in your `<name>.c` file, rather than reading from your file.
## Pro Micro Hacking
Well, you can get the QMK DFU bootloader working on the ProMicro. But you need to change fuses.
What worked to get into the firmware properly was:
```
Low: 0x5E High: 0xD9 Extended: 0xC3 Lock: 0x3F
```
The reason that there was some issues before, is that JTAG was still enabled, and using some of the pins that the keyboard uses. Disabling JTAG (either by fuse, or modifying the matrix code for splits fixes the issue).
And for reference, if you want to go back to caterina, the default fuse settings I believe were:
```
Low: 0xFF High: 0xD8 Extended: 0xC3 Lock: 0x3F
```
See [this thread](https://www.reddit.com/r/olkb/comments/8sxgzb/replace_pro_micro_bootloader_with_qmk_dfu/) for details on how to flash QMK DFU to Pro Micros.

View File

@ -0,0 +1,97 @@
# Custom Userspace Function handlers
Specifically QMK works by using customized handlers for everything. This allows for multiple levels of customization.
`matrix_scan` calls `matrix_scan_quantum`, which calls `matrix_scan_kb`, which calls `matrix_scan_user`.
`process_record` calls a bunch of stuff, but eventually calls `process_record_kb` which calls `process_record_user`
The same goes for `matrix_init`, `layer_state_set`, `led_set`, and a few other functions.
All (most) `_user` functions are handled here, in the userspace instead. To allow keyboard specific configuration, I've created `_keymap` functions that can be called by the keymap.c files instead.
This allows for keyboard specific configuration while maintaining the ability to customize the board.
My [Ergodox EZ Keymap](https://github.com/qmk/qmk_firmware/blob/master/layouts/community/ergodox/drashna/keymap.c) is a good example of this, as it uses the LEDs as modifier indicators.
But for a list:
```c
__attribute__ ((weak))
void matrix_init_keymap(void) {}
void matrix_init_user(void) {
matrix_init_keymap();
}
__attribute__((weak))
void keyboard_post_init_keymap(void){ }
void keyboard_post_init_user(void){
keyboard_post_init_keymap();
}
__attribute__ ((weak))
void matrix_scan_keymap(void) {}
void matrix_scan_user(void) {
matrix_scan_keymap();
}
__attribute__ ((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return process_record_keymap(keycode, record);
}
__attribute__ ((weak))
layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}
layer_state_t layer_state_set_user (layer_state_t state) {
return layer_state_set_keymap (state);
}
__attribute__ ((weak))
void led_set_keymap(uint8_t usb_led) {}
void led_set_user(uint8_t usb_led) {
led_set_keymap(usb_led);
}
__attribute__ ((weak))
void suspend_power_down_keymap(void) {}
void suspend_power_down_user(void) {
suspend_power_down_keymap();
}
__attribute__ ((weak))
void suspend_wakeup_init_keymap(void) {}
void suspend_wakeup_init_user(void) {
suspend_wakeup_init_keymap();
}
__attribute__ ((weak))
void shutdown_keymap(void) {}
void shutdown_user (void) {
shutdown_keymap();
}
__attribute__ ((weak))
void eeconfig_init_keymap(void) {}
void eeconfig_init_user(void) {
eeconfig_init_keymap();
}
```

View File

@ -0,0 +1,10 @@
# Custom Keycodes
Keycodes are defined in the drashna.h file and need to be included in the keymap.c files, so that they can be used there.
A bunch of macros are present and are only included on boards that are not the Ergodox EZ or Orthodox, as they are not needed for those boards.
Included is a custom macro for compiling my keyboards. This includes the bootloader target (`:teensy`, `:avrdude`, or `:dfu`), and keeps RGBLIGHT, AUDIO and/or FAUXCLICKY enabled, if it previously was (regardless of the rules file).
This also includes a modified RESET keycode as well, that sets the underglow to red.

View File

@ -0,0 +1,43 @@
# Layer Indication Code
At least for RGB Light, the `layer_state_set` function is used to detect the current highest layer, and change the underglow based on that layer.
This works for both the regular layers, and for the default layers, too.
I use the sethsv variants of the commands, so that different modes can be used, as well.
RGB Matrix uses a custom, per board implementation, at the moment.
# RGB Light Startup Animation
On startup, if enabled, the board will cycle through the entire hue wheel, starting and ending on the default layer color.
```c
void keyboard_post_init_rgb(void) {
#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_STARTUP_ANIMATION)
if (userspace_config.rgb_layer_change) { rgblight_enable_noeeprom(); }
if (rgblight_config.enable) {
layer_state_set_user(layer_state);
uint16_t old_hue = rgblight_config.hue;
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
for (uint16_t i = 255; i > 0; i--) {
rgblight_sethsv_noeeprom( ( i + old_hue) % 255, 255, 255);
matrix_scan();
wait_ms(10);
}
}
#endif
layer_state_set_user(layer_state);
}
```
This could probably benefit from some cleanup and better handling.
# RGB Light Twinkling
This enables random twinkling of the LEDs when typing.
# RGB Light Mod Indicators
Allows feedback of which mods (oneshot or otherwise) are enabled.

View File

@ -0,0 +1,123 @@
# Secret Macros
With help from gitter and Colinta, this adds the ability to add hidden macros from other users.
First, I have several files that are hidden/excluded from Git/GitHub. These contain everything needed for the macros. To hide these files, open `.git/info/exclude` and add `secrets.c` and `secrets.h` to that file, below the comments.
And this requires `KC_SECRET_1` through `KC_SECRET_5` to be added in your keycode enum (usually in your `<name>.h` file) the keycodes for the new macros.
## Git Exclusion
To prevent `git` from seeing, or committing the secret files, you can exclude them. What's the point of having secrets if they're posted on GitHub for everyone to see!?!
You can do this with the `.git/info/exclude` file, so that it's only ignored locally. Unfortunately, that means it's not consistently handled on each system.
However, if you create a `.gitignore` file in the same folder, you keep things consistent between every system that the code is checked out on.
```c
secrets.c
secrets.h
```
## secrets.c
Here is the magic. This handles including the "secrets", and adding the custom macros to send them.
```c
#include "drashna.h" // replace with your keymap's "h" file, or whatever file stores the keycodes
#if (__has_include("secrets.h") && !defined(NO_SECRETS))
#include "secrets.h"
#else
// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware
// And I'm not familiar enough to know which is better or why...
static const char * const secret[] = {
"test1",
"test2",
"test3",
"test4",
"test5"
};
#endif
bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo
if (!record->event.pressed) {
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
send_string_with_delay(secret[keycode - KC_SECRET_1], MACRO_TIMER);
}
return false;
break;
}
return true;
}
```
## secrets.h
Now, for the actual secrets! The file needs to look like
```c
static const char * secrets[] = {
"secret1",
"secret2",
"secret3",
"secret4",
"secret5"
};
```
Replacing the strings with the codes that you need.
## Process Record
In whichever file you have your `process_record_*` function in, you will want to add this to the top:
```c
__attribute__ ((weak))
bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
return true;
}
```
This is so that the function can be called here, and replaced in the `secrets.c` file, and so it won't error out if it doesn't exist.
And then, in the `process_record_user` function, assuming you have `return process_record_keymap(keycode, record)` here, you'll want to replace the "final" return with the following. Otherwise, you want to replace the `return true;` with `return process_record_secrets(keycode, record);`
```c
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// your existing macro code here.
return process_record_keymap(keycode, record) && process_record_secrets(keycode, record);
}
```
## rules.mk
Here, you want your `/users/<name>/rules.mk` file to "detect" the existence of the `secrets.c` file, and only add it if the file exists.
Additionally, to ensure that it's not added or processed in any way, it checks to see if `NO_SECRETS` is set. This way, if you run `make keyboard:name NO_SECRETS=yes`, it will remove the feature altogether.
```make
ifneq ($(strip $(NO_SECRETS)), yes)
ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
SRC += secrets.c
endif
endif
```
Alternately, if you want to make sure that you can disable the function without messing with the file, you need to add this to your `/users/<name>/rules.mk`, so that it catches the flag:
```make
ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
SRC += secrets.c
endif
ifeq ($(strip $(NO_SECRETS)), yes)
OPT_DEFS += -DNO_SECRETS
endif
```
## Extras
Additionally, because this file isn't present in the repo at all, you could add additional functionality that nobody else will see.

View File

@ -0,0 +1,119 @@
# Diablo Tap Dances
My [Tap Dance](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/tap_dances.c) file includes the tap dance declarations, and everything needed for them.
This is used for making Diablo 3 much easier to plan, especially at high rift levels.
This works by using Tap Dances. The taps don't actually "do anything". Instead, it sets up the interval for how often to send specific keypresses. As you can tell, this makes automating things very easy.
For critics that think this is cheating, just search "[diablo 3 num lock auto cast](http://lmgtfy.com/?q=diablo+3+numlock+autocast)". This is just a simpler method, that doesn't require a numpad.
## Custom Tap Dance Type
The real fun here is that the tap dances use a custom defined Tap Dance type:
```c
#define ACTION_TAP_DANCE_DIABLO(index, keycode) { \
.fn = { NULL, (void *)diablo_tapdance_master, NULL }, \
.user_data = (void *)&((diable_keys_t) { index, keycode }), \
}
```
This lets me set an index and keycode for the tap dance. This isn't the cool part yet, but this allows for the really cool stuff.
The Index is needed because I don't know how to handle it otherwise.
## The Actual Dances
These are the custom defined dances that I'm using. It sets up everything for later, using the above custom dance type.
```c
//Tap Dance Definitions, sets the index and the keycode.
qk_tap_dance_action_t tap_dance_actions[] = {
// tap once to disable, and more to enable timed micros
[TD_D3_1] = ACTION_TAP_DANCE_DIABLO(0, KC_1),
[TD_D3_2] = ACTION_TAP_DANCE_DIABLO(1, KC_2),
[TD_D3_3] = ACTION_TAP_DANCE_DIABLO(2, KC_3),
[TD_D3_4] = ACTION_TAP_DANCE_DIABLO(3, KC_4),
};
```
## Custom Data Structures
First, to get this all working, there are a couple of things that need to be set up. In a header file (or you could put it into the keymap), you need to create a couple of custom structures:
```c
typedef struct {
uint16_t timer;
uint8_t key_interval;
uint8_t keycode;
} diablo_timer_t;
typedef struct {
uint8_t index;
uint8_t keycode;
} diable_keys_t;
```
The first structure is for tracking each key that is being used. The second is to pass data from the Tap Dance action array to the actual function that we will need.
## Custom Arrays
To facilitate things, you will need a couple of arrays in your `c` file.
```c
//define diablo macro timer variables
diablo_timer_t diablo_timer[4];
// Set the default intervals. Always start with 0 so that it will disable on first hit.
// Otherwise, you will need to hit a bunch of times, or hit the "clear" command
uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
```
The first one (`diablo_timer`) is what keeps track of the timer used for the keys, the interval that it uses, and the actual keycode. This makes managing it a lot easier.
The second array is a list of predefined intervals, in seconds. You can add more here, or remove entries. It doesn't matter how long the array is, as this is computed automatically.
## The Magic - Part 1: Master function
The first part of the magic here is the `diablo_tapdance_master` function. The Tap Dance feature calls this function, directly, and passes some data to the function. Namely, it passes the array of the index and the keycode (`diablo_keys_t` from above). This sets the keycode and the interval for the specific index of `diabolo_timer` based on the number of taps. If you hit it more than the number of items in the array, then it zeroes out the interval, disabling it.
```c
// Cycle through the times for the macro, starting at 0, for disabled.
void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) {
diable_keys_t *diablo_keys = (diable_keys_t *)user_data;
// Sets the keycode based on the index
diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode;
// if the tapdance is hit more than the number of elemints in the array, reset
if (state->count >= (sizeof(diablo_times) / sizeof(uint8_t) ) ) {
diablo_timer[diablo_keys->index].key_interval = 0;
reset_tap_dance(state);
} else { // else set the interval (tapdance count starts at 1, array starts at 0, so offset by one)
diablo_timer[diablo_keys->index].key_interval = diablo_times[state->count - 1];
}
}
```
## The Magic - Part 2: The Coup de Grace
The real core here is the `run_diablo_macro_check()` function. You need to call this from `matrix_scan_user`, as this handles the timer check.
Specifically, it runs a check for each index of the timer. It checks to see if it's enabled, and if enough time has passed. If enough time has passed, it resets the timer, and will tap the keycode that you set for that index, but only if the Diablo layer is enabled.
```c
// Checks each of the 4 timers/keys to see if enough time has elapsed
void run_diablo_macro_check(void) {
for (uint8_t index = 0; index < NUM_OF_DIABLO_KEYS; index++) {
// if key_interval is 0, it's disabled, so only run if it's set. If it's set, check the timer.
if ( diablo_timer[index].key_interval && timer_elapsed( diablo_timer[index].timer ) > ( diablo_timer[index].key_interval * 1000 ) ) {
// reset the timer, since enough time has passed
diablo_timer[index].timer = timer_read();
// send keycode ONLY if we're on the diablo layer.
if (IS_LAYER_ON(_DIABLO)) {
tap_code(diablo_timer[index].keycode);
}
}
}
}
```

View File

@ -0,0 +1,11 @@
## Keyboard Layout Templates
This borrows from @jola5's "Not quite neo" code. This allows me to maintain blocks of keymaps in the userspace, so that I can modify the userspace, and this is reflected in all of the keyboards that use it, at once.
This makes adding tap/hold mods, or other special keycodes or functions to all keyboards super easy, as it's done to all of them at once.
The caveat here is that the keymap needs a processor/wrapper, as it doesn't like the substitutions. However, this is as simple as just pushing it through a define. For instance:
`#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__)`
Once that's been done and you've switched the keymaps to use the "wrapper", it will read the substitution blocks just fine.

View File

@ -8,9 +8,7 @@ bool has_initialized;
#endif
#ifdef RGBLIGHT_ENABLE
void rgblight_sethsv_default_helper(uint8_t index) {
rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, index);
}
void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, index); }
#endif // RGBLIGHT_ENABLE
#ifdef INDICATOR_LIGHTS
@ -89,8 +87,7 @@ void matrix_scan_indicator(void) {
#ifdef RGBLIGHT_TWINKLE
static rgblight_fadeout lights[RGBLED_NUM];
__attribute__ ((weak))
bool rgblight_twinkle_is_led_used_keymap(uint8_t index) { return false; }
__attribute__((weak)) bool rgblight_twinkle_is_led_used_keymap(uint8_t index) { return false; }
bool rgblight_twinkle_is_led_used(uint8_t index) {
switch (index) {
@ -146,8 +143,7 @@ void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgb
sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]);
}
light->timer = timer_read();
}
else {
} else {
if (light->enabled && biton32(layer_state) == 0) {
rgblight_sethsv_default_helper(light_index);
}
@ -161,17 +157,16 @@ void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgb
}
void start_rgb_light(void) {
uint8_t indices[RGBLED_NUM];
uint8_t indices_count = 0;
uint8_t min_life = 0xFF;
uint8_t min_life_index = -1;
for (uint8_t index = 0; index < RGBLED_NUM; ++index) {
if (rgblight_twinkle_is_led_used(index)) { continue; }
if (rgblight_twinkle_is_led_used(index)) {
continue;
}
if (lights[index].enabled) {
if (min_life_index == -1 ||
lights[index].life < min_life)
{
if (min_life_index == -1 || lights[index].life < min_life) {
min_life = lights[index].life;
min_life_index = index;
}
@ -185,8 +180,7 @@ void start_rgb_light(void) {
uint8_t light_index;
if (!indices_count) {
light_index = min_life_index;
}
else {
} else {
light_index = indices[rand() % indices_count];
}
@ -201,7 +195,6 @@ void start_rgb_light(void) {
}
#endif
bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
keycode = keycode & 0xFF;
@ -214,8 +207,11 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
case KC_KP_SLASH ... KC_KP_DOT:
case KC_F13 ... KC_F24:
case KC_AUDIO_MUTE ... KC_MEDIA_REWIND:
if (record->event.pressed) { start_rgb_light(); }
return true; break;
if (record->event.pressed) {
start_rgb_light();
}
return true;
break;
#endif // RGBLIGHT_TWINKLE
case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
@ -228,7 +224,8 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
}
}
#endif // RGBLIGHT_ENABLE
return false; break;
return false;
break;
#ifdef RGBLIGHT_ENABLE
case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
if (record->event.pressed) { // This disables layer indication, as it's assumed that if you're changing this ... you want that disabled
@ -238,17 +235,19 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
eeconfig_update_user(userspace_config.raw);
}
}
return true; break;
return true;
break;
#endif // RGBLIGHT_ENABLE
}
return true;
}
void keyboard_post_init_rgb(void) {
#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_STARTUP_ANIMATION)
if (userspace_config.rgb_layer_change) { rgblight_enable_noeeprom(); }
bool is_enabled = rgblight_config.enable;
if (userspace_config.rgb_layer_change) {
rgblight_enable_noeeprom();
}
if (rgblight_config.enable) {
layer_state_set_user(layer_state);
uint16_t old_hue = rgblight_config.hue;
@ -259,6 +258,10 @@ void keyboard_post_init_rgb(void) {
wait_ms(10);
}
}
if (!is_enabled) {
rgblight_disable_noeeprom();
}
#endif
layer_state_set_user(layer_state);
}
@ -271,10 +274,8 @@ void matrix_scan_rgb(void) {
#ifdef INDICATOR_LIGHTS
matrix_scan_indicator();
#endif
}
layer_state_t layer_state_set_rgb(layer_state_t state) {
#ifdef RGBLIGHT_ENABLE
if (userspace_config.rgb_layer_change) {
@ -310,21 +311,29 @@ layer_state_t layer_state_set_rgb(layer_state_t state) {
default: // for any other layers, or the default layer
switch (biton32(default_layer_state)) {
case _COLEMAK:
rgblight_sethsv_noeeprom_magenta(); break;
rgblight_sethsv_noeeprom_magenta();
break;
case _DVORAK:
rgblight_sethsv_noeeprom_springgreen(); break;
rgblight_sethsv_noeeprom_springgreen();
break;
case _WORKMAN:
rgblight_sethsv_noeeprom_goldenrod(); break;
rgblight_sethsv_noeeprom_goldenrod();
break;
case _NORMAN:
rgblight_sethsv_noeeprom_coral(); break;
rgblight_sethsv_noeeprom_coral();
break;
case _MALTRON:
rgblight_sethsv_noeeprom_yellow(); break;
rgblight_sethsv_noeeprom_yellow();
break;
case _EUCALYN:
rgblight_sethsv_noeeprom_pink(); break;
rgblight_sethsv_noeeprom_pink();
break;
case _CARPLAX:
rgblight_sethsv_noeeprom_blue(); break;
rgblight_sethsv_noeeprom_blue();
break;
default:
rgblight_sethsv_noeeprom_cyan(); break;
rgblight_sethsv_noeeprom_cyan();
break;
}
biton32(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it
break;
@ -336,11 +345,36 @@ layer_state_t layer_state_set_rgb(layer_state_t state) {
}
#ifdef RGB_MATRIX_ENABLE
# include "lib/lib8tion/lib8tion.h"
extern led_config_t g_led_config;
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, uint8_t led_type) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type) {
HSV hsv = {hue, sat, val};
if (hsv.v > rgb_matrix_config.hsv.v) {
hsv.v = rgb_matrix_config.hsv.v;
}
switch (mode) {
case 1: // breathing
{
uint16_t time = scale16by8(g_rgb_counters.tick, speed / 8);
hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
RGB rgb = hsv_to_rgb(hsv);
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
if (HAS_FLAGS(g_led_config.flags[i], led_type)) {
rgb_matrix_set_color( i, red, green, blue );
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
}
break;
}
default: // Solid Color
{
RGB rgb = hsv_to_rgb(hsv);
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
if (HAS_FLAGS(g_led_config.flags[i], led_type)) {
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
}
break;
}
}
}

View File

@ -20,4 +20,4 @@ layer_state_t default_layer_state_set_rgb(layer_state_t state);
void rgblight_sethsv_default_helper(uint8_t index);
void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, uint8_t led_type);
void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type);

View File

@ -2,6 +2,7 @@ SRC += drashna.c \
process_records.c
LINK_TIME_OPTIMIZATION_ENABLE = yes
SPACE_CADET_ENABLE = no
ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
SRC += secrets.c

View File

@ -1,71 +0,0 @@
#pragma once
#include "quantum.h"
void send_unicode_hex_string(const char* str);
/* use X(n) to call the */
#ifdef UNICODEMAP_ENABLE
enum unicode_name {
THINK, // thinking face 🤔
GRIN, // grinning face 😊
SMRK, // smirk 😏
WEARY, // good shit 😩
UNAMU, // unamused 😒
SNEK, // snke 🐍
PENGUIN, // 🐧
DRAGON, // 🐉
MONKEY, // 🐒
CHICK, // 🐥
BOAR, // 🐗
OKOK, // 👌
EFFU, // 🖕
INUP, // 👆
THUP, // 👍
THDN, // 👎
BBB, // dat B 🅱
POO, // poop 💩
HUNDR, // 100 💯
EGGPL, // EGGPLANT 🍆
WATER, // wet 💦
TUMBLER, // 🥃
LIT, // fire 🔥
BANG, // ‽
IRONY, // ⸮
DEGREE // °
};
const uint32_t PROGMEM unicode_map[] = {
[THINK] = 0x1F914,
[GRIN] = 0x1F600,
[BBB] = 0x1F171,
[POO] = 0x1F4A9,
[HUNDR] = 0x1F4AF,
[SMRK] = 0x1F60F,
[WEARY] = 0x1F629,
[EGGPL] = 0x1F346,
[WATER] = 0x1F4A6,
[LIT] = 0x1F525,
[UNAMU] = 0x1F612,
[SNEK] = 0x1F40D,
[PENGUIN] = 0x1F427,
[BOAR] = 0x1F417,
[MONKEY] = 0x1F412,
[CHICK] = 0x1F425,
[DRAGON] = 0x1F409,
[OKOK] = 0x1F44C,
[EFFU] = 0x1F595,
[INUP] = 0x1F446,
[THDN] = 0x1F44E,
[THUP] = 0x1F44D,
[TUMBLER] = 0x1F943,
[BANG] = 0x0203D,
[IRONY] = 0x02E2E,
[DEGREE] = 0x000B0
};
#endif // UNICODEMAP_ENABLE

View File

@ -1,65 +1,56 @@
#include "tap_dances.h"
#define NUM_OF_DIABLO_KEYS 4
// define diablo macro timer variables
diablo_timer_t diablo_timer[4];
diablo_timer_t diablo_timer[NUM_OF_DIABLO_KEYS];
uint8_t diablo_times[] = { 0, 0, 1, 3, 5, 10, 30 };
// has the correct number of seconds elapsed (as defined by diablo_times)
bool check_dtimer(uint8_t dtimer) { return (timer_elapsed(diablo_timer[dtimer].key_time) < (diablo_timer[dtimer].timer * 1000)) ? false : true; };
// Set the default intervals. Always start with 0 so that it will disable on first hit.
// Otherwise, you will need to hit a bunch of times, or hit the "clear" command
uint8_t diablo_times[] = {0, 1, 3, 5, 10, 30};
// 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) {
int index = (int)user_data;
if (state->count >= 7) {
diablo_timer[index].key_time = diablo_times[0];
diable_keys_t *diablo_keys = (diable_keys_t *)user_data;
// Sets the keycode based on the index
diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode;
// if the tapdance is hit more than the number of elemints in the array, reset
if (state->count >= (sizeof(diablo_times) / sizeof(uint8_t))) {
diablo_timer[diablo_keys->index].key_interval = 0;
reset_tap_dance(state);
} else {
diablo_timer[index].key_time = diablo_times[state->count];
} else { // else set the interval (tapdance count starts at 1, array starts at 0, so offset by one)
diablo_timer[diablo_keys->index].key_interval = diablo_times[state->count - 1];
}
}
// One funtion to rule them all!!
#define ACTION_TAP_DANCE_DIABLO(arg) { \
// clang-format off
// One function to rule them all!! Where the Magic Sauce lies
#define ACTION_TAP_DANCE_DIABLO(index, keycode) { \
.fn = { NULL, (void *)diablo_tapdance_master, NULL }, \
.user_data = (void *)arg, \
.user_data = (void *)&((diable_keys_t) { index, keycode }), \
}
// clang-format on
//Tap Dance Definitions
// Tap Dance Definitions, sets the index and the keycode.
qk_tap_dance_action_t tap_dance_actions[] = {
// tap once to disable, and more to enable timed micros
[TD_D3_1] = ACTION_TAP_DANCE_DIABLO(0),
[TD_D3_2] = ACTION_TAP_DANCE_DIABLO(1),
[TD_D3_3] = ACTION_TAP_DANCE_DIABLO(2),
[TD_D3_4] = ACTION_TAP_DANCE_DIABLO(3),
[TD_D3_1] = ACTION_TAP_DANCE_DIABLO(0, KC_1),
[TD_D3_2] = ACTION_TAP_DANCE_DIABLO(1, KC_2),
[TD_D3_3] = ACTION_TAP_DANCE_DIABLO(2, KC_3),
[TD_D3_4] = ACTION_TAP_DANCE_DIABLO(3, KC_4),
};
// Sends the key press to system, but only if on the Diablo layer
void send_diablo_keystroke(uint8_t diablo_key) {
if (IS_LAYER_ON(_DIABLO)) {
switch (diablo_key) {
case 0:
tap_code(KC_1); break;
case 1:
tap_code(KC_2); break;
case 2:
tap_code(KC_3); break;
case 3:
tap_code(KC_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_timer[dtime].key_time) {
diablo_timer[dtime].timer = timer_read();
send_diablo_keystroke(dtime);
for (uint8_t index = 0; index < NUM_OF_DIABLO_KEYS; index++) {
// if key_interval is 0, it's disabled, so only run if it's set. If it's set, check the timer.
if (diablo_timer[index].key_interval && timer_elapsed(diablo_timer[index].timer) > (diablo_timer[index].key_interval * 1000)) {
// reset the timer, since enough time has passed
diablo_timer[index].timer = timer_read();
// send keycode ONLY if we're on the diablo layer.
if (IS_LAYER_ON(_DIABLO)) {
tap_code(diablo_timer[index].keycode);
}
}
}
}

View File

@ -5,18 +5,26 @@
extern uint8_t diablo_times[];
typedef struct {
uint16_t timer;
uint8_t key_time;
uint8_t key_interval;
uint8_t keycode;
} diablo_timer_t;
extern diablo_timer_t diablo_timer[4];
typedef struct {
uint8_t index;
uint8_t keycode;
} diable_keys_t;
extern diablo_timer_t diablo_timer[];
void run_diablo_macro_check(void);
#ifdef TAP_DANCE_ENABLE
// clang-format off
enum {
TD_D3_1 = 0,
TD_D3_2,
TD_D3_3,
TD_D3_4
};
// clang-format on
#endif // TAP_DANCE_ENABLE

View File

@ -9,6 +9,7 @@ expanded before being used as arguments to the LAYOUT_xxx macro.
# define LAYOUT KEYMAP
#endif
// clang-format off
#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__)
#define LAYOUT_ergodox_pretty_wrapper(...) LAYOUT_ergodox_pretty(__VA_ARGS__)
#define KEYMAP_wrapper(...) LAYOUT(__VA_ARGS__)
@ -135,6 +136,15 @@ NOTE: These are all the same length. If you do a search/replace
#define _____________CARPLAX_QGMLWY_R3_____________ KC_K, KC_P, KC_COMM, KC_DOT, KC_SLSH
#define _________________WHITE_R1__________________ KC_V, KC_Y, KC_D, KC_COMM, KC_QUOT
#define _________________WHITE_R2__________________ KC_A, KC_T, KC_H, KC_E, KC_B
#define _________________WHITE_R3__________________ KC_P, KC_K, KC_G, KC_W, KC_Q
#define _________________WHITE_L1__________________ KC_INT1, KC_J, KC_M, KC_L, KC_U
#define _________________WHITE_L2__________________ KC_MINS, KC_C, KC_S, KC_N, KC_O // KC_I
#define _________________WHITE_L3__________________ KC_X, KC_R, KC_F, KC_DOT, KC_Z
#define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5
#define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0
#define _________________FUNC_LEFT_________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5
@ -170,3 +180,5 @@ NOTE: These are all the same length. If you do a search/replace
#define _________________ADJUST_R1_________________ KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5
#define _________________ADJUST_R2_________________ AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN
#define _________________ADJUST_R3_________________ MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT
// clang-format on