summaryrefslogtreecommitdiff
path: root/users/drashna
diff options
context:
space:
mode:
Diffstat (limited to 'users/drashna')
-rw-r--r--users/drashna/config.h6
-rw-r--r--users/drashna/drashna.c96
-rw-r--r--users/drashna/drashna.h138
-rw-r--r--users/drashna/readme.md94
-rw-r--r--users/drashna/rgb_stuff.c147
-rw-r--r--users/drashna/rules.mk9
6 files changed, 388 insertions, 102 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h
index 26c989d7f5..87050fbcc7 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -1,5 +1,4 @@
-#ifndef USERSPACE_CONFIG_H
-#define USERSPACE_CONFIG_H
+#pragma once
#ifdef AUDIO_ENABLE
@@ -71,5 +70,6 @@
#define DISABLE_LEADER
-#endif // !USERSPACE_CONFIG_H
+#define MACRO_TIMER 5
+
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 8efd99f805..f72902f0b0 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -38,7 +38,7 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
clear_keyboard();
tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER);
wait_ms(50);
- send_string(str);
+ send_string_with_delay(str, MACRO_TIMER);
wait_ms(50);
tap(KC_ENTER);
}
@@ -48,6 +48,40 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); };
+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();
+ } else {
+ if (timer_elapsed(this_timer) < TAPPING_TERM){
+ register_code(code);
+ unregister_code(code);
+ } else {
+ register_code(mod_code);
+ register_code(code);
+ unregister_code(code);
+ unregister_code(mod_code);
+ }
+ }
+ 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();
+ } else {
+ if (timer_elapsed(this_timer) < TAPPING_TERM){
+ register_code(code);
+ unregister_code(code);
+ } else {
+ register_code(mod_code);
+ register_code(code);
+ unregister_code(code);
+ unregister_code(mod_code);
+ }
+ }
+ return false;
+}
// Add reconfigurable functions here, for keymap customization
// This allows for a global, userspace functions, and continued
@@ -57,6 +91,15 @@ __attribute__ ((weak))
void matrix_init_keymap(void) {}
__attribute__ ((weak))
+void startup_keymap(void) {}
+
+__attribute__ ((weak))
+void suspend_power_down_keymap(void) {}
+
+__attribute__ ((weak))
+void suspend_wakeup_init_keymap(void) {}
+
+__attribute__ ((weak))
void matrix_scan_keymap(void) {}
__attribute__ ((weak))
@@ -69,12 +112,18 @@ bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
return true;
}
+
__attribute__ ((weak))
uint32_t layer_state_set_keymap (uint32_t state) {
return state;
}
__attribute__ ((weak))
+uint32_t default_layer_state_set_keymap (uint32_t state) {
+ return state;
+}
+
+__attribute__ ((weak))
void led_set_keymap(uint8_t usb_led) {}
@@ -99,14 +148,38 @@ void matrix_init_user(void) {
#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
set_unicode_input_mode(UC_WINC);
#endif //UNICODE_ENABLE
- matrix_init_rgb();
matrix_init_keymap();
}
+void startup_user (void) {
+ #ifdef RGBLIGHT_ENABLE
+ matrix_init_rgb();
+ #endif //RGBLIGHT_ENABLE
+ startup_keymap();
+}
+
+void suspend_power_down_user(void)
+{
+ suspend_power_down_keymap();
+}
+
+void suspend_wakeup_init_user(void)
+{
+ suspend_wakeup_init_keymap();
+ #ifdef KEYBOARD_ergodox_ez
+ wait_ms(10);
+ #endif
+}
+
// No global matrix scan code, so just run keymap's matrix
// scan function
void matrix_scan_user(void) {
+ static bool has_ran_yet;
+ if (!has_ran_yet) {
+ has_ran_yet = true;
+ startup_user();
+ }
#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
run_diablo_macro_check();
@@ -160,7 +233,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
if (!record->event.pressed) {
- SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
+ send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP
#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
":dfu"
#elif defined(BOOTLOADER_HALFKAY)
@@ -168,7 +241,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#elif defined(BOOTLOADER_CATERINA)
":avrdude"
#endif // bootloader options
- SS_TAP(X_ENTER));
+ SS_TAP(X_ENTER)), 10);
}
return false;
break;
@@ -197,7 +270,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case VRSN: // Prints firmware version
if (record->event.pressed) {
- SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE);
+ send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), MACRO_TIMER);
}
return false;
break;
@@ -256,7 +329,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
diablo_key_time[dtime] = diablo_times[0];
}
}
-#endif // TAP_DANCE_ENABLE#endif
+#endif // TAP_DANCE_ENABLE
return false; break;
@@ -314,7 +387,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif // UNICODE_ENABLE
}
- return process_record_keymap(keycode, record) && process_record_secrets(keycode, record) && process_record_user_rgb(keycode, record);
+ return process_record_keymap(keycode, record) &&
+#ifdef RGBLIGHT_ENABLE
+ process_record_user_rgb(keycode, record) &&
+#endif // RGBLIGHT_ENABLE
+ process_record_secrets(keycode, record);
}
@@ -331,6 +408,11 @@ uint32_t layer_state_set_user(uint32_t state) {
}
+uint32_t default_layer_state_set_kb(uint32_t state) {
+ return default_layer_state_set_keymap (state);
+}
+
+
// Any custom LED code goes here.
// So far, I only have keyboard specific code,
// So nothing goes here.
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index e035b86fbf..3efef57046 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define USERSPACE
#include "quantum.h"
+
// Define layer names
enum userspace_layers {
_QWERTY = 0,
@@ -53,8 +54,8 @@ void rgblight_sethsv_default_helper(uint8_t index);
#endif // RGBLIGHT_ENABLE
void tap(uint16_t keycode);
-bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
-
+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);
#define EECONFIG_USERSPACE (uint8_t *)19
@@ -69,15 +70,15 @@ typedef union {
} userspace_config_t;
enum userspace_custom_keycodes {
- EPRM = SAFE_RANGE, // can always be here
- VRSN,
- KC_QWERTY,
- KC_COLEMAK,
- KC_DVORAK,
- KC_WORKMAN,
- KC_DIABLO_CLEAR,
- KC_OVERWATCH,
- KC_SALT,
+ EPRM = SAFE_RANGE, // Resets EEPROM do defaults (as in eeconfig_init)
+ VRSN, // 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_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,
@@ -88,27 +89,28 @@ enum userspace_custom_keycodes {
KC_AIM,
KC_C9,
KC_GGEZ,
- KC_MAKE,
- KC_RESET,
- KC_RGB_T,
- KC_SECRET_1,
- KC_SECRET_2,
- KC_SECRET_3,
- KC_SECRET_4,
- KC_SECRET_5,
- KC_CCCV,
- KC_NUKE,
+ KC_MAKE, // Run keyboard's customized make command
+ KC_RESET, // Resets keyboard, with red underglow
+ 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!!!
#ifdef UNICODE_ENABLE
- UC_FLIP,
+ UC_FLIP, // Table flip (not working?)
#endif //UNICODE_ENABLE
- NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes
+ NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes
};
#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
#define ADJUST MO(_ADJUST)
-
+#define TG_MODS TG(_MODS)
+#define TG_GAME TG(_GAMEPAD)
#define KC_SEC1 KC_SECRET_1
#define KC_SEC2 KC_SECRET_2
@@ -184,7 +186,7 @@ enum {
#define LAYOUT_ergodox_pretty_wrapper(...) LAYOUT_ergodox_pretty(__VA_ARGS__)
#define KEYMAP_wrapper(...) LAYOUT(__VA_ARGS__)
#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
-
+#define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__)
// Blocks for each of the four major keyboard layouts
// Organized so we can quickly adapt and modify all of them
@@ -237,7 +239,7 @@ enum {
#define _________________WORKMAN_R1________________ KC_J, KC_F, KC_U, KC_P, KC_SCLN
#define _________________WORKMAN_R2________________ KC_Y, KC_N, KC_E, KC_O, KC_I
-#define _________________WORKMAN_R3________________ KC_K, KC_L, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
+#define _________________WORKMAN_R3________________ KC_K, KC_L, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
#define _________________NORMAN_L1_________________ KC_Q, KC_W, KC_D, KC_F, KC_K
@@ -248,11 +250,89 @@ enum {
#define _________________NORMAN_R2_________________ KC_Y, KC_N, KC_I, KC_O, KC_U
#define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
+
+#define _________________MALTRON_L1________________ KC_Q, KC_P, KC_Y, KC_C, KC_B
+#define _________________MALTRON_L2________________ KC_A, KC_N, KC_I, KC_S, KC_F
+#define _________________MALTRON_L3________________ CTL_T(KC_SCLN), KC_SLSH, KC_J KC_G, KC_COMM
+
+#define _________________MALTRON_R1________________ KC_V, KC_M, KC_U, KC_Z, KC_L
+#define _________________MALTRON_R2________________ KC_D, KC_T, KC_D, KC_O, KC_R
+#define _________________MALTRON_R3________________ KC_DOT, KC_W, KC_K, KC_MINS, CTL_T(KC_x)
+
+
+#define _________________EUCALYN_L1________________ KC_SLSH, KC_COMM, KC_DOT, KC_F, KC_Q
+#define _________________EUCALYN_L2________________ KC_A, KC_O, KC_E, KC_I, KC_U
+#define _________________EUCALYN_L3________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_W
+
+#define _________________EUCALYN_R1________________ KC_M, KC_R, KC_D, KC_Y, KC_P
+#define _________________EUCALYN_R2________________ KC_G, KC_T, KC_K, KC_S, KC_N
+#define _________________EUCALYN_R3________________ KC_B, KC_H, KC_J, KC_L, CTL_T(KC_SCLN)
+
+
+#define _____________CARPLAX_QFMLWY_L1_____________ KC_Q, KC_F, KC_M, KC_L, KC_W
+#define _____________CARPLAX_QFMLWY_L2_____________ KC_D, KC_S, KC_T, KC_N, KC_R
+#define _____________CARPLAX_QFMLWY_L3_____________ CTL_T(KC_Z), KC_V, KC_G, KC_C, KC_X
+
+#define _____________CARPLAX_QFMLWY_R1_____________ KC_Y, KC_U, KC_O, KC_B, KC_J
+#define _____________CARPLAX_QFMLWY_R2_____________ KC_I, KC_A, KC_E, KC_H, KC_SCLN
+#define _____________CARPLAX_QFMLWY_R3_____________ KC_P, KC_K, KC_COMM, KC_DOT, CTL_T(KC_SLSH)
+
+
+#define _____________CARPLAX_QGMLWB_L1_____________ KC_Q, KC_G, KC_M, KC_L, KC_W
+#define _____________CARPLAX_QGMLWB_L2_____________ KC_D, KC_S, KC_T, KC_N, KC_R
+#define _____________CARPLAX_QGMLWB_L3_____________ CTL_T(KC_Z), KC_X, KC_C, KC_F, KC_J
+
+#define _____________CARPLAX_QGMLWB_R1_____________ KC_B, KC_Y, KC_U, KC_V, KC_SCLN
+#define _____________CARPLAX_QGMLWB_R2_____________ KC_I, KC_A, KC_E, KC_O, KC_H
+#define _____________CARPLAX_QGMLWB_R3_____________ KC_K, KC_P, KC_COMM, KC_DOT, CTL_T(KC_SLSH)
+
+
+#define _____________CARPLAX_QGMLWY_L1_____________ KC_Q, KC_G, KC_M, KC_L, KC_W
+#define _____________CARPLAX_QGMLWY_L2_____________ KC_D, KC_S, KC_T, KC_N, KC_R
+#define _____________CARPLAX_QGMLWY_L3_____________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_J
+
+#define _____________CARPLAX_QGMLWY_R1_____________ KC_Y, KC_F, KC_U, KC_B, KC_SCLN
+#define _____________CARPLAX_QGMLWY_R2_____________ KC_I, KC_A, KC_E, KC_O, KC_H
+#define _____________CARPLAX_QGMLWY_R3_____________ KC_K, KC_P, KC_COMM, KC_DOT, CTL_T(KC_SLSH)
+
+
#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
#define _________________FUNC_RIGHT________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10
+#define ___________________BLANK___________________ _______, _______, _______, _______, _______
+
+
+#define _________________LOWER_L1__________________ KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC
+#define _________________LOWER_L2__________________ _________________FUNC_LEFT_________________
+#define _________________LOWER_L3__________________ _________________FUNC_RIGHT________________
+
+#define _________________LOWER_R1__________________ KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN
+#define _________________LOWER_R2__________________ _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR
+#define _________________LOWER_R3__________________ _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
+
+
+
+#define _________________RAISE_L1__________________ ________________NUMBER_LEFT________________
+#define _________________RAISE_L2__________________ ___________________BLANK___________________
+#define _________________RAISE_L3__________________ ___________________BLANK___________________
+
+#define _________________RAISE_R1__________________ ________________NUMBER_RIGHT_______________
+#define _________________RAISE_R2__________________ _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC
+#define _________________RAISE_R3__________________ _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
+
+
+
+#define _________________ADJUST_L1_________________ RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG
+#define _________________ADJUST_L2_________________ _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM
+#define _________________ADJUST_L3_________________ RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T
+
+#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
+
+
// Since we have 4 default layouts (QWERTY, DVORAK, COLEMAK and WORKMAN),
// this allows us to quickly modify the bottom row for all of the layouts
// so we don't have to alter it 4 times and hope that we haven't missed
@@ -261,7 +341,11 @@ enum {
#define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
-#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), OSM(MOD_LGUI), OSM(MOD_RGUI), CTL_T(KC_ESCAPE), \
+#define ___________ORTHODOX_THUMP_TOP_____________ ALT_APP, OS_LGUI, KC_LALT, OS_RGUI
+#define ___________________ORTHODOX_THUMB_BOTTOM____________________ LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE
+
+
+#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), OSM(MOD_LGUI), OSM(MOD_RGUI), CTL_T(KC_ESCAPE), \
KC_HOME, KC_PGUP, \
LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER)
diff --git a/users/drashna/readme.md b/users/drashna/readme.md
index 0aa73ece90..179960322a 100644
--- a/users/drashna/readme.md
+++ b/users/drashna/readme.md
@@ -75,11 +75,12 @@ For critics that think this is cheating, search "diablo 3 num lock auto cast".
Secret Macros
-------------
-With help from gitter and Colinta, this adds the ability to add hidden strings to be used for macros.
+With help from gitter and Colinta, this adds the ability to add hidden macros from other users.
-I have a number of long strings that I need to use that are semi-private. This uses the `__has_include` function to check for the file. If it exists, then it includes the custom text. Otherwise, it uses some default values.
+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.
-If you would *also* like to take advantage of this feature, you'll first want to make sure your "secrets" file isn't included in the repo. Open `.git/info/exclude` and add `secrets.h` to that file, below the comments.
###### .git/info/exclude
```
@@ -89,10 +90,44 @@ If you would *also* like to take advantage of this feature, you'll first want to
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
+/users/drashna/secrets.c
/users/drashna/secrets.h
```
-Then you can create this file and add your macro strings to it:
+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
@@ -107,36 +142,33 @@ static const char * const secrets[] = {
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
-
-#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 secrets[] = {
- "test1",
- "test2",
- "test3",
- "test4",
- "test5"
-};
-#endif
+__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, you'll want to add this block:
+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
- case KC_SECRET_1 ... KC_SECRET_5:
- if (!record->event.pressed) {
- send_string_P(secret[keycode - KC_SECRET_1]);
- }
- return false;
- break;
+ return process_record_keymap(keycode, record) && process_record_secrets(keycode, record);
+}
```
-And this requires `KC_SECRET_1` through `KC_SECRET_5` to be defined in your `<name>.h` file fo the new macros, as well.
+###### 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:
+```c
+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:
```c
@@ -181,15 +213,15 @@ 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:
+What worked to get into the firmware properly was:
```
-Low: 0x5E High: 0x99 Extended: 0xF3 Lock: 0xFF
+Low: 0x5E High: 0xD9 Extended: 0xC3 Lock: 0x3F
```
-But some of the columns and rows didn't work, like the pin mapping was wrong. Even when setting the bootloader settings.
-
- This is here for future reference. And the default fuse settings I believe were:
+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
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index af7190cc3e..f2a9a47a90 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -1,5 +1,6 @@
#include "drashna.h"
#include "rgb_stuff.h"
+#include "eeprom.h"
extern rgblight_config_t rgblight_config;
extern userspace_config_t userspace_config;
@@ -22,25 +23,64 @@ uint8_t current_osm;
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 & MODS_SHIFT_MASK || this_led & (1<<USB_LED_CAPS_LOCK) || this_osm & MODS_SHIFT_MASK) {
- rgblight_sethsv_at(0, 255, 255, SHFT_LED1);
- rgblight_sethsv_at(0, 255, 255, SHFT_LED2);
+ #ifdef SHFT_LED1
+ rgblight_sethsv_at(120, 255, 255, SHFT_LED1);
+ #endif // SHFT_LED1
+ #ifdef SHFT_LED2
+ rgblight_sethsv_at(120, 255, 255, SHFT_LED2);
+ #endif // SHFT_LED2
} else {
- rgblight_sethsv_default_helper(SHFT_LED1);
- rgblight_sethsv_default_helper(SHFT_LED2);
+ #ifdef SHFT_LED1
+ rgblight_sethsv_default_helper(SHFT_LED1);
+ #endif // SHFT_LED1
+ #ifdef SHFT_LED2
+ rgblight_sethsv_default_helper(SHFT_LED2);
+ #endif // SHFT_LED2
}
if (this_mod & MODS_CTRL_MASK || this_osm & MODS_CTRL_MASK) {
- rgblight_sethsv_at(51, 255, 255, CTRL_LED1);
- rgblight_sethsv_at(51, 255, 255, CTRL_LED2);
+ #ifdef CTRL_LED1
+ rgblight_sethsv_at(0, 255, 255, CTRL_LED1);
+ #endif // CTRL_LED1
+ #ifdef CTRL_LED2
+ rgblight_sethsv_at(0, 255, 255, CTRL_LED2);
+ #endif // CTRL_LED2
} else {
- rgblight_sethsv_default_helper(CTRL_LED1);
- rgblight_sethsv_default_helper(CTRL_LED2);
+ #ifdef CTRL_LED1
+ rgblight_sethsv_default_helper(CTRL_LED1);
+ #endif // CTRL_LED1
+ #ifdef CTRL_LED2
+ rgblight_sethsv_default_helper(CTRL_LED2);
+ #endif // CTRL_LED2
}
if (this_mod & MODS_GUI_MASK || this_osm & MODS_GUI_MASK) {
- rgblight_sethsv_at(120, 255, 255, GUI_LED1);
- rgblight_sethsv_at(120, 255, 255, GUI_LED2);
+ #ifdef GUI_LED1
+ rgblight_sethsv_at(51, 255, 255, GUI_LED1);
+ #endif // GUI_LED1
+ #ifdef GUI_LED2
+ rgblight_sethsv_at(51, 255, 255, GUI_LED2);
+ #endif // GUI_LED2
} else {
- rgblight_sethsv_default_helper(GUI_LED1);
- rgblight_sethsv_default_helper(GUI_LED2);
+ #ifdef GUI_LED1
+ rgblight_sethsv_default_helper(GUI_LED1);
+ #endif // GUI_LED1
+ #ifdef GUI_LED2
+ rgblight_sethsv_default_helper(GUI_LED2);
+ #endif // GUI_LED2
+ }
+ if (this_mod & MODS_ALT_MASK || this_osm & MODS_ALT_MASK) {
+ #ifdef ALT_LED1
+ rgblight_sethsv_at(240, 255, 255, ALT_LED1);
+ #endif // ALT_LED1
+ #ifdef GUI_LED2
+ rgblight_sethsv_at(240, 255, 255, ALT_LED2);
+ #endif // GUI_LED2
+ } else {
+ #ifdef GUI_LED1
+ rgblight_sethsv_default_helper(ALT_LED1);
+ #endif // GUI_LED1
+ #ifdef GUI_LED2
+ rgblight_sethsv_default_helper(ALT_LED2);
+ #endif // GUI_LED2
}
}
}
@@ -63,7 +103,48 @@ void matrix_scan_indicator(void) {
static rgblight_fadeout lights[RGBLED_NUM];
__attribute__ ((weak))
-bool indicator_is_this_led_used(uint8_t index) { return false; }
+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
+ case SHFT_LED1:
+ return true;
+#endif //SHFT_LED1
+#ifdef SHFT_LED2
+ case SHFT_LED2:
+ return true;
+#endif //SHFT_LED2
+#ifdef CTRL_LED1
+ case CTRL_LED1:
+ return true;
+#endif //CTRL_LED1
+#ifdef CTRL_LED2
+ case CTRL_LED2:
+ return true;
+#endif //CTRL_LED2
+#ifdef GUI_LED1
+ case GUI_LED1:
+ return true;
+#endif //GUI_LED1
+#ifdef GUI_LED2
+ case GUI_LED2:
+ return true;
+#endif //GUI_LED2
+#ifdef ALT_LED1
+ case ALT_LED1:
+ return true;
+#endif //ALT_LED1
+#ifdef ALT_LED2
+ case ALT_LED2:
+ return true;
+#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
bool litup = false;
@@ -97,7 +178,7 @@ void start_rgb_light(void) {
uint8_t min_life = 0xFF;
uint8_t min_life_index = -1;
for (uint8_t index = 0 ; index < RGBLED_NUM ; ++index ) {
- if (indicator_is_this_led_used(index)) { continue; }
+ if (rgblight_twinkle_is_led_used(index)) { continue; }
if (lights[index].enabled) {
if (min_life_index == -1 ||
lights[index].life < min_life)
@@ -181,16 +262,16 @@ void matrix_init_rgb(void) {
#endif
if (userspace_config.rgb_layer_change) {
- uint8_t default_layer = eeconfig_read_default_layer();
rgblight_enable_noeeprom();
- if (default_layer & (1UL << _COLEMAK)) {
- rgblight_sethsv_magenta();
- } else if (default_layer & (1UL << _DVORAK)) {
- rgblight_sethsv_green();
- } else if (default_layer & (1UL << _WORKMAN)) {
- rgblight_sethsv_goldenrod();
- } else {
- rgblight_sethsv_cyan();
+ switch (biton32(eeconfig_read_default_layer())) {
+ case _COLEMAK:
+ rgblight_sethsv_noeeprom_magenta(); break;
+ case _DVORAK:
+ rgblight_sethsv_noeeprom_green(); break;
+ case _WORKMAN:
+ rgblight_sethsv_noeeprom_goldenrod(); break;
+ default:
+ rgblight_sethsv_noeeprom_cyan(); break;
}
}
}
@@ -209,7 +290,6 @@ void matrix_scan_rgb(void) {
uint32_t layer_state_set_rgb(uint32_t state) {
#ifdef RGBLIGHT_ENABLE
- uint8_t default_layer = eeconfig_read_default_layer();
if (userspace_config.rgb_layer_change) {
switch (biton32(state)) {
case _MACROS:
@@ -241,14 +321,15 @@ uint32_t layer_state_set_rgb(uint32_t state) {
rgblight_mode_noeeprom(23);
break;
default: // for any other layers, or the default layer
- if (default_layer & (1UL << _COLEMAK)) {
- rgblight_sethsv_noeeprom_magenta();
- } else if (default_layer & (1UL << _DVORAK)) {
- rgblight_sethsv_noeeprom_green();
- } else if (default_layer & (1UL << _WORKMAN)) {
- rgblight_sethsv_noeeprom_goldenrod();
- } else {
- rgblight_sethsv_noeeprom_cyan();
+ switch (biton32(default_layer_state)) {
+ case _COLEMAK:
+ rgblight_sethsv_noeeprom_magenta(); break;
+ case _DVORAK:
+ rgblight_sethsv_noeeprom_green(); break;
+ case _WORKMAN:
+ rgblight_sethsv_noeeprom_goldenrod(); break;
+ default:
+ rgblight_sethsv_noeeprom_cyan(); break;
}
biton32(state) == _MODS ? rgblight_mode_noeeprom(2) : rgblight_mode_noeeprom(1); // if _MODS layer is on, then breath to denote it
break;
@@ -259,3 +340,5 @@ uint32_t layer_state_set_rgb(uint32_t state) {
return state;
}
+
+
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index 18df665c0d..e299f24a1e 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -1,5 +1,9 @@
-SRC += drashna.c secrets.c rgb_stuff.c
+SRC += drashna.c
+
+ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
+ SRC += secrets.c
+endif
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
SRC += tap_dances.c
@@ -11,7 +15,8 @@ ifeq ($(strip $(NO_SECRETS)), yes)
OPT_DEFS += -DNO_SECRETS
endif
-ifdef RGBLIGHT_ENABLE
+ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
+ SRC += rgb_stuff.c
ifeq ($(strip $(INDICATOR_LIGHTS)), yes)
OPT_DEFS += -DINDICATOR_LIGHTS
endif