diff options
| author | Greg Knapp <virtual.greg@gmail.com> | 2021-09-28 20:23:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-28 12:23:38 -0700 |
| commit | 724ee240751fdfedf33d75fee10d2b97d9f9e3da (patch) | |
| tree | aa14f1757fce2734f0bfe4b47eb4fa8db1e75127 | |
| parent | 4a2062cc0169785a6cd51a4a5de2bda8f0f78a40 (diff) | |
| download | qmk_firmware-724ee240751fdfedf33d75fee10d2b97d9f9e3da.tar.gz qmk_firmware-724ee240751fdfedf33d75fee10d2b97d9f9e3da.zip | |
[Keyboard] Yampad VIA support (#14397)
Co-authored-by: Drashna Jaelre <drashna@live.com>
| -rw-r--r-- | keyboards/yampad/config.h | 2 | ||||
| -rw-r--r-- | keyboards/yampad/keymaps/via/keymap.c | 163 | ||||
| -rw-r--r-- | keyboards/yampad/keymaps/via/readme.md | 9 | ||||
| -rw-r--r-- | keyboards/yampad/keymaps/via/rules.mk | 4 | ||||
| -rw-r--r-- | keyboards/yampad/rules.mk | 21 |
5 files changed, 187 insertions, 12 deletions
diff --git a/keyboards/yampad/config.h b/keyboards/yampad/config.h index d04ae37d5..b21a606dd 100644 --- a/keyboards/yampad/config.h +++ b/keyboards/yampad/config.h | |||
| @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 20 | #include "config_common.h" | 20 | #include "config_common.h" |
| 21 | 21 | ||
| 22 | /* USB Device descriptor parameter */ | 22 | /* USB Device descriptor parameter */ |
| 23 | #define VENDOR_ID 0xFEED | 23 | #define VENDOR_ID 0x5950 // YP |
| 24 | #define PRODUCT_ID 0x8369 | 24 | #define PRODUCT_ID 0x8369 |
| 25 | #define DEVICE_VER 0x0001 | 25 | #define DEVICE_VER 0x0001 |
| 26 | #define MANUFACTURER Mattia Dal Ben | 26 | #define MANUFACTURER Mattia Dal Ben |
diff --git a/keyboards/yampad/keymaps/via/keymap.c b/keyboards/yampad/keymaps/via/keymap.c new file mode 100644 index 000000000..d22eb2617 --- /dev/null +++ b/keyboards/yampad/keymaps/via/keymap.c | |||
| @@ -0,0 +1,163 @@ | |||
| 1 | /* MIT License | ||
| 2 | |||
| 3 | Copyright (c) 2019 Mattia Dal Ben | ||
| 4 | |||
| 5 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 6 | of this software and associated documentation files (the "Software"), to deal | ||
| 7 | in the Software without restriction, including without limitation the rights | ||
| 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 9 | copies of the Software, and to permit persons to whom the Software is | ||
| 10 | furnished to do so, subject to the following conditions: | ||
| 11 | |||
| 12 | The above copyright notice and this permission notice shall be included in all | ||
| 13 | copies or substantial portions of the Software. | ||
| 14 | |||
| 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 21 | SOFTWARE. | ||
| 22 | */ | ||
| 23 | |||
| 24 | #include QMK_KEYBOARD_H | ||
| 25 | |||
| 26 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 27 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 28 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 29 | // entirely and just use numbers. | ||
| 30 | enum layers { | ||
| 31 | _BL, | ||
| 32 | _NV, | ||
| 33 | _FN | ||
| 34 | }; | ||
| 35 | |||
| 36 | enum custom_keycodes { | ||
| 37 | KC_DBL0 = SAFE_RANGE, | ||
| 38 | }; | ||
| 39 | |||
| 40 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 41 | /* Keymap _BL: (Base Layer) Default Layer | ||
| 42 | * ,-------------------. | ||
| 43 | * | NV | / | * |-/FN| | ||
| 44 | * |----|----|----|----| | ||
| 45 | * | 7 | 8 | 9 | | | ||
| 46 | * |----|----|----| + | | ||
| 47 | * | 4 | 5 | 6 | | | ||
| 48 | * |----|----|----|----| | ||
| 49 | * | 1 | 2 | 3 | | | ||
| 50 | * |----|----|----| En | | ||
| 51 | * | 0 | 00 | . | | | ||
| 52 | * `-------------------' | ||
| 53 | */ | ||
| 54 | [_BL] = LAYOUT( | ||
| 55 | TG(_NV), KC_PSLS, KC_PAST, LT(_FN, KC_PMNS), | ||
| 56 | KC_P7, KC_P8, KC_P9, | ||
| 57 | KC_P4, KC_P5, KC_P6, KC_PPLS, | ||
| 58 | KC_P1, KC_P2, KC_P3, | ||
| 59 | KC_P0, KC_DBL0, KC_PDOT, KC_PENT | ||
| 60 | ), | ||
| 61 | |||
| 62 | /* Keymap _NV: Navigation layer | ||
| 63 | * ,-------------------. | ||
| 64 | * |INS |HOME|PGUP| | | ||
| 65 | * |----|----|----|----| | ||
| 66 | * |DEL |END |PGDN| | | ||
| 67 | * |----|----|----| | | ||
| 68 | * | | | | | | ||
| 69 | * |----|----|----|----| | ||
| 70 | * | | UP | | | | ||
| 71 | * |----|----|----| | | ||
| 72 | * |LEFT|DOWN|RIGH| | | ||
| 73 | * `-------------------' | ||
| 74 | */ | ||
| 75 | [_NV] = LAYOUT( | ||
| 76 | KC_INS, KC_HOME, KC_PGUP, TG(_NV), | ||
| 77 | KC_DEL, KC_END, KC_PGDN, | ||
| 78 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
| 79 | XXXXXXX, KC_UP, XXXXXXX, | ||
| 80 | KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX | ||
| 81 | ), | ||
| 82 | |||
| 83 | /* Keymap _FN: RGB Function Layer | ||
| 84 | * ,-------------------. | ||
| 85 | * |RMOD|RGBP|RTOG| FN | | ||
| 86 | * |----|----|----|----| | ||
| 87 | * |HUD |HUI | | | | ||
| 88 | * |----|----|----| | | ||
| 89 | * |SAD |SAI | | | | ||
| 90 | * |----|----|----|----| | ||
| 91 | * |VAD |VAS | | | | ||
| 92 | * |----|----|----| | | ||
| 93 | * |RST | | | | | ||
| 94 | * `-------------------' | ||
| 95 | */ | ||
| 96 | [_FN] = LAYOUT( | ||
| 97 | RGB_MOD, RGB_M_P, RGB_TOG, _______, | ||
| 98 | RGB_HUD, RGB_HUI, XXXXXXX, | ||
| 99 | RGB_SAD, RGB_SAI, XXXXXXX, XXXXXXX, | ||
| 100 | RGB_VAD, RGB_VAI, XXXXXXX, | ||
| 101 | RESET, XXXXXXX, XXXXXXX, XXXXXXX | ||
| 102 | ), | ||
| 103 | }; | ||
| 104 | |||
| 105 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 106 | switch (keycode) { | ||
| 107 | case KC_DBL0: | ||
| 108 | if (record->event.pressed) { | ||
| 109 | SEND_STRING("00"); | ||
| 110 | } else { | ||
| 111 | // when keycode KC_DBL0 is released | ||
| 112 | } | ||
| 113 | break; | ||
| 114 | |||
| 115 | } | ||
| 116 | return true; | ||
| 117 | }; | ||
| 118 | |||
| 119 | #ifdef OLED_ENABLE | ||
| 120 | |||
| 121 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 122 | return OLED_ROTATION_270; // flips the display 270 degrees | ||
| 123 | } | ||
| 124 | |||
| 125 | void oled_task_user(void) { | ||
| 126 | // Host Keyboard Layer Status | ||
| 127 | oled_write_P(PSTR("Layer"), false); | ||
| 128 | switch (get_highest_layer(layer_state)) { | ||
| 129 | case _BL: | ||
| 130 | oled_write_ln_P(PSTR(" BAS"), false); | ||
| 131 | break; | ||
| 132 | case _NV: | ||
| 133 | oled_write_ln_P(PSTR(" NAV"), false); | ||
| 134 | break; | ||
| 135 | case _FN: | ||
| 136 | oled_write_ln_P(PSTR(" RGB"), false); | ||
| 137 | break; | ||
| 138 | default: | ||
| 139 | // Or use the write_ln shortcut over adding '\n' to the end of your string | ||
| 140 | oled_write_ln_P(PSTR(" UND"), false); | ||
| 141 | } | ||
| 142 | |||
| 143 | // Host Keyboard LED Status | ||
| 144 | led_t led_state = host_keyboard_led_state(); | ||
| 145 | oled_write_P(PSTR("-----"), false); | ||
| 146 | oled_write_P(PSTR("Stats"), false); | ||
| 147 | oled_write_P(led_state.num_lock ? PSTR("num:*") : PSTR("num:."), false); | ||
| 148 | oled_write_P(led_state.caps_lock ? PSTR("cap:*") : PSTR("cap:."), false); | ||
| 149 | oled_write_P(led_state.scroll_lock ? PSTR("scr:*") : PSTR("scr:."), false); | ||
| 150 | |||
| 151 | // Host Keyboard RGB backlight status | ||
| 152 | oled_write_P(PSTR("-----"), false); | ||
| 153 | oled_write_P(PSTR("Light"), false); | ||
| 154 | |||
| 155 | static char led_buf[30]; | ||
| 156 | snprintf(led_buf, sizeof(led_buf) - 1, "RGB:%cM: %2d\nh: %2ds: %2dv: %2d\n", | ||
| 157 | rgblight_is_enabled() ? '*' : '.', (uint8_t)rgblight_get_mode(), | ||
| 158 | (uint8_t)(rgblight_get_hue() / RGBLIGHT_HUE_STEP), | ||
| 159 | (uint8_t)(rgblight_get_sat() / RGBLIGHT_SAT_STEP), | ||
| 160 | (uint8_t)(rgblight_get_val() / RGBLIGHT_VAL_STEP)); | ||
| 161 | oled_write(led_buf, false); | ||
| 162 | } | ||
| 163 | #endif | ||
diff --git a/keyboards/yampad/keymaps/via/readme.md b/keyboards/yampad/keymaps/via/readme.md new file mode 100644 index 000000000..29ea4d3cd --- /dev/null +++ b/keyboards/yampad/keymaps/via/readme.md | |||
| @@ -0,0 +1,9 @@ | |||
| 1 |  | ||
| 2 | |||
| 3 | # VIA Yampad Layout | ||
| 4 | |||
| 5 | This is the layout in the VIA enabled firmware. | ||
| 6 | Optional 2U zero key to suit your Yampad build. | ||
| 7 | |||
| 8 | Compile: `make yampad:via` | ||
| 9 | Flash: `make yampad:via:flash` | ||
diff --git a/keyboards/yampad/keymaps/via/rules.mk b/keyboards/yampad/keymaps/via/rules.mk new file mode 100644 index 000000000..9bf0baa68 --- /dev/null +++ b/keyboards/yampad/keymaps/via/rules.mk | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | EXTRAKEY_ENABLE = no | ||
| 2 | LTO_ENABLE = yes | ||
| 3 | MOUSEKEY_ENABLE = no | ||
| 4 | VIA_ENABLE = yes | ||
diff --git a/keyboards/yampad/rules.mk b/keyboards/yampad/rules.mk index 5e1480870..667620e93 100644 --- a/keyboards/yampad/rules.mk +++ b/keyboards/yampad/rules.mk | |||
| @@ -7,18 +7,17 @@ BOOTLOADER = caterina | |||
| 7 | # Build Options | 7 | # Build Options |
| 8 | # change yes to no to disable | 8 | # change yes to no to disable |
| 9 | # | 9 | # |
| 10 | BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite | 10 | AUDIO_ENABLE = no # Audio output |
| 11 | MOUSEKEY_ENABLE = no # Mouse keys | 11 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality |
| 12 | EXTRAKEY_ENABLE = no # Audio control and System control | 12 | BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite |
| 13 | CONSOLE_ENABLE = no # Console for debug | ||
| 14 | COMMAND_ENABLE = no # Commands for debug and configuration | 13 | COMMAND_ENABLE = no # Commands for debug and configuration |
| 15 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | 14 | CONSOLE_ENABLE = no # Console for debug |
| 16 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | 15 | DEBOUNCE_TYPE = sym_eager_pk |
| 16 | EXTRAKEY_ENABLE = no # Audio control and System control | ||
| 17 | LTO_ENABLE = yes # Link time optimise, reduce firmware size | ||
| 18 | MOUSEKEY_ENABLE = no # Mouse keys | ||
| 17 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | 19 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work |
| 18 | NKRO_ENABLE = yes # USB Nkey Rollover | 20 | NKRO_ENABLE = yes # USB Nkey Rollover |
| 19 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 20 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | ||
| 21 | AUDIO_ENABLE = no # Audio output | ||
| 22 | OLED_ENABLE = yes | ||
| 23 | OLED_DRIVER = SSD1306 | 21 | OLED_DRIVER = SSD1306 |
| 24 | DEBOUNCE_TYPE = sym_eager_pk | 22 | OLED_ENABLE = yes |
| 23 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | ||
