forked from mirrors/qmk_userspace
Yet another update to drashna keymaps and userspace (#3787)
* Make tap function inline * Use better makefile keyboard detection * Remove Copy-Paste macro * Add F11/F12 to Iris * Minor tweaks to userspace config * Set audio clicky randomness to 1.5 * Set NO_DEBUG to only be set if console is not enabled * Move NO_MUSIC_MODE to userspace config.h * Reduce Ergodox Debounce * Add Planck Light config * Use OSM for ortho 4x12 * Music Mode changes for planck light * Cleanup do to shutdown user and other fixes in Master * Add and use 'shutdown_user' fzunction * Remove global NO_MUSIC_MODE define * Add NO_MUSIC_MODE to individual keymaps * Change layer colors * Remove NO_PRINT and NO_DEBUG from userspace config.h Since these are automatically disabled if the console isn't enabled. * Remove backlight code if backlight isn't enabled * Remove Twinkle from Ergodox * Disable RGB twinkling and enable PSM * Clean up RGB matrix code * Clean up planck light indicators * Clean up tap code * Rules cleanup for ortho 4x12 * Fix up userspace template * Revert "Clean up tap code" This reverts commit 09f64d6d67aa021c3b5ac86a9a739a5ca2b9c1ec. * Organize includes * userspace cleanup * Fix modifier spelling error * Fix userspace rules * Disable Permissive Hold again * Minor clean up * Fix Tap stuff * Viterbi Updates for file size
This commit is contained in:
parent
661ca4440c
commit
e4bbe057f2
19 changed files with 280 additions and 222 deletions
|
@ -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) {
|
||||
|
@ -93,6 +90,9 @@ void matrix_init_keymap(void) {}
|
|||
__attribute__ ((weak))
|
||||
void startup_keymap(void) {}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void shutdown_keymap(void) {}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void suspend_power_down_keymap(void) {}
|
||||
|
||||
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue