Update to drashna userspace and keymaps (#3172)

* Use string with delay

* Add skipped region to ergodox

* Add send string config

* Use default_layer_state instead of function

* Fully generalize keyboards

* old iris cleanup

* Fix Drashna keymap compile issues

By checking to see if secret.c exists before actually trying to add it

* Remove unnecessary references

* Add 4x12 ortho board

* Update userspace readme for secrets

* Make RGB more modular

* Fix iris keymap, since we don't need the lower left (Function keys)

* Fix includes

* Add Blanks

* Fix Ergodox lower layer

* Add suspend commands

* Add Maltron Layout

* Add additional layouts

* Finish adding gamepad to Iris

* Tweaks to iris gamepag layer

* make gaming layers more friendly

* minor gaming layer tweak

* Add Carplax

* Add modded key timer function

* Cleanup and macro documentation

* Add QMK DFU info

* Add 'old' keymap for 12 LED spare

* Update Pro Micro documentation

* Disable twinkling so it fits in firmware space

* Switch to QMK DFU bootloader, since it's better anyhow

* Write default layer state colors to EEPROM

Since we are writing to EEPROM anyways, and this way, it sticks on reboot

* Fix QMK DFU bootloader options

* More updates for QMK DFU support

* Use matrix scanning hack for startup_user until #3113 gets merged

* Fix indicator light consistency issue

* Add/readd ifdefs to indicators

* Add/readd alt indicator

* Remove RGB Twinkling from Viterbi macro pad

* Fix default layer color detection

* Fix rebase and detection issues

* Cleanup code so it will compile if RGBLIGHT is disabled

* Revert vsode settings

* Use Pragma Once instead of boilerplate code
This commit is contained in:
Drashna Jaelre 2018-07-16 18:04:32 -07:00 committed by Jack Humbert
parent e0c9cfad86
commit b2877470ce
28 changed files with 882 additions and 300 deletions

View file

@ -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
@ -56,6 +90,15 @@ void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); };
__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) {}
@ -69,11 +112,17 @@ 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.