summaryrefslogtreecommitdiff
path: root/users/drashna
diff options
context:
space:
mode:
Diffstat (limited to 'users/drashna')
-rw-r--r--users/drashna/config.h16
-rw-r--r--users/drashna/drashna.c75
-rw-r--r--users/drashna/drashna.h22
-rw-r--r--users/drashna/rgb_stuff.c6
-rw-r--r--users/drashna/rgb_stuff.h1
-rw-r--r--users/drashna/template.c97
-rw-r--r--users/drashna/template.h4
7 files changed, 124 insertions, 97 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h
index 87050fbcc7..dd6875ceb1 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -11,8 +11,10 @@
SONG(OVERWATCH_THEME) \
}
-#define AUDIO_CLICKY_FREQ_RANDOMNESS 1.0f
-
+#define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f
+// #ifdef RGBLIGHT_ENABLE
+// #define NO_MUSIC_MODE
+// #endif //RGBLIGHT_ENABLE
#endif
#ifdef RGBLIGHT_ENABLE
@@ -40,8 +42,8 @@
// and when this option isn't enabled, z rapidly followed by x
// actually sends Ctrl-x. That's bad.)
#define IGNORE_MOD_TAP_INTERRUPT
-#undef PERMISSIVE_HOLD
-#undef PREVENT_STUCK_MODIFIERS
+#undef PERMISSIVE_HOLD
+#define PREVENT_STUCK_MODIFIERS
// #define TAPPING_FORCE_HOLD
//#define RETRO_TAPPING
@@ -59,12 +61,6 @@
// Disable action_get_macro and fn_actions, since we don't use these
// and it saves on space in the firmware.
-#ifndef NO_DEBUG
-#define NO_DEBUG
-#endif // !NO_DEBUG
-#if !defined(NO_PRINT) && !defined(CONSOLE_ENABLE)
-#define NO_PRINT
-#endif // !NO_PRINT
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index f72902f0b0..20df2f4de6 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -16,16 +16,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "drashna.h"
-#include "version.h"
-#include "eeprom.h"
#include "tap_dances.h"
#include "rgb_stuff.h"
-
-float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND);
-float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND);
-
-static uint16_t copy_paste_timer;
userspace_config_t userspace_config;
// Helper Functions
@@ -35,8 +28,14 @@ userspace_config_t userspace_config;
// 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;
+ } else {
+ keycode = KC_ENTER;
+ }
clear_keyboard();
- tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER);
+ tap(keycode);
wait_ms(50);
send_string_with_delay(str, MACRO_TIMER);
wait_ms(50);
@@ -46,8 +45,6 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
return false;
}
-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) {
@@ -94,6 +91,9 @@ __attribute__ ((weak))
void startup_keymap(void) {}
__attribute__ ((weak))
+void shutdown_keymap(void) {}
+
+__attribute__ ((weak))
void suspend_power_down_keymap(void) {}
__attribute__ ((weak))
@@ -127,6 +127,7 @@ __attribute__ ((weak))
void led_set_keymap(uint8_t usb_led) {}
+
// Call user matrix init, set default RGB colors and then
// call the keymap's init function
void matrix_init_user(void) {
@@ -158,6 +159,24 @@ void startup_user (void) {
startup_keymap();
}
+void shutdown_user (void) {
+#ifdef RGBLIGHT_ENABLE
+ rgblight_enable_noeeprom();
+ rgblight_mode_noeeprom(1);
+ rgblight_setrgb_red();
+#endif // RGBLIGHT_ENABLE
+#ifdef RGB_MATRIX_ENABLE
+ rgb_led led;
+ for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ led = g_rgb_leds[i];
+ if (led.matrix_co.raw < 0xFF) {
+ rgb_matrix_set_color( i, 0xFF, 0x00, 0x00 );
+ }
+ }
+#endif //RGB_MATRIX_ENABLE
+ shutdown_keymap();
+}
+
void suspend_power_down_user(void)
{
suspend_power_down_keymap();
@@ -246,20 +265,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return false;
break;
-
- case KC_RESET: // Custom RESET code that sets RGBLights to RED
- if (!record->event.pressed) {
-#ifdef RGBLIGHT_ENABLE
- rgblight_enable_noeeprom();
- rgblight_mode_noeeprom(1);
- rgblight_setrgb_red();
-#endif // RGBLIGHT_ENABLE
- reset_keyboard();
- }
- return false;
- break;
-
-
case EPRM: // Resets EEPROM
if (record->event.pressed) {
eeconfig_init();
@@ -333,28 +338,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return false; break;
- 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(KC_C);
- unregister_code(KC_LCTL);
-#ifdef AUDIO_ENABLE
- PLAY_SONG(tone_copy);
-#endif
- } else { // Tap, paste
- register_code(KC_LCTL);
- tap(KC_V);
- unregister_code(KC_LCTL);
-#ifdef AUDIO_ENABLE
- PLAY_SONG(tone_paste);
-#endif
- }
- }
- return false;
- break;
case CLICKY_TOGGLE:
#ifdef AUDIO_CLICKY
userspace_config.clicky_enable = clicky_enable;
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index 3efef57046..dd0d1c0d7e 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -15,11 +15,13 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef USERSPACE
-#define USERSPACE
+#pragma once
#include "quantum.h"
-
-
+#include "version.h"
+#include "eeprom.h"
+#ifdef RGB_MATRIX_ENABLE
+#include "rgb_matrix.h"
+#endif
// Define layer names
enum userspace_layers {
_QWERTY = 0,
@@ -53,7 +55,7 @@ extern bool clicky_enable;
void rgblight_sethsv_default_helper(uint8_t index);
#endif // RGBLIGHT_ENABLE
-void tap(uint16_t keycode);
+inline 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);
bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
@@ -90,7 +92,6 @@ enum userspace_custom_keycodes {
KC_C9,
KC_GGEZ,
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
@@ -123,6 +124,7 @@ enum userspace_custom_keycodes {
#define COLEMAK KC_COLEMAK
#define WORKMAN KC_WORKMAN
+#define KC_RESET RESET
#define KC_RST KC_RESET
#ifdef SWAP_HANDS_ENABLE
@@ -131,6 +133,11 @@ enum userspace_custom_keycodes {
#define KC_C1R3 KC_BSPC
#endif // SWAP_HANDS_ENABLE
+#define BK_LWER LT(_LOWER, KC_BSPC)
+#define SP_LWER LT(_LOWER, KC_SPC)
+#define DL_RAIS LT(_RAISE, KC_DEL)
+#define ET_RAIS LT(_RAISE, KC_ENTER)
+
// OSM keycodes, to keep things clean and easy to change
#define KC_MLSF OSM(MOD_LSFT)
#define KC_MRSF OSM(MOD_RSFT)
@@ -325,7 +332,7 @@ enum {
#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_L2_________________ MU_TOG , 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
@@ -350,4 +357,3 @@ enum {
LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER)
-#endif // !USERSPACE
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index f2a9a47a90..03c55b1323 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -267,7 +267,7 @@ void matrix_init_rgb(void) {
case _COLEMAK:
rgblight_sethsv_noeeprom_magenta(); break;
case _DVORAK:
- rgblight_sethsv_noeeprom_green(); break;
+ rgblight_sethsv_noeeprom_springgreen(); break;
case _WORKMAN:
rgblight_sethsv_noeeprom_goldenrod(); break;
default:
@@ -313,7 +313,7 @@ uint32_t layer_state_set_rgb(uint32_t state) {
rgblight_mode_noeeprom(5);
break;
case _LOWER:
- rgblight_sethsv_noeeprom_orange();
+ rgblight_sethsv_noeeprom_green();
rgblight_mode_noeeprom(5);
break;
case _ADJUST:
@@ -325,7 +325,7 @@ uint32_t layer_state_set_rgb(uint32_t state) {
case _COLEMAK:
rgblight_sethsv_noeeprom_magenta(); break;
case _DVORAK:
- rgblight_sethsv_noeeprom_green(); break;
+ rgblight_sethsv_noeeprom_springgreen(); break;
case _WORKMAN:
rgblight_sethsv_noeeprom_goldenrod(); break;
default:
diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h
index 6426ea266f..50c75c8c3c 100644
--- a/users/drashna/rgb_stuff.h
+++ b/users/drashna/rgb_stuff.h
@@ -13,4 +13,3 @@ void matrix_init_rgb(void);
void matrix_scan_rgb(void);
uint32_t layer_state_set_rgb(uint32_t state);
-
diff --git a/users/drashna/template.c b/users/drashna/template.c
index 20dbb96d7f..e6b50c961b 100644
--- a/users/drashna/template.c
+++ b/users/drashna/template.c
@@ -1,7 +1,5 @@
-#include "drashna.h"
-#include "quantum.h"
-#include "action.h"
-#include "version.h"
+#include "template.h"
+
// Add reconfigurable functions here, for keymap customization
// This allows for a global, userspace functions, and continued
@@ -10,25 +8,15 @@
__attribute__ ((weak))
void matrix_init_keymap(void) {}
-__attribute__ ((weak))
-void matrix_scan_keymap(void) {}
-
-__attribute__ ((weak))
-bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
- return true;
-}
-__attribute__ ((weak))
-uint32_t layer_state_set_keymap (uint32_t state) {
- return state;
-}
-__attribute__ ((weak))
-void led_set_keymap(uint8_t usb_led) {}
-
// Call user matrix init, then call the keymap's init function
void matrix_init_user(void) {
matrix_init_keymap();
}
+
+__attribute__ ((weak))
+void matrix_scan_keymap(void) {}
+
// No global matrix scan code, so just run keymap's matix
// scan function
void matrix_scan_user(void) {
@@ -36,11 +24,16 @@ void matrix_scan_user(void) {
}
+__attribute__ ((weak))
+bool process_record_keymap(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 recod handier if not processed here,
// And use "NEWPLACEHOLDER" for new safe range
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
-
+
switch (keycode) {
case KC_MAKE:
if (!record->event.pressed) {
@@ -56,12 +49,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
- case KC_RESET:
- if (!record->event.pressed) {
- reset_keyboard();
- }
- return false;
- break;
+
case EPRM:
if (record->event.pressed) {
eeconfig_init();
@@ -78,13 +66,66 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return process_record_keymap(keycode, record);
}
-// Runs state check and changes underglow color and animation
-// on layer change, no matter where the change was initiated
-// Then runs keymap's layer change check
+
+__attribute__ ((weak))
+uint32_t layer_state_set_keymap (uint32_t state) {
+ return state;
+}
+
uint32_t layer_state_set_user (uint32_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();
+ #ifdef KEYBOARD_ergodox_ez
+ wait_ms(10);
+ #endif
+}
+
+
+
+__attribute__ ((weak))
+void startup_keymap(void) {}
+
+void startup_user (void) {
+ #ifdef RGBLIGHT_ENABLE
+ matrix_init_rgb();
+ #endif //RGBLIGHT_ENABLE
+ startup_keymap();
+}
+
+
+
+__attribute__ ((weak))
+void shutdown_keymap(void) {}
+
+void shutdown_user (void) {
+ shutdown_keymap();
+}
+
diff --git a/users/drashna/template.h b/users/drashna/template.h
index d1251462b2..5b3a93de5f 100644
--- a/users/drashna/template.h
+++ b/users/drashna/template.h
@@ -2,8 +2,10 @@
#define USERSPACE
#include "quantum.h"
+#include "version.h"
+#include "eeprom.h"
-// Define layer names
+// Define layer names
#define BASE 0
enum custom_keycodes {