[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
@ -36,52 +35,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define TAPPING_TERM 100
#ifdef RGBLIGHT_ENABLE
# undef RGBLED_NUM
# define RGBLED_NUM 27
# undef RGBLED_NUM
# define RGBLED_NUM 27
# define RGBLIGHT_HUE_STEP 8
# define RGBLIGHT_SAT_STEP 8
# define RGBLIGHT_VAL_STEP 8
# define RGBLIGHT_LIMIT_VAL 100
# define RGBLIGHT_HUE_STEP 8
# define RGBLIGHT_SAT_STEP 8
# define RGBLIGHT_VAL_STEP 5
# define RGBLIGHT_LIMIT_VAL 150
#endif
#ifdef RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES // reacts to keypresses
# 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_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_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
# define B6_AUDIO
# define B6_AUDIO
// #define NO_MUSIC_MODE
#endif
@ -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

@ -2,17 +2,16 @@
#include "drashna.h"
extern keymap_config_t keymap_config;
extern uint8_t is_master;
extern uint8_t is_master;
#ifdef RGBLIGHT_ENABLE
//Following line allows macro to read current RGB settings
// Following line allows macro to read current RGB settings
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);
}
char keylog_str[5] = {};
uint8_t keylogs_str_idx = 0;
uint16_t log_timer = 0;
#define KEYLOG_LEN (int)(32 / OLED_FONT_WIDTH)
char keylog_str[KEYLOG_LEN] = {};
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) {
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("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;
}
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,57 +300,82 @@ 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
if (userspace_config.rgb_layer_change &&
# ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
!g_suspend_state &&
#endif
#if defined(RGBLIGHT_ENABLE)
# endif
# if defined(RGBLIGHT_ENABLE)
(!rgblight_config.enable && rgb_matrix_config.enable)
#else
# else
rgb_matrix_config.enable
#endif
# 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 */
@ -29,33 +29,38 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define EE_HANDS
#ifdef RGBLIGHT_ENABLE
# undef RGBLED_NUM
# define RGBLED_NUM 18 // Number of LEDs
# define RGBLED_SPLIT { 9, 9 }
# define RGBLIGHT_HUE_STEP 12
# define RGBLIGHT_SAT_STEP 12
# define RGBLIGHT_VAL_STEP 12
# define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2
# define RGBLIGHT_EFFECT_SNAKE_LENGTH 2
# undef RGBLED_NUM
# define RGBLED_NUM 18 // Number of LEDs
# undef RGBLED_SPLIT
# define RGBLED_SPLIT { 9, 9 }
# 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
# define RGBLIGHT_LIMIT_VAL 225
#endif // RGBLIGHT_ENABLE
# define RGBLIGHT_LIMIT_VAL 225
#endif // RGBLIGHT_ENABLE
#ifdef AUDIO_ENABLE
# define C6_AUDIO
# ifdef RGBLIGHT_ENABLE
# define NO_MUSIC_MODE
# endif //RGBLIGHT_ENABLE
#endif //AUDIO_ENABLE
# define C6_AUDIO
# ifdef RGBLIGHT_ENABLE
# define NO_MUSIC_MODE
# endif // RGBLIGHT_ENABLE
#endif // AUDIO_ENABLE
#define QMK_ESC_OUTPUT F6 // usually COL
#define QMK_ESC_INPUT D7 // usually ROW
#define QMK_LED B0
#define QMK_SPEAKER C6
#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
# 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,13 +122,12 @@ void matrix_init_keymap(void) {
#endif
}
void keyboard_post_init_keymap(void) {
#if BACKLIGHT_ENABLE
backlight_enable();
backlight_level(5);
#ifdef BACKLIGHT_BREATHING
breathing_enable();
#endif
# ifdef BACKLIGHT_BREATHING
breathing_enable();
# endif
#endif
}

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

@ -18,21 +18,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "drashna.h"
#ifdef UNICODEMAP_ENABLE
#include "drashna_unicode.h"
#endif // UNICODEMAP_ENABLE
# include "drashna_unicode.h"
#endif // UNICODEMAP_ENABLE
#ifndef UNICODE_ENABLE
# define UC(x) KC_NO
# define UC(x) KC_NO
#endif
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
// 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) {
@ -332,7 +331,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
}
break;
}
//switch (keycode) {
// switch (keycode) {
// case KC_P00:
// if (!record->event.pressed) {
// register_code(KC_KP_0);
@ -347,9 +346,9 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
}
void matrix_scan_keymap(void) { // runs frequently to update info
uint8_t modifiers = get_mods();
uint8_t modifiers = get_mods();
uint8_t led_usb_state = host_keyboard_leds();
uint8_t one_shot = get_oneshot_mods();
uint8_t one_shot = get_oneshot_mods();
if (!skip_leds) {
ergodox_board_led_off();
@ -360,24 +359,21 @@ void matrix_scan_keymap(void) { // runs frequently to update info
// Since we're not using the LEDs here for layer indication anymore,
// then lets use them for modifier indicators. Shame we don't have 4...
// Also, no "else", since we want to know each, independently.
if ( ( modifiers | one_shot ) & MOD_MASK_SHIFT || led_usb_state & (1<<USB_LED_CAPS_LOCK) ) {
if ((modifiers | one_shot) & MOD_MASK_SHIFT || led_usb_state & (1 << USB_LED_CAPS_LOCK)) {
ergodox_right_led_2_on();
ergodox_right_led_2_set( 50 );
ergodox_right_led_2_set(50);
}
if ( ( modifiers | one_shot ) & MOD_MASK_CTRL) {
if ((modifiers | one_shot) & MOD_MASK_CTRL) {
ergodox_right_led_1_on();
ergodox_right_led_1_set( 10 );
ergodox_right_led_1_set(10);
}
if ( ( modifiers | one_shot ) & MOD_MASK_ALT) {
if ((modifiers | one_shot) & MOD_MASK_ALT) {
ergodox_right_led_3_on();
ergodox_right_led_3_set( 10 );
ergodox_right_led_3_set(10);
}
}
}
bool indicator_is_this_led_used_keyboard(uint8_t index) {
switch (index) {
case 13 ... 14:
@ -388,76 +384,83 @@ 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 &&
#ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
if (userspace_config.rgb_layer_change &&
# ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
!g_suspend_state &&
#endif
#if defined(RGBLIGHT_ENABLE)
# endif
# if defined(RGBLIGHT_ENABLE)
(!rgblight_config.enable && rgb_matrix_config.enable)
#else
# else
rgb_matrix_config.enable
#endif
# 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_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
rgb_matrix_set_color(29, 0xFF, 0x80, 0x00); // R
rgb_matrix_set_color(37, 0x00, 0xFF, 0xFF); // A
rgb_matrix_set_color(36, 0x00, 0xFF, 0xFF); // S
rgb_matrix_set_color(35, 0x00, 0xFF, 0xFF); // D
rgb_matrix_set_color(34, 0x7A, 0x00, 0xFF); // F
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
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
rgb_matrix_set_color(29, 0xFF, 0x80, 0x00); // R
rgb_matrix_set_color(37, 0x00, 0xFF, 0xFF); // A
rgb_matrix_set_color(36, 0x00, 0xFF, 0xFF); // S
rgb_matrix_set_color(35, 0x00, 0xFF, 0xFF); // D
rgb_matrix_set_color(34, 0x7A, 0x00, 0xFF); // F
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;
}
}
}
}
#endif //RGB_MATRIX_INIT
#endif // RGB_MATRIX_INIT

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,53 +1,48 @@
#pragma once
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLED_NUM)
# define RGB_DI_PIN B3
# define RGBLED_NUM 13 // Number of LEDs
# define RGBLIGHT_ANIMATIONS
# define RGBLIGHT_HUE_STEP 12
# define RGBLIGHT_SAT_STEP 12
# define RGBLIGHT_VAL_STEP 12
# define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2
# define RGBLIGHT_EFFECT_SNAKE_LENGTH 2
# ifdef RGB_MATRIX_ENABLE
# define RGBLIGHT_DISABLE_KEYCODES
# endif
#endif // RGBLIGHT_ENABLE
# define RGB_DI_PIN B3
# define RGBLED_NUM 13 // Number of LEDs
# define RGBLIGHT_ANIMATIONS
# define RGBLIGHT_HUE_STEP 12
# define RGBLIGHT_SAT_STEP 12
# define RGBLIGHT_VAL_STEP 12
# define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2
# define RGBLIGHT_EFFECT_SNAKE_LENGTH 2
# ifdef RGB_MATRIX_ENABLE
# define RGBLIGHT_DISABLE_KEYCODES
# endif
#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_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_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
# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
#endif
#if defined(KEYBOARD_lets_split_rev2)
# define USE_SERIAL
# undef USE_I2C
# define EE_HANDS
# define USE_SERIAL
# undef USE_I2C
# define EE_HANDS
#endif
#if !defined(KEYBOARD_planck_light)
# ifdef RGBLIGHT_ENABLE
# define NO_MUSIC_MODE
# endif // RGBLIGHT_ENABLE
#endif // KEYBOARD_planck_light
# ifdef RGBLIGHT_ENABLE
# define NO_MUSIC_MODE
# 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)
# define PRODUCT Drashna Hacked Planck EZ
# endif
# 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)
# define PRODUCT Drashna Hacked Planck EZ
# endif
#endif
/*

View File

@ -21,27 +21,27 @@
extern rgblight_config_t rgblight_config;
#endif
#ifdef BACKLIGHT_ENABLE
enum planck_keycodes {
BACKLIT = NEW_SAFE_RANGE,
BACKLIT = NEW_SAFE_RANGE,
};
#else
#define BACKLIT OSM(MOD_LSFT)
# define BACKLIT OSM(MOD_LSFT)
#endif
#ifdef KEYBOARD_planck_ez
# define PLNK_1 BK_LWER
# define PLNK_2 SP_LWER
# define PLNK_3 KC_NO
# define PLNK_4 ET_RAIS
# define PLNK_1 BK_LWER
# define PLNK_2 SP_LWER
# define PLNK_3 KC_NO
# define PLNK_4 ET_RAIS
#else
# define PLNK_1 SP_LWER
# define PLNK_2 BK_LWER
# define PLNK_3 DL_RAIS
# define PLNK_4 ET_RAIS
# define PLNK_1 SP_LWER
# define PLNK_2 BK_LWER
# define PLNK_3 DL_RAIS
# 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,17 +135,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
// clang-format on
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
#ifdef BACKLIGHT_ENABLE
#ifdef BACKLIGHT_ENABLE
case BACKLIT:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
# ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
# endif
} else {
unregister_code(KC_RSFT);
}
@ -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,98 +180,122 @@ 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();
uint8_t this_led = host_keyboard_leds();
uint8_t this_osm = get_oneshot_mods();
bool is_ez;
#ifdef KEYBOARD_planck_ez
bool is_ez;
# ifdef KEYBOARD_planck_ez
is_ez = true;
#endif
# endif
if ( userspace_config.rgb_layer_change &&
#ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
if (userspace_config.rgb_layer_change &&
# ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
!g_suspend_state &&
#endif
#if defined(RGBLIGHT_ENABLE)
(!rgblight_config.enable && rgb_matrix_config.enable)
#else
rgb_matrix_config.enable
#endif
) {
# endif
# if defined(RGBLIGHT_ENABLE)
(!rgblight_config.enable && rgb_matrix_config.enable)
# else
rgb_matrix_config.enable
# 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;
case _COLEMAK:
rgb_matrix_layer_helper(0xFF, 0x00, 0xFF, LED_FLAG_MODIFIER); break;
case _DVORAK:
rgb_matrix_layer_helper(0x00, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
case _WORKMAN:
rgb_matrix_layer_helper(0xD9, 0xA5, 0x21, LED_FLAG_MODIFIER); break;
case _NORMAN:
rgb_matrix_layer_helper(0xFF, 0x7C, 0x4D, LED_FLAG_MODIFIER); break;
case _MALTRON:
rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
case _EUCALYN:
rgb_matrix_layer_helper(0xFF, 0x80, 0xBF, LED_FLAG_MODIFIER); break;
case _CARPLAX:
rgb_matrix_layer_helper(0x00, 0x00, 0xFF, LED_FLAG_MODIFIER); break;
case _QWERTY:
rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _COLEMAK:
rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _DVORAK:
rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _WORKMAN:
rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _NORMAN:
rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _MALTRON:
rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _EUCALYN:
rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
case _CARPLAX:
rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER);
break;
}
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)) {
if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) {
rgb_matrix_set_color(24, 0x00, 0xFF, 0x00);
rgb_matrix_set_color(36, 0x00, 0xFF, 0x00);
}
if ( (this_mod | this_osm) & MOD_MASK_CTRL) {
if ((this_mod | this_osm) & MOD_MASK_CTRL) {
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) {
if ((this_mod | this_osm) & MOD_MASK_GUI) {
rgb_matrix_set_color(39, 0xFF, 0xD9, 0x00);
}
if ( (this_mod | this_osm) & MOD_MASK_ALT) {
if ((this_mod | this_osm) & MOD_MASK_ALT) {
rgb_matrix_set_color(38, 0x00, 0x00, 0xFF);
}
}
void matrix_init_keymap(void) {
// rgblight_mode(RGB_MATRIX_MULTISPLASH);
// rgblight_mode(RGB_MATRIX_MULTISPLASH);
}
#else //RGB_MATRIX_INIT
#else // RGB_MATRIX_INIT
void matrix_init_keymap(void) {
#if !defined(CONVERT_TO_PROTON_C) && !defined(KEYBOARD_planck)
# if !defined(CONVERT_TO_PROTON_C) && !defined(KEYBOARD_planck)
setPinOutput(D5);
writePinHigh(D5);
setPinOutput(B0);
writePinHigh(B0);
#endif
# endif
}
#endif //RGB_MATRIX_INIT
#endif // RGB_MATRIX_INIT
#ifdef ENCODER_ENABLE
void encoder_update(bool clockwise) {
@ -279,34 +304,42 @@ void encoder_update(bool clockwise) {
clockwise ? tap_code(KC_VOLD) : tap_code(KC_VOLU);
break;
case _LOWER:
#ifdef RGB_MATRIX_ENABLE
clockwise ? rgb_matrix_step() : rgblight_step_reverse();
#else
# ifdef RGB_MATRIX_ENABLE
clockwise ? rgb_matrix_step() : rgb_matrix_step_reverse();
# else
clockwise ? tap_code(KC_PGDN) : tap_code(KC_PGUP);
#endif
# endif
break;
case _ADJUST:
#ifdef AUDIO_CLICKY
# ifdef AUDIO_CLICKY
clockwise ? clicky_freq_up() : clicky_freq_down();
#endif
# endif
break;
default:
clockwise ? tap_code(KC_DOWN) : tap_code(KC_UP);
}
#ifdef AUDIO_CLICKY
# ifdef AUDIO_CLICKY
clicky_play();
#endif
# endif
}
#endif // ENCODER_ENABLE
#endif // ENCODER_ENABLE
#ifdef KEYBOARD_planck_rev6
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;
@ -316,11 +349,10 @@ void dip_update(uint8_t index, bool active) {
break;
}
}
#endif // KEYBOARD_planck_rev6
#endif // KEYBOARD_planck_rev6
#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,21 +1,22 @@
#pragma once
/* ws2812 RGB LED */
#if defined(KEYBOARD_fractal)
# define RGB_DI_PIN D2
# undef RGBLED_NUM
# define RGBLIGHT_ANIMATIONS
# define RGBLED_NUM 29 // Number of LEDs
# undef RGBLIGHT_HUE_STEP
# define RGBLIGHT_HUE_STEP 8
# undef RGBLIGHT_SAT_STEP
# define RGBLIGHT_SAT_STEP 8
# undef RGBLIGHT_VAL_STEP
# define RGBLIGHT_VAL_STEP 8
# define RGBLIGHT_LIMIT_VAL 175
# define RGBLIGHT_SLEEP
# define RGB_DI_PIN D2
# undef RGBLED_NUM
# define RGBLIGHT_ANIMATIONS
# define RGBLED_NUM 29 // Number of LEDs
# undef RGBLIGHT_HUE_STEP
# define RGBLIGHT_HUE_STEP 8
# undef RGBLIGHT_SAT_STEP
# define RGBLIGHT_SAT_STEP 8
# undef RGBLIGHT_VAL_STEP
# define RGBLIGHT_VAL_STEP 8
# define RGBLIGHT_LIMIT_VAL 175
# define RGBLIGHT_SLEEP
# define RGBLIGHT_EFFECT_KNIGHT_OFFSET 3
# define RGBLIGHT_EFFECT_KNIGHT_LED_NUM 14
# 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,47 +1,95 @@
#pragma once
#ifdef AUDIO_ENABLE
# 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) \
}
# if __GNUC__ > 7
# if __has_include("drashna_song_list.h")
# include "drashna_song_list.h"
# endif // if file exists
# endif // __GNUC__
# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f
# 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 UNICODE_SONG_OSX SONG(RICK_ROLL)
# define UNICODE_SONG_LNX SONG(RICK_ROLL)
# define UNICODE_SONG_WIN SONG(RICK_ROLL)
# define UNICODE_SONG_BSD SONG(RICK_ROLL)
# define UNICODE_SONG_WINC SONG(RICK_ROLL)
# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f
#endif // !AUDIO_ENABLE
# define UNICODE_SONG_OSX SONG(RICK_ROLL)
# define UNICODE_SONG_LNX SONG(RICK_ROLL)
# 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
# define RGBLIGHT_SLEEP
# undef RGBLIGHT_ANIMATIONS
# define RGBLIGHT_EFFECT_BREATHING
# define RGBLIGHT_EFFECT_SNAKE
# define RGBLIGHT_EFFECT_KNIGHT
#endif // RGBLIGHT_ENABLE
# define RGBLIGHT_SLEEP
# undef RGBLIGHT_ANIMATIONS
# define RGBLIGHT_EFFECT_BREATHING
# define RGBLIGHT_EFFECT_SNAKE
# 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
# define ONESHOT_TAP_TOGGLE 2
#endif // !ONESHOT_TAP_TOGGLE
#ifndef ONESHOT_TIMEOUT
# define ONESHOT_TIMEOUT 3000
#endif// !ONESHOT_TIMEOUT
# define ONESHOT_TIMEOUT 3000
#endif // !ONESHOT_TIMEOUT
#ifndef QMK_KEYS_PER_SCAN
# define QMK_KEYS_PER_SCAN 4
#endif // !QMK_KEYS_PER_SCAN
# 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,
@ -55,27 +103,26 @@
#define FORCE_NKRO
#ifndef TAPPING_TOGGLE
# define TAPPING_TOGGLE 1
# define TAPPING_TOGGLE 1
#endif
#ifdef TAPPING_TERM
# undef TAPPING_TERM
#endif // TAPPING_TERM
# undef TAPPING_TERM
#endif // TAPPING_TERM
#if defined(KEYBOARD_ergodox_ez)
# define TAPPING_TERM 185
# define TAPPING_TERM 185
#elif defined(KEYBOARD_crkbd)
# define TAPPING_TERM 200
# define TAPPING_TERM 200
#else
# define TAPPING_TERM 175
# define TAPPING_TERM 175
#endif
#define TAP_CODE_DELAY 5
/* Disable unused and unneeded features to reduce on firmware size */
#ifdef LOCKING_SUPPORT_ENABLE
# undef LOCKING_SUPPORT_ENABLE
# undef LOCKING_SUPPORT_ENABLE
#endif
#ifdef LOCKING_RESYNC_ENABLE
# undef LOCKING_RESYNC_ENABLE
# undef LOCKING_RESYNC_ENABLE
#endif

View File

@ -19,22 +19,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
userspace_config_t userspace_config;
#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
#define DRASHNA_UNICODE_MODE UC_WIN
# define DRASHNA_UNICODE_MODE UC_WIN
#else
// set to 2 for UC_WIN, set to 4 for UC_WINC
#define DRASHNA_UNICODE_MODE 2
// set to 2 for UC_WIN, set to 4 for UC_WINC
# 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) {
if (!record->event.pressed || override) {
uint16_t keycode;
if (userspace_config.is_overwatch) {
keycode = KC_BSPC;
keycode = KC_BSPC;
} else {
keycode = KC_ENTER;
keycode = KC_ENTER;
}
clear_keyboard();
tap_code(keycode);
@ -47,12 +46,12 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
return false;
}
bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed) {
bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) {
static uint16_t this_timer;
if(pressed) {
this_timer= timer_read();
if (pressed) {
this_timer = timer_read();
} else {
if (timer_elapsed(this_timer) < TAPPING_TERM){
if (timer_elapsed(this_timer) < TAPPING_TERM) {
tap_code(code);
} else {
register_code(mod_code);
@ -63,11 +62,11 @@ bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed) {
return false;
}
bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) {
if(pressed) {
this_timer= timer_read();
bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) {
if (pressed) {
this_timer = timer_read();
} else {
if (timer_elapsed(this_timer) < TAPPING_TERM){
if (timer_elapsed(this_timer) < TAPPING_TERM) {
tap_code(code);
} else {
register_code(mod_code);
@ -80,13 +79,13 @@ bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t thi
void bootmagic_lite(void) {
matrix_scan();
#if defined(DEBOUNCING_DELAY) && DEBOUNCING_DELAY > 0
wait_ms(DEBOUNCING_DELAY * 2);
#elif defined(DEBOUNCE) && DEBOUNCE > 0
wait_ms(DEBOUNCE * 2);
#else
wait_ms(30);
#endif
#if defined(DEBOUNCING_DELAY) && DEBOUNCING_DELAY > 0
wait_ms(DEBOUNCING_DELAY * 2);
#elif defined(DEBOUNCE) && DEBOUNCE > 0
wait_ms(DEBOUNCE * 2);
#else
wait_ms(30);
#endif
matrix_scan();
if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) {
bootloader_jump();
@ -97,7 +96,7 @@ void bootmagic_lite(void) {
// This allows for a global, userspace functions, and continued
// customization of the keymap. Use _keymap instead of _user
// functions in the keymaps
__attribute__ ((weak))
__attribute__((weak))
void matrix_init_keymap(void) {}
// Call user matrix init, set default RGB colors and then
@ -105,64 +104,63 @@ void matrix_init_keymap(void) {}
void matrix_init_user(void) {
userspace_config.raw = eeconfig_read_user();
#ifdef BOOTLOADER_CATERINA
DDRD &= ~(1<<5);
PORTD &= ~(1<<5);
#ifdef BOOTLOADER_CATERINA
DDRD &= ~(1 << 5);
PORTD &= ~(1 << 5);
DDRB &= ~(1<<0);
PORTB &= ~(1<<0);
#endif
DDRB &= ~(1 << 0);
PORTB &= ~(1 << 0);
#endif
#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
set_unicode_input_mode(DRASHNA_UNICODE_MODE);
get_unicode_input_mode();
#endif //UNICODE_ENABLE
#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
set_unicode_input_mode(DRASHNA_UNICODE_MODE);
get_unicode_input_mode();
#endif // UNICODE_ENABLE
matrix_init_keymap();
}
__attribute__((weak))
void keyboard_post_init_keymap(void){ }
void keyboard_post_init_keymap(void) {}
void keyboard_post_init_user(void){
void keyboard_post_init_user(void) {
#ifdef RGBLIGHT_ENABLE
keyboard_post_init_rgb();
#endif
keyboard_post_init_keymap();
}
__attribute__ ((weak))
__attribute__((weak))
void shutdown_keymap(void) {}
void shutdown_user (void) {
#ifdef RGBLIGHT_ENABLE
rgblight_enable_noeeprom();
rgblight_mode_noeeprom(1);
rgblight_setrgb_red();
#endif // RGBLIGHT_ENABLE
#ifdef RGB_MATRIX_ENABLE
// uint16_t timer_start = timer_read();
// rgb_matrix_set_color_all( 0xFF, 0x00, 0x00 );
// while(timer_elapsed(timer_start) < 250) { wait_ms(1); }
#endif //RGB_MATRIX_ENABLE
void shutdown_user(void) {
#ifdef RGBLIGHT_ENABLE
rgblight_enable_noeeprom();
rgblight_mode_noeeprom(1);
rgblight_setrgb_red();
#endif // RGBLIGHT_ENABLE
#ifdef RGB_MATRIX_ENABLE
// uint16_t timer_start = timer_read();
// rgb_matrix_set_color_all( 0xFF, 0x00, 0x00 );
// while(timer_elapsed(timer_start) < 250) { wait_ms(1); }
#endif // RGB_MATRIX_ENABLE
shutdown_keymap();
}
__attribute__ ((weak))
__attribute__((weak))
void suspend_power_down_keymap(void) {}
void suspend_power_down_user(void) {
suspend_power_down_keymap();
}
__attribute__ ((weak))
__attribute__((weak))
void suspend_wakeup_init_keymap(void) {}
void suspend_wakeup_init_user(void) {
suspend_wakeup_init_keymap();
}
__attribute__ ((weak))
__attribute__((weak))
void matrix_scan_keymap(void) {}
// No global matrix scan code, so just run keymap's matrix
@ -176,20 +174,17 @@ void matrix_scan_user(void) {
#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
run_diablo_macro_check();
#endif // TAP_DANCE_ENABLE
#endif // TAP_DANCE_ENABLE
#ifdef RGBLIGHT_ENABLE
matrix_scan_rgb();
#endif // RGBLIGHT_ENABLE
#endif // RGBLIGHT_ENABLE
matrix_scan_keymap();
}
__attribute__ ((weak))
layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}
__attribute__((weak))
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
@ -197,28 +192,25 @@ layer_state_t layer_state_set_user(layer_state_t state) {
state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
#ifdef RGBLIGHT_ENABLE
state = layer_state_set_rgb(state);
#endif // RGBLIGHT_ENABLE
return layer_state_set_keymap (state);
#endif // RGBLIGHT_ENABLE
return layer_state_set_keymap(state);
}
__attribute__ ((weak))
layer_state_t default_layer_state_set_keymap (layer_state_t state) {
return state;
}
__attribute__((weak))
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) {
state = default_layer_state_set_keymap(state);
#if 0
#ifdef RGBLIGHT_ENABLE
# ifdef RGBLIGHT_ENABLE
state = default_layer_state_set_rgb(state);
#endif // RGBLIGHT_ENABLE
# endif // RGBLIGHT_ENABLE
#endif
return state;
}
__attribute__ ((weak))
__attribute__((weak))
void led_set_keymap(uint8_t usb_led) {}
// Any custom LED code goes here.
@ -228,17 +220,19 @@ void led_set_user(uint8_t usb_led) {
led_set_keymap(usb_led);
}
__attribute__ ((weak))
__attribute__((weak))
void eeconfig_init_keymap(void) {}
void eeconfig_init_user(void) {
userspace_config.raw = 0;
userspace_config.raw = 0;
userspace_config.rgb_layer_change = true;
eeconfig_update_user(userspace_config.raw);
#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
set_unicode_input_mode(DRASHNA_UNICODE_MODE);
get_unicode_input_mode();
#else
#else
eeprom_update_byte(EECONFIG_UNICODEMODE, DRASHNA_UNICODE_MODE);
#endif
#endif
eeconfig_init_keymap();
keyboard_init();
}

View File

@ -22,20 +22,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "wrappers.h"
#include "process_records.h"
#ifdef TAP_DANCE_ENABLE
# include "tap_dances.h"
#endif // TAP_DANCE_ENABLE
# include "tap_dances.h"
#endif // TAP_DANCE_ENABLE
#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
# include "rgb_stuff.h"
#endif
/* Define layer names */
enum userspace_layers {
_QWERTY = 0,
_QWERTY = 0,
_NUMLOCK = 0,
_COLEMAK,
_DVORAK,
@ -58,47 +53,45 @@ 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);
void matrix_init_keymap(void);
void shutdown_keymap(void);
void suspend_power_down_keymap(void);
void suspend_wakeup_init_keymap(void);
void matrix_scan_keymap(void);
layer_state_t layer_state_set_keymap (layer_state_t state);
layer_state_t default_layer_state_set_keymap (layer_state_t state);
void led_set_keymap(uint8_t usb_led);
void eeconfig_init_keymap(void);
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);
void matrix_init_keymap(void);
void shutdown_keymap(void);
void suspend_power_down_keymap(void);
void suspend_wakeup_init_keymap(void);
void matrix_scan_keymap(void);
layer_state_t layer_state_set_keymap(layer_state_t state);
layer_state_t default_layer_state_set_keymap(layer_state_t state);
void led_set_keymap(uint8_t usb_led);
void eeconfig_init_keymap(void);
typedef union {
uint32_t raw;
struct {
bool rgb_layer_change :1;
bool is_overwatch :1;
bool nuke_switch :1;
uint8_t unicode_mod :4;
bool swapped_numbers :1;
bool rgb_layer_change :1;
bool is_overwatch :1;
bool nuke_switch :1;
uint8_t unicode_mod :4;
bool swapped_numbers :1;
};
} userspace_config_t;
extern userspace_config_t userspace_config;
/*
Custom Keycodes for Diablo 3 layer
But since TD() doesn't work when tap dance is disabled
We use custom codes here, so we can substitute the right stuff
*/
#ifdef TAP_DANCE_ENABLE
# 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 // TAP_DANCE_ENABLE
# 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 // TAP_DANCE_ENABLE
# 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 // TAP_DANCE_ENABLE
# 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 // TAP_DANCE_ENABLE

View File

@ -2,160 +2,161 @@
uint16_t copy_paste_timer;
__attribute__ ((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
__attribute__((weak))
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;
}
__attribute__((weak))
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
// 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)
xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.row, record->event.key.col, record->event.pressed);
# else
xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
# endif
#endif //KEYLOGGER_ENABLE
# if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_keebio_iris_rev2)
xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.row, record->event.key.col, record->event.pressed);
# else
xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
# endif
#endif // KEYLOGGER_ENABLE
switch (keycode) {
case KC_QWERTY ... KC_CARPLAX:
if (record->event.pressed) {
set_single_persistent_default_layer(keycode - KC_QWERTY);
}
break;
case KC_QWERTY ... KC_CARPLAX:
if (record->event.pressed) {
set_single_persistent_default_layer(keycode - KC_QWERTY);
}
break;
case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
if (!record->event.pressed) {
uint8_t temp_mod = get_mods();
uint8_t temp_osm = get_oneshot_mods();
clear_mods(); clear_oneshot_mods();
send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), TAP_CODE_DELAY);
case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
if (!record->event.pressed) {
uint8_t temp_mod = get_mods();
uint8_t temp_osm = get_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 )
if ((temp_mod | temp_osm) & MOD_MASK_SHIFT)
#endif
{
#if defined(__arm__)
send_string_with_delay_P(PSTR(":dfu-util"), TAP_CODE_DELAY);
#elif defined(BOOTLOADER_DFU)
send_string_with_delay_P(PSTR(":dfu"), TAP_CODE_DELAY);
#elif defined(BOOTLOADER_HALFKAY)
send_string_with_delay_P(PSTR(":teensy"), TAP_CODE_DELAY);
#elif defined(BOOTLOADER_CATERINA)
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 defined(__arm__)
send_string_with_delay_P(PSTR(":dfu-util"), TAP_CODE_DELAY);
#elif defined(BOOTLOADER_DFU)
send_string_with_delay_P(PSTR(":dfu"), TAP_CODE_DELAY);
#elif defined(BOOTLOADER_HALFKAY)
send_string_with_delay_P(PSTR(":teensy"), TAP_CODE_DELAY);
#elif defined(BOOTLOADER_CATERINA)
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);
}
#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);
}
send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY);
}
break;
break;
case VRSN: // Prints firmware version
if (record->event.pressed) {
send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY);
}
break;
case VRSN: // Prints firmware version
if (record->event.pressed) {
send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY);
}
break;
// These are a serious of gaming macros.
// Only enables for the viterbi, basically,
// to save on firmware space, since it's limited.
// These are a serious of gaming macros.
// Only enables for the viterbi, basically,
// 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); }
#ifdef RGBLIGHT_ENABLE
userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18);
#endif //RGBLIGHT_ENABLE
break;
case KC_SALT:
return send_game_macro("Salt, salt, salt...", record, false);
case KC_MORESALT:
return send_game_macro("Please sir, can I have some more salt?!", record, false);
case KC_SALTHARD:
return send_game_macro("Your salt only makes me harder, and even more aggressive!", record, false);
case KC_GOODGAME:
return send_game_macro("Good game, everyone!", record, false);
case KC_GLHF:
return send_game_macro("Good luck, have fun!!!", record, false);
case KC_SYMM:
return send_game_macro("Left click to win!", record, false);
case KC_JUSTGAME:
return send_game_macro("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games.", record, false);
case KC_TORB:
return send_game_macro("That was positively riveting!", record, false);
case KC_AIM:
send_game_macro("That aim is absolutely amazing. It's almost like you're a machine!", record, true);
return send_game_macro("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!", record, false);
case KC_C9:
return send_game_macro("OMG!!! C9!!!", record, false);
case KC_GGEZ:
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_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);
}
# ifdef RGBLIGHT_ENABLE
userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18);
# endif // RGBLIGHT_ENABLE
break;
case KC_SALT:
return send_game_macro("Salt, salt, salt...", record, false);
case KC_MORESALT:
return send_game_macro("Please sir, can I have some more salt?!", record, false);
case KC_SALTHARD:
return send_game_macro("Your salt only makes me harder, and even more aggressive!", record, false);
case KC_GOODGAME:
return send_game_macro("Good game, everyone!", record, false);
case KC_GLHF:
return send_game_macro("Good luck, have fun!!!", record, false);
case KC_SYMM:
return send_game_macro("Left click to win!", record, false);
case KC_JUSTGAME:
return send_game_macro("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games.", record, false);
case KC_TORB:
return send_game_macro("That was positively riveting!", record, false);
case KC_AIM:
send_game_macro("That aim is absolutely amazing. It's almost like you're a machine!", record, true);
return send_game_macro("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!", record, false);
case KC_C9:
return send_game_macro("OMG!!! C9!!!", record, false);
case KC_GGEZ:
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
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];
if (record->event.pressed) {
for (uint8_t index = 0; index < 4; index++) {
diablo_timer[index].key_interval = 0;
}
}
}
#endif // TAP_DANCE_ENABLE
break;
#endif // TAP_DANCE_ENABLE
break;
case KC_CCCV: // One key copy/paste
if(record->event.pressed){
copy_paste_timer = timer_read();
case KC_CCCV: // One key copy/paste
if (record->event.pressed) {
copy_paste_timer = timer_read();
} else {
if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
register_code(KC_LCTL);
tap_code(KC_C);
unregister_code(KC_LCTL);
} else { // Tap, paste
register_code(KC_LCTL);
tap_code(KC_V);
unregister_code(KC_LCTL);
if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
register_code(KC_LCTL);
tap_code(KC_C);
unregister_code(KC_LCTL);
} else { // Tap, paste
register_code(KC_LCTL);
tap_code(KC_V);
unregister_code(KC_LCTL);
}
}
}
break;
break;
#ifdef UNICODE_ENABLE
case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻
if (record->event.pressed) {
send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
}
break;
case UC_TABL: // ┬─┬ノ( º _ ºノ)
if (record->event.pressed) {
send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 30CE 0029");
}
break;
case UC_SHRG: // ¯\_(ツ)_/¯
if (record->event.pressed) {
send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF");
}
break;
case UC_DISA: // ಠ_ಠ
if (record->event.pressed) {
send_unicode_hex_string("0CA0 005F 0CA0");
}
break;
case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻
if (record->event.pressed) {
send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
}
break;
case UC_TABL: // ┬─┬ノ( º _ ºノ)
if (record->event.pressed) {
send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 30CE 0029");
}
break;
case UC_SHRG: // ¯\_(ツ)_/¯
if (record->event.pressed) {
send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF");
}
break;
case UC_DISA: // ಠ_ಠ
if (record->event.pressed) {
send_unicode_hex_string("0CA0 005F 0CA0");
}
break;
#endif
}
return process_record_keymap(keycode, record) &&
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
process_record_user_rgb(keycode, record) &&
#endif // RGBLIGHT_ENABLE
process_record_secrets(keycode, record);
process_record_user_rgb(keycode, record) &&
#endif // RGBLIGHT_ENABLE
process_record_secrets(keycode, record);
}

View File

@ -2,24 +2,24 @@
#include "drashna.h"
#if defined(KEYMAP_SAFE_RANGE)
# define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE
# define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE
#else
# define PLACEHOLDER_SAFE_RANGE SAFE_RANGE
# define PLACEHOLDER_SAFE_RANGE SAFE_RANGE
#endif
enum userspace_custom_keycodes {
VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info
KC_QWERTY, // Sets default layer to QWERTY
KC_COLEMAK, // Sets default layer to COLEMAK
KC_DVORAK, // Sets default layer to DVORAK
KC_WORKMAN, // Sets default layer to WORKMAN
KC_NORMAN, // Sets default layer to NORMAN
KC_MALTRON, // Sets default layer to MALTRON
KC_EUCALYN, // Sets default layer to EUCALYN
KC_CARPLAX, // Sets default layer to CARPLAX
KC_DIABLO_CLEAR, // Clears all Diablo Timers
KC_OVERWATCH, // Toggles game macro input mode (so in OW, it defaults to game chat)
KC_SALT, // See drashna.c for details
VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info
KC_QWERTY, // Sets default layer to QWERTY
KC_COLEMAK, // Sets default layer to COLEMAK
KC_DVORAK, // Sets default layer to DVORAK
KC_WORKMAN, // Sets default layer to WORKMAN
KC_NORMAN, // Sets default layer to NORMAN
KC_MALTRON, // Sets default layer to MALTRON
KC_EUCALYN, // Sets default layer to EUCALYN
KC_CARPLAX, // Sets default layer to CARPLAX
KC_DIABLO_CLEAR, // Clears all Diablo Timers
KC_OVERWATCH, // Toggles game macro input mode (so in OW, it defaults to game chat)
KC_SALT, // See drashna.c for details
KC_MORESALT,
KC_SALTHARD,
KC_GOODGAME,
@ -30,27 +30,25 @@ enum userspace_custom_keycodes {
KC_AIM,
KC_C9,
KC_GGEZ,
KC_MAKE, // Run keyboard's customized make command
KC_RGB_T, // Toggles RGB Layer Indication mode
KC_SECRET_1, // test1
KC_SECRET_2, // test2
KC_SECRET_3, // test3
KC_SECRET_4, // test4
KC_SECRET_5, // test5
KC_CCCV, // Hold to copy, tap to paste
KC_NUKE, // NUCLEAR LAUNCH DETECTED!!!
UC_FLIP, // (ಠ痊ಠ)┻━┻
UC_TABL, // ┬─┬ノ( º _ ºノ)
UC_SHRG, // ¯\_(ツ)_/¯
UC_DISA, // ಠ_ಠ
NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes
KC_MAKE, // Run keyboard's customized make command
KC_RGB_T, // Toggles RGB Layer Indication mode
KC_SECRET_1, // test1
KC_SECRET_2, // test2
KC_SECRET_3, // test3
KC_SECRET_4, // test4
KC_SECRET_5, // test5
KC_CCCV, // Hold to copy, tap to paste
KC_NUKE, // NUCLEAR LAUNCH DETECTED!!!
UC_FLIP, // (ಠ痊ಠ)┻━┻
UC_TABL, // ┬─┬ノ( º _ ºノ)
UC_SHRG, // ¯\_(ツ)_/¯
UC_DISA, // ಠ_ಠ
NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes
};
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)
@ -74,10 +72,10 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
#define KC_RST KC_RESET
#ifdef SWAP_HANDS_ENABLE
#define KC_C1R3 SH_TT
#else // SWAP_HANDS_ENABLE
#define KC_C1R3 KC_BSPC
#endif // SWAP_HANDS_ENABLE
# define KC_C1R3 SH_TT
#else // SWAP_HANDS_ENABLE
# define KC_C1R3 KC_BSPC
#endif // SWAP_HANDS_ENABLE
#define BK_LWER LT(_LOWER, KC_BSPC)
#define SP_LWER LT(_LOWER, KC_SPC)

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

@ -4,77 +4,75 @@
#if defined(RGBLIGHT_ENABLE)
extern rgblight_config_t rgblight_config;
bool has_initialized;
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);
}
#endif // RGBLIGHT_ENABLE
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
void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) {
if (userspace_config.rgb_layer_change && biton32(layer_state) == 0) {
if ( (this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1<<USB_LED_CAPS_LOCK) ) {
#ifdef SHFT_LED1
if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) {
# ifdef SHFT_LED1
rgblight_sethsv_at(120, 255, 255, SHFT_LED1);
#endif // SHFT_LED1
#ifdef SHFT_LED2
# endif // SHFT_LED1
# ifdef SHFT_LED2
rgblight_sethsv_at(120, 255, 255, SHFT_LED2);
#endif // SHFT_LED2
# endif // SHFT_LED2
} else {
#ifdef SHFT_LED1
# ifdef SHFT_LED1
rgblight_sethsv_default_helper(SHFT_LED1);
#endif // SHFT_LED1
#ifdef SHFT_LED2
# endif // SHFT_LED1
# ifdef SHFT_LED2
rgblight_sethsv_default_helper(SHFT_LED2);
#endif // SHFT_LED2
# endif // SHFT_LED2
}
if ( (this_mod | this_osm) & MOD_MASK_CTRL) {
#ifdef CTRL_LED1
if ((this_mod | this_osm) & MOD_MASK_CTRL) {
# ifdef CTRL_LED1
rgblight_sethsv_at(0, 255, 255, CTRL_LED1);
#endif // CTRL_LED1
#ifdef CTRL_LED2
# endif // CTRL_LED1
# ifdef CTRL_LED2
rgblight_sethsv_at(0, 255, 255, CTRL_LED2);
#endif // CTRL_LED2
# endif // CTRL_LED2
} else {
#ifdef CTRL_LED1
# ifdef CTRL_LED1
rgblight_sethsv_default_helper(CTRL_LED1);
#endif // CTRL_LED1
#ifdef CTRL_LED2
# endif // CTRL_LED1
# ifdef CTRL_LED2
rgblight_sethsv_default_helper(CTRL_LED2);
#endif // CTRL_LED2
# endif // CTRL_LED2
}
if ( (this_mod | this_osm) & MOD_MASK_GUI) {
#ifdef GUI_LED1
if ((this_mod | this_osm) & MOD_MASK_GUI) {
# ifdef GUI_LED1
rgblight_sethsv_at(51, 255, 255, GUI_LED1);
#endif // GUI_LED1
#ifdef GUI_LED2
# endif // GUI_LED1
# ifdef GUI_LED2
rgblight_sethsv_at(51, 255, 255, GUI_LED2);
#endif // GUI_LED2
# endif // GUI_LED2
} else {
#ifdef GUI_LED1
# ifdef GUI_LED1
rgblight_sethsv_default_helper(GUI_LED1);
#endif // GUI_LED1
#ifdef GUI_LED2
# endif // GUI_LED1
# ifdef GUI_LED2
rgblight_sethsv_default_helper(GUI_LED2);
#endif // GUI_LED2
# endif // GUI_LED2
}
if ( (this_mod | this_osm) & MOD_MASK_ALT) {
#ifdef ALT_LED1
if ((this_mod | this_osm) & MOD_MASK_ALT) {
# ifdef ALT_LED1
rgblight_sethsv_at(240, 255, 255, ALT_LED1);
#endif // ALT_LED1
#ifdef GUI_LED2
# endif // ALT_LED1
# ifdef GUI_LED2
rgblight_sethsv_at(240, 255, 255, ALT_LED2);
#endif // GUI_LED2
# endif // GUI_LED2
} else {
#ifdef GUI_LED1
# ifdef GUI_LED1
rgblight_sethsv_default_helper(ALT_LED1);
#endif // GUI_LED1
#ifdef GUI_LED2
# endif // GUI_LED1
# ifdef GUI_LED2
rgblight_sethsv_default_helper(ALT_LED2);
#endif // GUI_LED2
# endif // GUI_LED2
}
}
}
@ -84,75 +82,73 @@ void matrix_scan_indicator(void) {
set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods());
}
}
#endif //INDICATOR_LIGHTS
#endif // INDICATOR_LIGHTS
#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) {
#ifdef INDICATOR_LIGHTS
#ifdef SHFT_LED1
# ifdef INDICATOR_LIGHTS
# ifdef SHFT_LED1
case SHFT_LED1:
return true;
#endif //SHFT_LED1
#ifdef SHFT_LED2
# endif // SHFT_LED1
# ifdef SHFT_LED2
case SHFT_LED2:
return true;
#endif //SHFT_LED2
#ifdef CTRL_LED1
# endif // SHFT_LED2
# ifdef CTRL_LED1
case CTRL_LED1:
return true;
#endif //CTRL_LED1
#ifdef CTRL_LED2
# endif // CTRL_LED1
# ifdef CTRL_LED2
case CTRL_LED2:
return true;
#endif //CTRL_LED2
#ifdef GUI_LED1
# endif // CTRL_LED2
# ifdef GUI_LED1
case GUI_LED1:
return true;
#endif //GUI_LED1
#ifdef GUI_LED2
# endif // GUI_LED1
# ifdef GUI_LED2
case GUI_LED2:
return true;
#endif //GUI_LED2
#ifdef ALT_LED1
# endif // GUI_LED2
# ifdef ALT_LED1
case ALT_LED1:
return true;
#endif //ALT_LED1
#ifdef ALT_LED2
# endif // ALT_LED1
# ifdef ALT_LED2
case ALT_LED2:
return true;
#endif //ALT_LED2
#endif //INDICATOR_LIGHTS
# endif // ALT_LED2
# endif // INDICATOR_LIGHTS
default:
return rgblight_twinkle_is_led_used_keymap(index);
}
}
}
void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive
void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive
bool litup = false;
for (uint8_t light_index = 0 ; light_index < RGBLED_NUM ; ++light_index ) {
for (uint8_t light_index = 0; light_index < RGBLED_NUM; ++light_index) {
if (lights[light_index].enabled && timer_elapsed(lights[light_index].timer) > 10) {
rgblight_fadeout *light = &lights[light_index];
litup = true;
rgblight_fadeout *light = &lights[light_index];
litup = true;
if (light->life) {
light->life -= 1;
if (biton32(layer_state) == 0) {
sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]);
if (light->life) {
light->life -= 1;
if (biton32(layer_state) == 0) {
sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]);
}
light->timer = timer_read();
} else {
if (light->enabled && biton32(layer_state) == 0) {
rgblight_sethsv_default_helper(light_index);
}
litup = light->enabled = false;
}
light->timer = timer_read();
}
else {
if (light->enabled && biton32(layer_state) == 0) {
rgblight_sethsv_default_helper(light_index);
}
litup = light->enabled = false;
}
}
}
if (litup && biton32(layer_state) == 0) {
@ -161,39 +157,37 @@ 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 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 (lights[index].enabled) {
if (min_life_index == -1 ||
lights[index].life < min_life)
{
min_life = lights[index].life;
min_life_index = index;
for (uint8_t index = 0; index < RGBLED_NUM; ++index) {
if (rgblight_twinkle_is_led_used(index)) {
continue;
}
if (lights[index].enabled) {
if (min_life_index == -1 || lights[index].life < min_life) {
min_life = lights[index].life;
min_life_index = index;
}
continue;
}
continue;
}
indices[indices_count] = index;
++indices_count;
indices[indices_count] = index;
++indices_count;
}
uint8_t light_index;
if (!indices_count) {
light_index = min_life_index;
}
else {
light_index = indices[rand() % indices_count];
} else {
light_index = indices[rand() % indices_count];
}
rgblight_fadeout *light = &lights[light_index];
light->enabled = true;
light->timer = timer_read();
light->life = 0xC0 + rand() % 0x40;
light->enabled = true;
light->timer = timer_read();
light->life = 0xC0 + rand() % 0x40;
light->hue = rgblight_config.hue + (rand() % 0xB4) - 0x54;
@ -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,9 +207,12 @@ 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;
#endif // RGBLIGHT_TWINKLE
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)
if (record->event.pressed) {
@ -224,41 +220,48 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
eeconfig_update_user(userspace_config.raw);
if (userspace_config.rgb_layer_change) {
layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
}
}
#endif // RGBLIGHT_ENABLE
return false; break;
#endif // RGBLIGHT_ENABLE
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
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
if (userspace_config.rgb_layer_change) {
userspace_config.rgb_layer_change = false;
xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
eeconfig_update_user(userspace_config.raw);
}
}
return true; break;
#endif // RGBLIGHT_ENABLE
}
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;
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
for (uint16_t i = 255; i > 0; i--) {
rgblight_sethsv_noeeprom( ( i + old_hue) % 255, 255, 255);
rgblight_sethsv_noeeprom((i + old_hue) % 255, 255, 255);
matrix_scan();
wait_ms(10);
}
}
if (!is_enabled) {
rgblight_disable_noeeprom();
}
#endif
layer_state_set_user(layer_state);
}
@ -266,15 +269,13 @@ void keyboard_post_init_rgb(void) {
void matrix_scan_rgb(void) {
#ifdef RGBLIGHT_TWINKLE
scan_rgblight_fadeout();
#endif // RGBLIGHT_ENABLE
#endif // RGBLIGHT_ENABLE
#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) {
@ -307,40 +308,73 @@ layer_state_t layer_state_set_rgb(layer_state_t state) {
rgblight_sethsv_noeeprom_red();
rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2);
break;
default: // for any other layers, or the default layer
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
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;
}
}
#endif // RGBLIGHT_ENABLE
#endif // RGBLIGHT_ENABLE
return 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++) {
if (HAS_FLAGS(g_led_config.flags[i], led_type)) {
rgb_matrix_set_color( i, red, green, blue );
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, 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

@ -1,23 +1,23 @@
#pragma once
#include "quantum.h"
#ifdef RGB_MATRIX_ENABLE
#include "rgb_matrix.h"
# include "rgb_matrix.h"
#endif
typedef struct {
bool enabled;
uint8_t hue;
bool enabled;
uint8_t hue;
uint16_t timer;
uint8_t life;
uint8_t life;
} rgblight_fadeout;
bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record);
void scan_rgblight_fadeout(void);
void keyboard_post_init_rgb(void);
void matrix_scan_rgb(void);
bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record);
void scan_rgblight_fadeout(void);
void keyboard_post_init_rgb(void);
void matrix_scan_rgb(void);
layer_state_t layer_state_set_rgb(layer_state_t state);
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 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[NUM_OF_DIABLO_KEYS];
//define diablo macro timer variables
diablo_timer_t diablo_timer[4];
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

@ -1,22 +1,30 @@
#pragma once
#include "drashna.h"
//define diablo macro timer variables
// define diablo macro timer variables
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
};
#endif // TAP_DANCE_ENABLE
// clang-format on
#endif // TAP_DANCE_ENABLE

View File

@ -6,9 +6,10 @@ arguments, we need a wrapper in order for these definitions to be
expanded before being used as arguments to the LAYOUT_xxx macro.
*/
#if (!defined(LAYOUT) && defined(KEYMAP))
# define LAYOUT KEYMAP
# 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