diff options
author | mtdjr <mtdjr@users.noreply.github.com> | 2018-06-20 18:13:00 -0400 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-06-20 15:13:00 -0700 |
commit | e8eaf5630cee4f5d16b0c86627579c5a695540d5 (patch) | |
tree | 0635413c03b59dc46f7af0f36f34d4e84fa06bf0 /users/mtdjr/mtdjr.c | |
parent | f46b1db9f4997631c3e09269e51faf5f2bc3aeaf (diff) | |
download | qmk_firmware-e8eaf5630cee4f5d16b0c86627579c5a695540d5.tar.gz |
Updates to mtdjr userspace and keymaps (#3206)
* slight tweaks to xd75 keymap
* update to config.h to remove undef of solenoid active
* code organization for userspace
* updates to userspace and keymaps
* add rgb to userspace and lets split
* add conditional around rgb functions in userpsace
* move rgb layer changes into layer_state_set_user
Diffstat (limited to 'users/mtdjr/mtdjr.c')
-rw-r--r-- | users/mtdjr/mtdjr.c | 122 |
1 files changed, 71 insertions, 51 deletions
diff --git a/users/mtdjr/mtdjr.c b/users/mtdjr/mtdjr.c index da4f57047..1d47d88ee 100644 --- a/users/mtdjr/mtdjr.c +++ b/users/mtdjr/mtdjr.c @@ -2,20 +2,58 @@ #ifdef SOLENOID_ENABLE #include "solenoid.h" +#endif - void solenoid_buzz_on(void); - void solenoid_buzz_off(void); - void solenoid_dwell_minus(void); - void solenoid_dwell_plus(void); - void solenoid_toggle(void); - void solenoid_stop(void); - void solenoid_fire(void); - void solenoid_check(void); - void solenoid_setup(void); - void matrix_init_user(void); - void matrix_scan_user(void); +#ifndef RGB_MODE + #define RGB_MODE 16 +#endif +#ifndef RGB_HUE + #define RGB_HUE 285 #endif +// Tap Dance Definitions +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, KC_ESC), + [TD_ALTLOCK] = ACTION_TAP_DANCE_DOUBLE(KC_RALT, LGUI(KC_L)), + [TD_ENDLOCK] = ACTION_TAP_DANCE_DOUBLE(KC_END, LGUI(KC_L)), + [TD_PRINT] = ACTION_TAP_DANCE_DOUBLE(LGUI(LSFT(KC_3)), LGUI(LSFT(KC_4))), +}; + +// Macros +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + if (record->event.pressed) { + switch(id) { + case ROOT: + SEND_STRING("sudo su -\n"); + return false; break; + case PPLY: + SEND_STRING("puppet apply /etc/puppetlabs/code/environments/production/manifests/site.pp\n"); + return false; break; + case PSEF: + SEND_STRING("ps -ef | grep "); + return false; break; + } + } + return MACRO_NONE; +}; + +void matrix_init_user(void) { + #ifdef RGBLIGHT_ENABLE + rgblight_enable_noeeprom(); + rgblight_mode_noeeprom(RGB_MODE); + rgblight_sethsv (RGB_HUE, 255, 255); + #endif + #ifdef SOLENOID_ENABLE + solenoid_setup(); + #endif +} + +void matrix_scan_user(void) { + #ifdef SOLENOID_ENABLE + solenoid_check(); + #endif +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef SOLENOID_ENABLE if (record->event.pressed) { @@ -71,7 +109,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { solenoid_dwell_minus(); } - #endif + #endif break; case SOLENOID_DWELL_PLUS: #ifdef SOLENOID_ENABLE @@ -85,53 +123,35 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { solenoid_buzz_on(); } - #endif + #endif break; case SOLENOID_BUZZ_OFF: #ifdef SOLENOID_ENABLE if (record->event.pressed) { solenoid_buzz_off(); } - #endif + #endif break; } return true; }; - -//Tap Dance Definitions -qk_tap_dance_action_t tap_dance_actions[] = { - [TD_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, KC_ESC), - [TD_ALTLOCK] = ACTION_TAP_DANCE_DOUBLE(KC_RALT, LGUI(KC_L)), - [TD_ENDLOCK] = ACTION_TAP_DANCE_DOUBLE(KC_END, LGUI(KC_L)), - //[TD_PRNT] = ACTION_TAP_DANCE_DOUBLE(PRINT, PRINT_SEL) -}; - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { - if (record->event.pressed) { - switch(id) { - case 0: - SEND_STRING("sudo su -\n"); - return false; break; - case 1: - SEND_STRING("puppet apply /etc/puppetlabs/code/environments/production/manifests/site.pp\n"); - return false; break; - case 2: - SEND_STRING("ps -ef | grep "); - return false; break; - case 3: // control + insert - return MACRO(D(LCTL), T(INS), U(LCTL), END); - break; - case 4: // shift + insert - return MACRO(D(LSFT), T(INS), U(LSFT), END); - break; - case 5: // control + alt + delete - return MACRO(D(LCTL), D(RALT), T(DEL), U(LCTL), U(LALT), END); - break; - case 6: // lgui + L - return MACRO(D(LGUI), T(L), U(LGUI), END); - break; - } - } - return MACRO_NONE; -}; +uint32_t layer_state_set_user(uint32_t state) { +#ifdef RGBLIGHT_ENABLE + switch (biton32(state)) { + case _RAISE: + rgblight_sethsv_noeeprom (240, 255, 255); + break; + case _LOWER: + rgblight_sethsv_noeeprom (0, 255, 255); + break; + case _ADJUST: + rgblight_sethsv_noeeprom (0, 0, 255); + break; + default: + rgblight_sethsv_noeeprom (RGB_HUE, 255, 255); + break; + } + return state; +} +#endif |