diff options
Diffstat (limited to 'users/mtdjr')
-rw-r--r-- | users/mtdjr/mtdjr.c | 122 | ||||
-rw-r--r-- | users/mtdjr/mtdjr.h | 85 | ||||
-rw-r--r-- | users/mtdjr/solenoid.h | 14 |
3 files changed, 131 insertions, 90 deletions
diff --git a/users/mtdjr/mtdjr.c b/users/mtdjr/mtdjr.c index da4f570477..1d47d88ee0 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 diff --git a/users/mtdjr/mtdjr.h b/users/mtdjr/mtdjr.h index 012a356101..3efcb45ec2 100644 --- a/users/mtdjr/mtdjr.h +++ b/users/mtdjr/mtdjr.h @@ -3,61 +3,79 @@ #include "quantum.h" -#define _QWERTY 0 -#define _LOWER 1 -#define _RAISE 2 -#define _SUPER 3 -#define _ADJUST 16 - -enum user_layers { +// Layers +enum user_enum { + // Layers QWERTY = SAFE_RANGE, LOWER, RAISE, SUPER, ADJUST, + // Solenoid + SOLENOID_TOG, + SOLENOID_DWELL_MINUS, + SOLENOID_DWELL_PLUS, + SOLENOID_BUZZ_ON, + SOLENOID_BUZZ_OFF, }; +// Macro / Send String +enum user_macros { + ROOT, + PPLY, + PSEF, +}; + +// TapDance enum user_tapdance { TD_ENDLOCK, TD_ALTLOCK, + TD_PRINT, TD_ESC, }; -enum user_solenoid { - SOLENOID_TOG, - SOLENOID_DWELL_MINUS, - SOLENOID_DWELL_PLUS, - SOLENOID_BUZZ_ON, - SOLENOID_BUZZ_OFF, -}; -#define KC_STOG SOLENOID_TOG -#define KC_SDM SOLENOID_DWELL_MINUS -#define KC_SDP SOLENOID_DWELL_PLUS -#define KC_SBON SOLENOID_BUZZ_ON -#define KC_SBOF SOLENOID_BUZZ_OFF +// Layers +#define _QWERTY 0 +#define _LOWER 1 +#define _RAISE 2 +#define _SUPER 3 +#define _ADJUST 16 + +// Macros +#define KC_ROOT M(ROOT) +#define KC_PPLY M(PPLY) +#define KC_PSEF M(PSEF) +// Tapdance +#define KC_EXC TD(TD_ESC) +#define KC_ELCK TD(TD_ENDLOCK) +#define KC_ALCK TD(TD_ALTLOCK) +#define KC_MPNT TD(TD_PRINT) + +// Custom Keycodes #define KC_ KC_TRNS #define _______ KC_TRNS #define XXXXXXX KC_NO #define KC_xxxx KC_NO - #define KC_LOWR LOWER #define KC_RASE RAISE #define KC_SUPR SUPER #define KC_RST RESET -// TapDance Keycodes -#define KC_EXC TD_ESC +// Key Combos +#define KC_XCPY LCTL(KC_INS) +#define KC_XINS LSFT(KC_INS) +#define KC_CAD LCTL(LALT(KC_DEL)) +#define KC_XCAD LCTL(LALT(KC_DEL)) +#define KC_XLCK LGUI(KC_L) -// Macro Declarations -#define KC_ROOT M(0) -#define KC_PPLY M(1) -#define KC_PSEF M(2) -#define KC_XCPY M(3) -#define KC_XINS M(4) -#define KC_CAD M(5) -#define UM_LOCK M(6) +// Solenoid +#define KC_STOG SOLENOID_TOG +#define KC_SDM SOLENOID_DWELL_MINUS +#define KC_SDP SOLENOID_DWELL_PLUS +#define KC_SBON SOLENOID_BUZZ_ON +#define KC_SBOF SOLENOID_BUZZ_OFF // RGB and Backlighting #define KC_RGB RGB_TOG @@ -67,10 +85,17 @@ enum user_solenoid { #define KC_RSAD RGB_SAD #define KC_RVAI RGB_VAI #define KC_RVAD RGB_VAD +#define KC_MOD RGB_MOD +#define KC_RMOD RGB_RMOD +#define KC_RPLN RGB_M_P +#define KC_RBTH RGB_M_B #define KC_BLT BL_TOGG #define KC_BLS BL_STEP #define KC_BLI BL_INC #define KC_BLD BL_DEC +#define KC_BLB BL_BRTG +#define KC_BLON BL_ON +#define KB_BLOF BL_OFF #endif diff --git a/users/mtdjr/solenoid.h b/users/mtdjr/solenoid.h index 38066f4c39..a911bf794f 100644 --- a/users/mtdjr/solenoid.h +++ b/users/mtdjr/solenoid.h @@ -4,13 +4,17 @@ #include <timer.h> #include "pincontrol.h" + #define SOLENOID_DEFAULT_DWELL 12 #define SOLENOID_MAX_DWELL 100 #define SOLENOID_MIN_DWELL 4 #ifndef SOLENOID_ACTIVE #define SOLENOID_ACTIVE false #endif -//#define SOLENOID_PIN F6 +#ifndef SOLENOID_PIN + #define SOLENOID_PIN F6 +#endif + bool solenoid_enabled = SOLENOID_ACTIVE; bool solenoid_on = false; @@ -92,12 +96,4 @@ void solenoid_setup(void) { pinMode(SOLENOID_PIN, PinDirectionOutput); } -void matrix_init_user(void) { - solenoid_setup(); -} - -void matrix_scan_user(void) { - solenoid_check(); -} - #endif |