diff options
author | mtdjr <mtdjr@users.noreply.github.com> | 2018-05-31 11:30:05 -0400 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-05-31 08:30:05 -0700 |
commit | ee9a7aba396160929604aca54a23ad5534d59940 (patch) | |
tree | f4fbbde03ed548a68fd56bec5c6baf8cf217f180 /keyboards/iris/keymaps/mtdjr | |
parent | 21ad968ac14b177a7c97d34106c4d6201912627f (diff) | |
download | qmk_firmware-ee9a7aba396160929604aca54a23ad5534d59940.tar.gz qmk_firmware-ee9a7aba396160929604aca54a23ad5534d59940.zip |
add not-so-minidox handwire keyboard (#3061)
* add not-so-minidox handwire keyboard
* corrected keymap
* multiple adjustments to not_so_minidox keyboard
* remove I2C master left define
* update default layer set function
* move solenoid code into userspace
* minor adjustments to config.h
* update keymaps to utilize userspace
* move features and config to userspace, correct build issue
* correct solenoid pin
* adjust defaults for solenoid pin and enable
* default solenoid to on for not_so_minidox
* disable RGBLIGHT_SLEEP for xd75
* tweaking solenoid enable/disable in userspace and keymaps
Diffstat (limited to 'keyboards/iris/keymaps/mtdjr')
-rw-r--r-- | keyboards/iris/keymaps/mtdjr/config.h | 5 | ||||
-rw-r--r-- | keyboards/iris/keymaps/mtdjr/keymap.c | 278 | ||||
-rw-r--r-- | keyboards/iris/keymaps/mtdjr/rules.mk | 1 |
3 files changed, 21 insertions, 263 deletions
diff --git a/keyboards/iris/keymaps/mtdjr/config.h b/keyboards/iris/keymaps/mtdjr/config.h index 0e8938775f..28109d3ab4 100644 --- a/keyboards/iris/keymaps/mtdjr/config.h +++ b/keyboards/iris/keymaps/mtdjr/config.h @@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "config_common.h" +#define SOLENOID_ENABLE +#define SOLENOID_PIN C6 + /* Use I2C or Serial, not both */ #define USE_SERIAL @@ -28,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* Select hand configuration */ #define MASTER_LEFT -#define TAPPING_TERM 250 + // #define MASTER_RIGHT // #define EE_HANDS diff --git a/keyboards/iris/keymaps/mtdjr/keymap.c b/keyboards/iris/keymaps/mtdjr/keymap.c index ba95d16b23..d6e3ec05e8 100644 --- a/keyboards/iris/keymaps/mtdjr/keymap.c +++ b/keyboards/iris/keymaps/mtdjr/keymap.c @@ -1,145 +1,8 @@ -#include "iris.h" -#include "action_layer.h" -#include "eeconfig.h" -#include "action_macro.h" -#include <timer.h> -#include "pincontrol.h" +#include QMK_KEYBOARD_H +#include "mtdjr.h" extern keymap_config_t keymap_config; -#define _QWERTY 0 -#define _LOWER 1 -#define _RAISE 2 -#define _SUPER 3 -#define _ADJUST 16 -#define SOLENOID_DEFAULT_DWELL 12 -#define SOLENOID_MAX_DWELL 100 -#define SOLENOID_MIN_DWELL 4 -#define SOLENOID_PIN C6 - - -bool solenoid_enabled = false; -bool solenoid_on = false; -bool solenoid_buzz = false; -bool solenoid_buzzing = false; -uint16_t solenoid_start = 0; -uint8_t solenoid_dwell = SOLENOID_DEFAULT_DWELL; - - -void solenoid_buzz_on(void) { - solenoid_buzz = true; -} - -void solenoid_buzz_off(void) { - solenoid_buzz = false; -} - -void solenoid_dwell_minus(void) { - if (solenoid_dwell > 0) solenoid_dwell--; -} - -void solenoid_dwell_plus(void) { - if (solenoid_dwell < SOLENOID_MAX_DWELL) solenoid_dwell++; -} - -void solenoid_toggle(void) { - solenoid_enabled = !solenoid_enabled; -} - -void solenoid_stop(void) { - digitalWrite(SOLENOID_PIN, PinLevelLow); - solenoid_on = false; - solenoid_buzzing = false; -} - -void solenoid_fire(void) { - if (!solenoid_enabled) return; - - if (!solenoid_buzz && solenoid_on) return; - if (solenoid_buzz && solenoid_buzzing) return; - - solenoid_on = true; - solenoid_buzzing = true; - solenoid_start = timer_read(); - digitalWrite(SOLENOID_PIN, PinLevelHigh); -} - -void solenoid_check(void) { - uint16_t elapsed = 0; - - if (!solenoid_on) return; - - elapsed = timer_elapsed(solenoid_start); - - //Check if it's time to finish this solenoid click cycle - if (elapsed > solenoid_dwell) { - solenoid_stop(); - return; - } - - //Check whether to buzz the solenoid on and off - if (solenoid_buzz) { - if (elapsed / SOLENOID_MIN_DWELL % 2 == 0){ - if (!solenoid_buzzing) { - solenoid_buzzing = true; - digitalWrite(SOLENOID_PIN, PinLevelHigh); - } - } - else { - if (solenoid_buzzing) { - solenoid_buzzing = false; - digitalWrite(SOLENOID_PIN, PinLevelLow); - } - } - } -} - -void solenoid_setup(void) { - pinMode(SOLENOID_PIN, PinDirectionOutput); -} - -void matrix_init_user(void) { - solenoid_setup(); -} - -void matrix_scan_user(void) { - solenoid_check(); -} - - -enum custom_keycodes { - QWERTY = SAFE_RANGE, - LOWER, - RAISE, - SUPER, - ADJUST, - SOL_TOG, - SOLENOID_DWELL_MINUS, - SOLENOID_DWELL_PLUS, - SOLENOID_BUZZ_ON, - SOLENOID_BUZZ_OFF, - TD_ESC = 0, -}; - -#define KC_ KC_TRNS -#define _______ KC_TRNS - -#define KC_LOWR LOWER -#define KC_RASE RAISE -#define KC_SUPR SUPER -#define KC_RST RESET -#define KC_BL_S BL_STEP -#define KC_EXC TD(TD_ESC) -#define SOLTOG SOLENOID_TOG - -// Macro Declarations -#define UM_ROOT M(0) -#define UM_PPLY M(1) -#define UM_PSEF M(2) -#define KC_XCPY M(3) -#define KC_XINS M(4) -#define UM_CAD M(5) - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = LAYOUT_kc( @@ -152,7 +15,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| EQL, Z , X , C , V , B ,LGUI, LALT, N , M ,COMM,DOT ,SLSH,MINS, //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' - LCTL,RASE,SPC , SPC ,LOWR,SUPR + LCTL,RASE,SPC , SPC ,LOWR,xxxx // `----+----+----' `----+----+----' ), @@ -178,130 +41,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //|----+----+----+----+----+----| |----+----+----+----+----+----| , F9 ,F10 ,F11 ,F12 , , , , , , , , //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| - , , ,XCPY,XINS, , , , , , , , ,PLUS, + , , ,XCPY,XINS, , , , , , , , , , //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' , , , , , // `----+----+----' `----+----+----' ), - [_SUPER] = LAYOUT( - //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------. - SOL_TOG, UM_ROOT, UM_PPLY, UM_PSEF, _______, _______, _______, _______, _______, _______, _______, _______, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, _______, _______, _______, KC_LBRC, _______, _______, _______, _______, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, UM_CAD , - //|--------+--------+--------+--------+--------+--------+--------. ,--------|--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, - //`--------+--------+--------+----+---+--------+--------+--------/ \--------+--------+--------+---+----+--------+--------+--------' - _______, _______, _______, _______, _______, _______ - // `--------+--------+--------' `--------+--------+--------' -) - -}; - -void persistent_default_layer_set(uint16_t default_layer) { - eeconfig_update_default_layer(default_layer); - default_layer_set(default_layer); -} - -qk_tap_dance_action_t tap_dance_actions[] = { - //Tap once for grave accent, twice for ESC - [TD_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, KC_ESC) -}; - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if (record->event.pressed) { - solenoid_fire(); - } - switch (keycode) { - case QWERTY: - if (record->event.pressed) { - persistent_default_layer_set(1UL<<_QWERTY); - } - return false; - break; - case LOWER: - if (record->event.pressed) { - layer_on(_LOWER); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } else { - layer_off(_LOWER); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } - return false; - break; - case RAISE: - if (record->event.pressed) { - layer_on(_RAISE); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } else { - layer_off(_RAISE); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } - return false; - break; - case SUPER: - if (record->event.pressed) { - layer_on(_SUPER); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } else { - layer_off(_SUPER); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } - return false; - break; - case SOLTOG: - if (record->event.pressed) { - solenoid_toggle(); - } - break; - case SOLENOID_DWELL_MINUS: - if (record->event.pressed) { - solenoid_dwell_minus(); - } - break; - case SOLENOID_DWELL_PLUS: - if (record->event.pressed) { - solenoid_dwell_plus(); - } - break; - case SOLENOID_BUZZ_ON: - if (record->event.pressed) { - solenoid_buzz_on(); - } - break; - case SOLENOID_BUZZ_OFF: - if (record->event.pressed) { - solenoid_buzz_off(); - } - break; - } - return true; -}; - -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: - return MACRO(D(LCTL), T(INS), U(LCTL), END); - break; - case 4: - return MACRO(D(LSFT), T(INS), U(LSFT), END); - break; - case 5: - return MACRO(D(LCTL), D(RALT), T(DEL), END); - break; - } - } - return MACRO_NONE; + [_ADJUST] = LAYOUT_kc( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + STOG,ROOT,PPLY,PSEF,xxxx,xxxx, xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, xxxx,xxxx,xxxx,xxxx,xxxx,BSLS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + xxxx, ,xxxx, xxxx, , + // `----+----+----' `----+----+----' + ) }; diff --git a/keyboards/iris/keymaps/mtdjr/rules.mk b/keyboards/iris/keymaps/mtdjr/rules.mk index 7c19013e5b..c5e16f1369 100644 --- a/keyboards/iris/keymaps/mtdjr/rules.mk +++ b/keyboards/iris/keymaps/mtdjr/rules.mk @@ -1,6 +1,5 @@ RGBLIGHT_ENABLE = no BACKLIGHT_ENABLE = no -TAP_DANCE_ENABLE = no ifndef QUANTUM_DIR include ../../../../Makefile |