diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2016-08-25 12:22:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-25 12:22:28 -0400 |
| commit | f0cb5e9e50f663ce4e3161f251c0e638c0313403 (patch) | |
| tree | 391521e33b3bae0dd58d687f6d3387966ef16f3a | |
| parent | 8ebe9c446c6ba9f159a8d478a7e03f035812a363 (diff) | |
| parent | 22ef0bbac55215965c7fc6246d20d4591fbf14f4 (diff) | |
| download | qmk_firmware-f0cb5e9e50f663ce4e3161f251c0e638c0313403.tar.gz qmk_firmware-f0cb5e9e50f663ce4e3161f251c0e638c0313403.zip | |
Merge pull request #683 from ickerwx/master
LEDs work now, fixed Kitten Paw default keymap, added my own keymap as a better example
| -rw-r--r-- | keyboards/kitten_paw/Makefile | 2 | ||||
| -rw-r--r-- | keyboards/kitten_paw/keymaps/default/keymap.c | 2 | ||||
| -rw-r--r-- | keyboards/kitten_paw/keymaps/ickerwx/config.h | 31 | ||||
| -rw-r--r-- | keyboards/kitten_paw/keymaps/ickerwx/keymap.c | 242 | ||||
| -rw-r--r-- | keyboards/kitten_paw/keymaps/ickerwx/readme.md | 18 | ||||
| -rw-r--r-- | keyboards/kitten_paw/kitten_paw.c | 19 | ||||
| -rw-r--r-- | keyboards/kitten_paw/kitten_paw.h | 11 | ||||
| -rw-r--r-- | keyboards/kitten_paw/led.c | 47 | ||||
| -rw-r--r-- | keyboards/kitten_paw/matrix.c | 3 |
9 files changed, 322 insertions, 53 deletions
diff --git a/keyboards/kitten_paw/Makefile b/keyboards/kitten_paw/Makefile index 912292173..3b5585ed6 100644 --- a/keyboards/kitten_paw/Makefile +++ b/keyboards/kitten_paw/Makefile | |||
| @@ -69,7 +69,7 @@ BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | |||
| 69 | AUDIO_ENABLE ?= no # Audio output on port C6 | 69 | AUDIO_ENABLE ?= no # Audio output on port C6 |
| 70 | 70 | ||
| 71 | CUSTOM_MATRIX = yes | 71 | CUSTOM_MATRIX = yes |
| 72 | SRC += matrix.c led.c | 72 | SRC += matrix.c |
| 73 | 73 | ||
| 74 | ifndef QUANTUM_DIR | 74 | ifndef QUANTUM_DIR |
| 75 | include ../../Makefile | 75 | include ../../Makefile |
diff --git a/keyboards/kitten_paw/keymaps/default/keymap.c b/keyboards/kitten_paw/keymaps/default/keymap.c index f67235745..64aa672d0 100644 --- a/keyboards/kitten_paw/keymaps/default/keymap.c +++ b/keyboards/kitten_paw/keymaps/default/keymap.c | |||
| @@ -11,7 +11,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 11 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL, KC_END,KC_PGDN, KC_P7, KC_P8, KC_P9,KC_PPLS, \ | 11 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL, KC_END,KC_PGDN, KC_P7, KC_P8, KC_P9,KC_PPLS, \ |
| 12 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, \ | 12 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, \ |
| 13 | KC_LSFT,KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3,KC_PENT, \ | 13 | KC_LSFT,KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3,KC_PENT, \ |
| 14 | KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT) | 14 | KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT) |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
| 17 | const uint16_t PROGMEM fn_actions[] = { | 17 | const uint16_t PROGMEM fn_actions[] = { |
diff --git a/keyboards/kitten_paw/keymaps/ickerwx/config.h b/keyboards/kitten_paw/keymaps/ickerwx/config.h new file mode 100644 index 000000000..04a2d253c --- /dev/null +++ b/keyboards/kitten_paw/keymaps/ickerwx/config.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #ifndef CONFIG_USER_H | ||
| 2 | #define CONFIG_USER_H | ||
| 3 | |||
| 4 | #include "../../config.h" | ||
| 5 | |||
| 6 | #undef MOUSEKEY_MOVE_MAX | ||
| 7 | #define MOUSEKEY_MOVE_MAX 127 | ||
| 8 | #undef MOUSEKEY_WHEEL_MAX | ||
| 9 | #define MOUSEKEY_WHEEL_MAX 110 | ||
| 10 | #undef MOUSEKEY_MOVE_DELTA | ||
| 11 | #define MOUSEKEY_MOVE_DELTA 5 | ||
| 12 | #undef MOUSEKEY_WHEEL_DELTA | ||
| 13 | #define MOUSEKEY_WHEEL_DELTA 1 | ||
| 14 | #undef MOUSEKEY_DELAY | ||
| 15 | #define MOUSEKEY_DELAY 50 | ||
| 16 | #undef MOUSEKEY_INTERVAL | ||
| 17 | #define MOUSEKEY_INTERVAL 20 | ||
| 18 | #undef MOUSEKEY_MAX_SPEED | ||
| 19 | #define MOUSEKEY_MAX_SPEED 4 | ||
| 20 | #undef MOUSEKEY_TIME_TO_MAX | ||
| 21 | #define MOUSEKEY_TIME_TO_MAX 30 | ||
| 22 | #undef MOUSEKEY_WHEEL_MAX_SPEED | ||
| 23 | #define MOUSEKEY_WHEEL_MAX_SPEED 3 | ||
| 24 | #undef MOUSEKEY_WHEEL_TIME_TO_MAX | ||
| 25 | #define MOUSEKEY_WHEEL_TIME_TO_MAX 1000 | ||
| 26 | #undef ONESHOT_TIMEOUT | ||
| 27 | #define ONESHOT_TIMEOUT 500 | ||
| 28 | #undef TAPPING_TOGGLE | ||
| 29 | #define TAPPING_TOGGLE 2 | ||
| 30 | |||
| 31 | #endif | ||
diff --git a/keyboards/kitten_paw/keymaps/ickerwx/keymap.c b/keyboards/kitten_paw/keymaps/ickerwx/keymap.c new file mode 100644 index 000000000..9a00c80dc --- /dev/null +++ b/keyboards/kitten_paw/keymaps/ickerwx/keymap.c | |||
| @@ -0,0 +1,242 @@ | |||
| 1 | #include "kitten_paw.h" | ||
| 2 | #include "mousekey.h" | ||
| 3 | |||
| 4 | #define _______ KC_TRNS | ||
| 5 | #define XXXXXXX KC_NO | ||
| 6 | #define C(kc) LCTL(KC_##kc) | ||
| 7 | #define RA(kc) RALT(KC_##kc) | ||
| 8 | #define KC_SLCT KC_SELECT | ||
| 9 | #define MEDAPP LT(MEDIA, KC_APP) | ||
| 10 | #undef S | ||
| 11 | #define S(kc) LSFT(KC_##kc) | ||
| 12 | |||
| 13 | uint8_t current_layer_global = 255; | ||
| 14 | |||
| 15 | enum layers { | ||
| 16 | DEFAULT, | ||
| 17 | PROG1, | ||
| 18 | PROG2, | ||
| 19 | MEDIA, | ||
| 20 | MOUSE1, | ||
| 21 | MOUSE2, | ||
| 22 | MISC, | ||
| 23 | }; | ||
| 24 | |||
| 25 | enum function_id { | ||
| 26 | LSHFT_PAREN, | ||
| 27 | RSHFT_PAREN, | ||
| 28 | LCTRL_BRACKET, | ||
| 29 | RCTRL_BRACKET, | ||
| 30 | LALT_CURLY, | ||
| 31 | RALT_CURLY, | ||
| 32 | CTRL_CLICK | ||
| 33 | }; | ||
| 34 | |||
| 35 | enum macro_id { | ||
| 36 | GRV, | ||
| 37 | CFLEX | ||
| 38 | }; | ||
| 39 | |||
| 40 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 41 | [DEFAULT] = KEYMAP(\ | ||
| 42 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SLCK,KC_PAUS, \ | ||
| 43 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,KC_MINS, KC_EQL,KC_BSPC, KC_INS,KC_HOME,KC_PGUP, KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \ | ||
| 44 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL, KC_END,KC_PGDN, KC_P7, KC_P8, KC_P9,KC_PPLS, \ | ||
| 45 | F(0), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, \ | ||
| 46 | F(8),KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, F(9), KC_UP, KC_P1, KC_P2, KC_P3,KC_PENT, \ | ||
| 47 | F(1),KC_LGUI, F(3), LT(MISC, KC_SPC), F(4), F(5), MEDAPP, F(2), KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT), | ||
| 48 | /* Layer 1: Programming Layer 1, emulating US l ayout */ | ||
| 49 | [PROG1] = KEYMAP(\ | ||
| 50 | KC_ESC,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \ | ||
| 51 | M(GRV),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,KC_SLSH, S(0),_______, _______,_______,_______, _______,_______,_______,_______, \ | ||
| 52 | _______,_______,_______,_______,_______,_______, KC_Z,_______,_______,_______,_______, RA(8), RA(9),RA(MINS), _______,_______,_______, _______,_______,_______,_______, \ | ||
| 53 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,S(COMM),S(BSLS), _______, _______,_______,_______, \ | ||
| 54 | MO(PROG2),_______, KC_Y,_______,_______,_______,_______,_______,_______,_______,_______, S(7), MO(PROG2), _______, _______,_______,_______,_______, \ | ||
| 55 | _______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______, _______,_______), | ||
| 56 | /* Layer 2: programming layer 2 | ||
| 57 | all keys that are not FN keys are sent as LSFT+key on this layer | ||
| 58 | */ | ||
| 59 | [PROG2] = KEYMAP(\ | ||
| 60 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \ | ||
| 61 | RA(RBRC),_______, RA(Q),KC_BSLS,_______,_______,M(CFLEX), S(6),S(RBRC), S(8), S(9),S(SLSH),KC_RBRC,_______, _______,_______,_______, _______,_______,_______,_______, \ | ||
| 62 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, RA(7), RA(0),RA(NUBS), _______,_______,_______, _______,_______,_______,_______, \ | ||
| 63 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______, S(DOT), S(2), _______, _______,_______,_______, \ | ||
| 64 | _______,S(NUBS),_______,_______,_______,_______,_______,_______,_______,KC_NUBS,S(NUBS),S(MINS), _______, _______, _______,_______,_______,_______, \ | ||
| 65 | _______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______, _______,_______), | ||
| 66 | /* Layer 3: media layer */ | ||
| 67 | [MEDIA] = KEYMAP(\ | ||
| 68 | KC_PWR,KC_SLEP,KC_WAKE,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX, \ | ||
| 69 | XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, KC_MPRV,KC_MPLY,KC_MNXT, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, \ | ||
| 70 | XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, KC_VOLD,KC_MUTE,KC_VOLU, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, \ | ||
| 71 | XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,XXXXXXX, \ | ||
| 72 | XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX, KC_EJCT, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, \ | ||
| 73 | XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,_______,XXXXXXX, KC_MRWD,KC_MSTP,KC_MFFD, XXXXXXX,XXXXXXX), | ||
| 74 | /* Layer 4: Mouse layer */ | ||
| 75 | [MOUSE1] = KEYMAP(\ | ||
| 76 | F(6),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \ | ||
| 77 | _______,KC_ACL0,KC_ACL1,KC_ACL2,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \ | ||
| 78 | _______,KC_BTN4,KC_WH_D,KC_MS_U,KC_WH_U,_______, C(Z),_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \ | ||
| 79 | _______,KC_BTN5,KC_MS_L,KC_MS_D,KC_MS_R, F(7),KC_WH_L,KC_WH_D,KC_WH_U,KC_WH_R,_______,_______, _______, _______,_______,_______, \ | ||
| 80 | MO(MOUSE2),_______, C(Y), C(X), C(C), C(V),_______,KC_BTN2,KC_BTN3,C(PGUP),C(PGDN),_______, KC_RSFT, _______, _______,_______,_______,_______, \ | ||
| 81 | KC_LCTL,_______,KC_LALT, KC_BTN1, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, _______,_______,_______, _______,_______), | ||
| 82 | /* Layer 5: Mouse layer 2*/ | ||
| 83 | [MOUSE2] = KEYMAP(\ | ||
| 84 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \ | ||
| 85 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \ | ||
| 86 | _______,_______,KC_BTN2,KC_WH_U,KC_BTN3,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \ | ||
| 87 | _______,_______,KC_WH_L,KC_WH_D,KC_WH_R,_______,KC_MS_L,KC_MS_D,KC_MS_U,KC_MS_R,_______,_______, _______, _______,_______,_______, \ | ||
| 88 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______,_______,_______, \ | ||
| 89 | _______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______, _______,_______), | ||
| 90 | /* Layer 6: Misc layer */ | ||
| 91 | [MISC] = KEYMAP(\ | ||
| 92 | _______, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, _______,_______,_______, \ | ||
| 93 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \ | ||
| 94 | _______,KC_SLCT, C(W), KC_UP,_______,_______,_______,_______,KC_BSPC, KC_DEL,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \ | ||
| 95 | _______,_______,KC_LEFT,KC_DOWN,KC_RGHT,_______,KC_HOME,KC_PGDN,KC_PGUP,_______,_______,_______, _______, _______,_______,_______, \ | ||
| 96 | KC_LSFT,_______, C(Y), C(X), C(C), C(V), KC_SPC, KC_END,_______,C(PGUP),C(PGDN),_______, _______, _______, _______,_______,_______,_______, \ | ||
| 97 | _______,_______,_______, LT(MISC, KC_SPC), _______,_______,_______,_______, _______,_______,_______, _______,_______), | ||
| 98 | }; | ||
| 99 | |||
| 100 | const uint16_t PROGMEM fn_actions[] = { | ||
| 101 | [0] = ACTION_LAYER_TAP_TOGGLE(MOUSE1), // tap-toggle mouse layer (4) | ||
| 102 | [1] = ACTION_FUNCTION_TAP(LCTRL_BRACKET), // tap to print [ | ||
| 103 | [2] = ACTION_FUNCTION_TAP(RCTRL_BRACKET), // tap to print ] | ||
| 104 | [3] = ACTION_FUNCTION_TAP(LALT_CURLY), // tap to print { | ||
| 105 | [4] = ACTION_FUNCTION_TAP(RALT_CURLY), // tap to print } | ||
| 106 | [5] = ACTION_LAYER_TAP_TOGGLE(PROG1), // tap-toggle programming layer 1 | ||
| 107 | [6] = ACTION_LAYER_SET_CLEAR(DEFAULT), | ||
| 108 | [7] = ACTION_FUNCTION_TAP(CTRL_CLICK), | ||
| 109 | [8] = ACTION_FUNCTION_TAP(LSHFT_PAREN), // tap to print ( | ||
| 110 | [9] = ACTION_FUNCTION_TAP(RSHFT_PAREN), // tap to print ) | ||
| 111 | }; | ||
| 112 | |||
| 113 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
| 114 | { | ||
| 115 | // MACRODOWN only works in this function | ||
| 116 | switch(id) { | ||
| 117 | case GRV: // macro to print accent grave | ||
| 118 | return (record->event.pressed ? | ||
| 119 | MACRO( D(LSFT), T(EQL), U(RALT), T(SPC), END) : | ||
| 120 | MACRO_NONE ); | ||
| 121 | case CFLEX: // print accent circonflex | ||
| 122 | return (record->event.pressed ? | ||
| 123 | MACRO( T(GRV), T(SPC), END ) : | ||
| 124 | MACRO_NONE ); | ||
| 125 | } | ||
| 126 | return MACRO_NONE; | ||
| 127 | }; | ||
| 128 | |||
| 129 | |||
| 130 | void matrix_init_user(void) { | ||
| 131 | |||
| 132 | } | ||
| 133 | |||
| 134 | void matrix_scan_user(void) { | ||
| 135 | uint8_t layer; | ||
| 136 | layer = biton32(layer_state); | ||
| 137 | |||
| 138 | if (current_layer_global != layer) { | ||
| 139 | current_layer_global = layer; | ||
| 140 | |||
| 141 | // unset CAPSLOCK and SCROLL LOCK LEDs | ||
| 142 | led_set_kb(host_keyboard_leds() & ~(1<<USB_LED_CAPS_LOCK)); | ||
| 143 | led_set_kb(host_keyboard_leds() & ~(1<<USB_LED_SCROLL_LOCK)); | ||
| 144 | // set SCROLL LOCK LED when the mouse layer is active, CAPS LOCK when PROG layer is active | ||
| 145 | if (layer == MOUSE1 || layer == MOUSE2) { | ||
| 146 | led_set_kb(host_keyboard_leds() | (1<<USB_LED_SCROLL_LOCK)); | ||
| 147 | } else if (layer == PROG1 || layer == PROG2) { | ||
| 148 | led_set_kb(host_keyboard_leds() | (1<<USB_LED_CAPS_LOCK)); | ||
| 149 | } | ||
| 150 | } | ||
| 151 | } | ||
| 152 | |||
| 153 | void led_set_user(uint8_t usb_led) { | ||
| 154 | |||
| 155 | } | ||
| 156 | |||
| 157 | void tap_helper(keyrecord_t *record, uint16_t orig_mod, uint16_t macro_mod, uint16_t macro_kc ) { | ||
| 158 | if (record->event.pressed) { | ||
| 159 | if (record->tap.count > 0 && !record->tap.interrupted) { | ||
| 160 | if (record->tap.interrupted) { | ||
| 161 | register_mods(MOD_BIT(orig_mod)); | ||
| 162 | } | ||
| 163 | } else { | ||
| 164 | register_mods(MOD_BIT(orig_mod)); | ||
| 165 | } | ||
| 166 | } else { | ||
| 167 | if (record->tap.count > 0 && !(record->tap.interrupted)) { | ||
| 168 | add_weak_mods(MOD_BIT(macro_mod)); | ||
| 169 | send_keyboard_report(); | ||
| 170 | register_code(macro_kc); | ||
| 171 | unregister_code(macro_kc); | ||
| 172 | del_weak_mods(MOD_BIT(macro_mod)); | ||
| 173 | send_keyboard_report(); | ||
| 174 | record->tap.count = 0; // ad hoc: cancel tap | ||
| 175 | } else { | ||
| 176 | unregister_mods(MOD_BIT(orig_mod)); | ||
| 177 | } | ||
| 178 | } | ||
| 179 | } | ||
| 180 | |||
| 181 | /* if LCTRL is tabbed, print (, or ) if RCTRL is tabbed, same for LALT/RALT and [/] */ | ||
| 182 | void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { | ||
| 183 | // The code is copied from keymap_hasu.c in the tmk keyboards hhkb folder | ||
| 184 | switch (id) { | ||
| 185 | case LCTRL_BRACKET: | ||
| 186 | tap_helper(record, KC_LCTL, KC_RALT, KC_8); | ||
| 187 | break; | ||
| 188 | case RCTRL_BRACKET: | ||
| 189 | tap_helper(record, KC_RCTL, KC_RALT, KC_9); | ||
| 190 | break; | ||
| 191 | case LALT_CURLY: | ||
| 192 | tap_helper(record, KC_LALT, KC_RALT, KC_7); | ||
| 193 | break; | ||
| 194 | case RALT_CURLY: | ||
| 195 | tap_helper(record, KC_RALT, KC_RALT, KC_0); | ||
| 196 | break; | ||
| 197 | case LSHFT_PAREN: | ||
| 198 | tap_helper(record, KC_LSFT, KC_LSFT, KC_8); | ||
| 199 | break; | ||
| 200 | case RSHFT_PAREN: | ||
| 201 | tap_helper(record, KC_RSFT, KC_LSFT, KC_9); | ||
| 202 | break; | ||
| 203 | case CTRL_CLICK: | ||
| 204 | if (record->event.pressed) { | ||
| 205 | mousekey_clear(); | ||
| 206 | register_mods(MOD_BIT(KC_LCTL)); | ||
| 207 | send_keyboard_report(); | ||
| 208 | wait_ms(5); | ||
| 209 | mousekey_on(KC_BTN1); | ||
| 210 | mousekey_send(); | ||
| 211 | wait_ms(10); | ||
| 212 | mousekey_off(KC_BTN1); | ||
| 213 | mousekey_send(); | ||
| 214 | wait_ms(5); | ||
| 215 | unregister_mods(MOD_BIT(KC_LCTL)); | ||
| 216 | send_keyboard_report(); | ||
| 217 | } | ||
| 218 | break; | ||
| 219 | } | ||
| 220 | } | ||
| 221 | |||
| 222 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 223 | uint8_t layer; | ||
| 224 | layer = biton32(layer_state); | ||
| 225 | if (layer == PROG2) { | ||
| 226 | if (keycode >= KC_A && keycode <= KC_EXSEL && \ | ||
| 227 | !( // do not send LSFT + these keycodes, they are needed for emulating the US layout | ||
| 228 | keycode == KC_NONUS_BSLASH || | ||
| 229 | keycode == KC_RBRC || | ||
| 230 | keycode == KC_BSLS || | ||
| 231 | keycode == KC_GRV | ||
| 232 | )) { | ||
| 233 | // LSFT is the modifier for this layer, so we set LSFT for every key to get the expected behavior | ||
| 234 | if (record->event.pressed) { | ||
| 235 | register_mods(MOD_LSFT); | ||
| 236 | } else { | ||
| 237 | unregister_mods(MOD_LSFT); | ||
| 238 | } | ||
| 239 | } | ||
| 240 | } | ||
| 241 | return true; | ||
| 242 | } | ||
diff --git a/keyboards/kitten_paw/keymaps/ickerwx/readme.md b/keyboards/kitten_paw/keymaps/ickerwx/readme.md new file mode 100644 index 000000000..0d23be4ea --- /dev/null +++ b/keyboards/kitten_paw/keymaps/ickerwx/readme.md | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | # My personal keymap for the Kitten Paw controller | ||
| 2 | |||
| 3 | This keymap only works correctly when you have your OS configured with a German keymap. Use the keymap however you like. It's most likely a living thing that will never be quite finished. | ||
| 4 | |||
| 5 | ## Description of the layers | ||
| 6 | Layer 0 (DEFAULT) works just like you would expect a keyboard to work, mostly, except: | ||
| 7 | Caps Lock switches to the mouse layer, RGUI and APP are switches to the programming layer and media layer. | ||
| 8 | Mouse and programming layer switches can be held or double-tapped to lock. | ||
| 9 | Holding space switches to the MISC layer where I currently accumulate useful shortcuts. | ||
| 10 | Tapping left and right Shift, Ctrl and Alt will send (), [] and {} respectively. | ||
| 11 | |||
| 12 | Layers 1 and 2 (PROG1 and PROG2) emulate the US layout while still using a German OS keymap setting. I was annoyed of having to change the OS settings every time I wanted to use the US layout for coding, so I made these layers to behave just like the US layout even though the OS still uses German. The shift keys were a bit tricky, I had to use them as MO(PROG2) switches, so to get the actual expected behavior I enable LSFT for almost every keypress on PROG2 in ```process_record_user```. Since the shift keys are MO() function keys, they do not print () at the moment, which sucks. I'm working on it. | ||
| 13 | |||
| 14 | Layer 3 (MEDIA) just has a couple of media keys on it, mainly around the cursor keys and nav key cluster. | ||
| 15 | |||
| 16 | Layers 4 and 5 (MOUSE1 and MOUSE2) are mouse layers. Move the cursor using ESDF, scroll using HJKL, Space for left click, N and M for right and middle click. There's more, look at the keymap. | ||
| 17 | |||
| 18 | Layer 6 is a layer I don't have a good name for, so I call it MISC. You'll find cursor keys at ESDF, other navigation keys around the HJKL cluster and F12 to F24 on the F-keys. For now. \ No newline at end of file | ||
diff --git a/keyboards/kitten_paw/kitten_paw.c b/keyboards/kitten_paw/kitten_paw.c index 8713baf43..92f64b06b 100644 --- a/keyboards/kitten_paw/kitten_paw.c +++ b/keyboards/kitten_paw/kitten_paw.c | |||
| @@ -4,7 +4,6 @@ void matrix_init_kb(void) { | |||
| 4 | // put your keyboard start-up code here | 4 | // put your keyboard start-up code here |
| 5 | // runs once when the firmware starts up | 5 | // runs once when the firmware starts up |
| 6 | 6 | ||
| 7 | matrix_init_quantum(); | ||
| 8 | matrix_init_user(); | 7 | matrix_init_user(); |
| 9 | } | 8 | } |
| 10 | 9 | ||
| @@ -12,7 +11,6 @@ void matrix_scan_kb(void) { | |||
| 12 | // put your looping keyboard code here | 11 | // put your looping keyboard code here |
| 13 | // runs every cycle (a lot) | 12 | // runs every cycle (a lot) |
| 14 | 13 | ||
| 15 | matrix_scan_quantum(); | ||
| 16 | matrix_scan_user(); | 14 | matrix_scan_user(); |
| 17 | } | 15 | } |
| 18 | 16 | ||
| @@ -25,6 +23,21 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | |||
| 25 | 23 | ||
| 26 | void led_set_kb(uint8_t usb_led) { | 24 | void led_set_kb(uint8_t usb_led) { |
| 27 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | 25 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here |
| 28 | 26 | CONFIG_LED_IO; | |
| 27 | CONFIG_LED_IO; | ||
| 28 | print_dec(usb_led); | ||
| 29 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) | ||
| 30 | USB_LED_CAPS_LOCK_ON; | ||
| 31 | else | ||
| 32 | USB_LED_CAPS_LOCK_OFF; | ||
| 33 | |||
| 34 | if (usb_led & (1<<USB_LED_NUM_LOCK)) | ||
| 35 | USB_LED_NUM_LOCK_ON; | ||
| 36 | else | ||
| 37 | USB_LED_NUM_LOCK_OFF; | ||
| 38 | if (usb_led & (1<<USB_LED_SCROLL_LOCK)) | ||
| 39 | USB_LED_SCROLL_LOCK_ON; | ||
| 40 | else | ||
| 41 | USB_LED_SCROLL_LOCK_OFF; | ||
| 29 | led_set_user(usb_led); | 42 | led_set_user(usb_led); |
| 30 | } | 43 | } |
diff --git a/keyboards/kitten_paw/kitten_paw.h b/keyboards/kitten_paw/kitten_paw.h index a6c1d27de..189b721b9 100644 --- a/keyboards/kitten_paw/kitten_paw.h +++ b/keyboards/kitten_paw/kitten_paw.h | |||
| @@ -3,6 +3,17 @@ | |||
| 3 | 3 | ||
| 4 | #include "quantum.h" | 4 | #include "quantum.h" |
| 5 | 5 | ||
| 6 | #define CONFIG_LED_IO \ | ||
| 7 | DDRB |= (1<<7); \ | ||
| 8 | DDRC |= (1<<5) | (1<<6); | ||
| 9 | |||
| 10 | #define USB_LED_CAPS_LOCK_ON PORTC &= ~(1<<6) | ||
| 11 | #define USB_LED_CAPS_LOCK_OFF PORTC |= (1<<6) | ||
| 12 | #define USB_LED_NUM_LOCK_ON PORTB &= ~(1<<7) | ||
| 13 | #define USB_LED_NUM_LOCK_OFF PORTB |= (1<<7) | ||
| 14 | #define USB_LED_SCROLL_LOCK_ON PORTC &= ~(1<<5) | ||
| 15 | #define USB_LED_SCROLL_LOCK_OFF PORTC |= (1<<5) | ||
| 16 | |||
| 6 | // This a shortcut to help you visually see your layout. | 17 | // This a shortcut to help you visually see your layout. |
| 7 | // The first section contains all of the arguements | 18 | // The first section contains all of the arguements |
| 8 | // The second converts the arguments into a two-dimensional array | 19 | // The second converts the arguments into a two-dimensional array |
diff --git a/keyboards/kitten_paw/led.c b/keyboards/kitten_paw/led.c deleted file mode 100644 index a1bf057c4..000000000 --- a/keyboards/kitten_paw/led.c +++ /dev/null | |||
| @@ -1,47 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2014 Ralf Schmitt <ralf@bunkertor.net> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <avr/io.h> | ||
| 19 | #include "stdint.h" | ||
| 20 | #include "led.h" | ||
| 21 | |||
| 22 | /* LED pin configuration | ||
| 23 | * | ||
| 24 | * Scroll Lock PC5 | ||
| 25 | * Caps Lock PC6 | ||
| 26 | * Num Lock PB7 | ||
| 27 | * | ||
| 28 | */ | ||
| 29 | void led_set(uint8_t usb_led) { | ||
| 30 | DDRB |= (1<<7); | ||
| 31 | DDRC |= (1<<5) | (1<<6); | ||
| 32 | |||
| 33 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) | ||
| 34 | PORTC &= ~(1<<6); | ||
| 35 | else | ||
| 36 | PORTC |= (1<<6); | ||
| 37 | |||
| 38 | if (usb_led & (1<<USB_LED_NUM_LOCK)) | ||
| 39 | PORTB &= ~(1<<7); | ||
| 40 | else | ||
| 41 | PORTB |= (1<<7); | ||
| 42 | |||
| 43 | if (usb_led & (1<<USB_LED_SCROLL_LOCK)) | ||
| 44 | PORTC &= ~(1<<5); | ||
| 45 | else | ||
| 46 | PORTC |= (1<<5); | ||
| 47 | } | ||
diff --git a/keyboards/kitten_paw/matrix.c b/keyboards/kitten_paw/matrix.c index 46875293f..d436ad56c 100644 --- a/keyboards/kitten_paw/matrix.c +++ b/keyboards/kitten_paw/matrix.c | |||
| @@ -67,6 +67,7 @@ void matrix_init(void) { | |||
| 67 | matrix[i] = 0; | 67 | matrix[i] = 0; |
| 68 | matrix_debouncing[i] = 0; | 68 | matrix_debouncing[i] = 0; |
| 69 | } | 69 | } |
| 70 | matrix_init_quantum(); | ||
| 70 | } | 71 | } |
| 71 | 72 | ||
| 72 | uint8_t matrix_scan(void) { | 73 | uint8_t matrix_scan(void) { |
| @@ -94,7 +95,7 @@ uint8_t matrix_scan(void) { | |||
| 94 | } | 95 | } |
| 95 | } | 96 | } |
| 96 | } | 97 | } |
| 97 | 98 | matrix_scan_quantum(); | |
| 98 | return 1; | 99 | return 1; |
| 99 | } | 100 | } |
| 100 | 101 | ||
