From 265a4d278c9b0a683fa16bba33f0c0833361752a Mon Sep 17 00:00:00 2001 From: Greg Knapp Date: Sat, 11 Sep 2021 21:41:54 +0100 Subject: [PATCH 1/7] Add via support --- keyboards/yampad/config.h | 2 +- keyboards/yampad/keymaps/via/keymap.c | 163 ++++++++++++++++++++++++++ keyboards/yampad/keymaps/via/rules.mk | 4 + keyboards/yampad/rules.mk | 26 ++-- 4 files changed, 181 insertions(+), 14 deletions(-) create mode 100644 keyboards/yampad/keymaps/via/keymap.c create mode 100644 keyboards/yampad/keymaps/via/rules.mk diff --git a/keyboards/yampad/config.h b/keyboards/yampad/config.h index d04ae37d5a49..b21a606ddc97 100644 --- a/keyboards/yampad/config.h +++ b/keyboards/yampad/config.h @@ -20,7 +20,7 @@ along with this program. If not, see . #include "config_common.h" /* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED +#define VENDOR_ID 0x5950 // YP #define PRODUCT_ID 0x8369 #define DEVICE_VER 0x0001 #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 000000000000..d22eb26177be --- /dev/null +++ b/keyboards/yampad/keymaps/via/keymap.c @@ -0,0 +1,163 @@ +/* MIT License + +Copyright (c) 2019 Mattia Dal Ben + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#include QMK_KEYBOARD_H + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +enum layers { + _BL, + _NV, + _FN +}; + +enum custom_keycodes { + KC_DBL0 = SAFE_RANGE, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap _BL: (Base Layer) Default Layer + * ,-------------------. + * | NV | / | * |-/FN| + * |----|----|----|----| + * | 7 | 8 | 9 | | + * |----|----|----| + | + * | 4 | 5 | 6 | | + * |----|----|----|----| + * | 1 | 2 | 3 | | + * |----|----|----| En | + * | 0 | 00 | . | | + * `-------------------' + */ + [_BL] = LAYOUT( + TG(_NV), KC_PSLS, KC_PAST, LT(_FN, KC_PMNS), + KC_P7, KC_P8, KC_P9, + KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_P1, KC_P2, KC_P3, + KC_P0, KC_DBL0, KC_PDOT, KC_PENT + ), + +/* Keymap _NV: Navigation layer + * ,-------------------. + * |INS |HOME|PGUP| | + * |----|----|----|----| + * |DEL |END |PGDN| | + * |----|----|----| | + * | | | | | + * |----|----|----|----| + * | | UP | | | + * |----|----|----| | + * |LEFT|DOWN|RIGH| | + * `-------------------' + */ + [_NV] = LAYOUT( + KC_INS, KC_HOME, KC_PGUP, TG(_NV), + KC_DEL, KC_END, KC_PGDN, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, KC_UP, XXXXXXX, + KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX + ), + +/* Keymap _FN: RGB Function Layer + * ,-------------------. + * |RMOD|RGBP|RTOG| FN | + * |----|----|----|----| + * |HUD |HUI | | | + * |----|----|----| | + * |SAD |SAI | | | + * |----|----|----|----| + * |VAD |VAS | | | + * |----|----|----| | + * |RST | | | | + * `-------------------' + */ + [_FN] = LAYOUT( + RGB_MOD, RGB_M_P, RGB_TOG, _______, + RGB_HUD, RGB_HUI, XXXXXXX, + RGB_SAD, RGB_SAI, XXXXXXX, XXXXXXX, + RGB_VAD, RGB_VAI, XXXXXXX, + RESET, XXXXXXX, XXXXXXX, XXXXXXX + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_DBL0: + if (record->event.pressed) { + SEND_STRING("00"); + } else { + // when keycode KC_DBL0 is released + } + break; + + } + return true; +}; + +#ifdef OLED_ENABLE + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_270; // flips the display 270 degrees +} + +void oled_task_user(void) { + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer"), false); + switch (get_highest_layer(layer_state)) { + case _BL: + oled_write_ln_P(PSTR(" BAS"), false); + break; + case _NV: + oled_write_ln_P(PSTR(" NAV"), false); + break; + case _FN: + oled_write_ln_P(PSTR(" RGB"), false); + break; + default: + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR(" UND"), false); + } + + // Host Keyboard LED Status + led_t led_state = host_keyboard_led_state(); + oled_write_P(PSTR("-----"), false); + oled_write_P(PSTR("Stats"), false); + oled_write_P(led_state.num_lock ? PSTR("num:*") : PSTR("num:."), false); + oled_write_P(led_state.caps_lock ? PSTR("cap:*") : PSTR("cap:."), false); + oled_write_P(led_state.scroll_lock ? PSTR("scr:*") : PSTR("scr:."), false); + + // Host Keyboard RGB backlight status + oled_write_P(PSTR("-----"), false); + oled_write_P(PSTR("Light"), false); + + static char led_buf[30]; + snprintf(led_buf, sizeof(led_buf) - 1, "RGB:%cM: %2d\nh: %2ds: %2dv: %2d\n", + rgblight_is_enabled() ? '*' : '.', (uint8_t)rgblight_get_mode(), + (uint8_t)(rgblight_get_hue() / RGBLIGHT_HUE_STEP), + (uint8_t)(rgblight_get_sat() / RGBLIGHT_SAT_STEP), + (uint8_t)(rgblight_get_val() / RGBLIGHT_VAL_STEP)); + oled_write(led_buf, false); +} +#endif diff --git a/keyboards/yampad/keymaps/via/rules.mk b/keyboards/yampad/keymaps/via/rules.mk new file mode 100644 index 000000000000..9bf0baa68541 --- /dev/null +++ b/keyboards/yampad/keymaps/via/rules.mk @@ -0,0 +1,4 @@ +EXTRAKEY_ENABLE = no +LTO_ENABLE = yes +MOUSEKEY_ENABLE = no +VIA_ENABLE = yes diff --git a/keyboards/yampad/rules.mk b/keyboards/yampad/rules.mk index f42be7ca5035..0b4abbd031a6 100644 --- a/keyboards/yampad/rules.mk +++ b/keyboards/yampad/rules.mk @@ -2,24 +2,24 @@ MCU = atmega32u4 # Bootloader selection -BOOTLOADER = caterina +#BOOTLOADER = caterina # ProMicro +BOOTLOADER = atmel-dfu # Elite-C, SeaMicro etc. # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = no # Audio control and System control -CONSOLE_ENABLE = no # Console for debug +AUDIO_ENABLE = no # Audio output +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +BLUETOOTH_ENABLE = no # Enable Bluetooth +BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite COMMAND_ENABLE = no # Commands for debug and configuration -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +CONSOLE_ENABLE = no # Console for debug +DEBOUNCE_TYPE = sym_eager_pk +EXTRAKEY_ENABLE = no # Audio control and System control +LTO_ENABLE = yes # Link time optimise, reduce firmware size +MOUSEKEY_ENABLE = no # Mouse keys # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work NKRO_ENABLE = yes # USB Nkey Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow -BLUETOOTH_ENABLE = no # Enable Bluetooth -AUDIO_ENABLE = no # Audio output -OLED_ENABLE = yes OLED_DRIVER = SSD1306 -DEBOUNCE_TYPE = sym_eager_pk +OLED_ENABLE = yes +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow From 6dad24b953a343185e702c6414355b07a20a90ac Mon Sep 17 00:00:00 2001 From: Greg Knapp Date: Sat, 11 Sep 2021 21:48:27 +0100 Subject: [PATCH 2/7] Restore caterina as default bootloader --- keyboards/yampad/rules.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/yampad/rules.mk b/keyboards/yampad/rules.mk index 0b4abbd031a6..6408a08bfc52 100644 --- a/keyboards/yampad/rules.mk +++ b/keyboards/yampad/rules.mk @@ -2,8 +2,8 @@ MCU = atmega32u4 # Bootloader selection -#BOOTLOADER = caterina # ProMicro -BOOTLOADER = atmel-dfu # Elite-C, SeaMicro etc. +BOOTLOADER = caterina # ProMicro +#BOOTLOADER = atmel-dfu # Elite-C, SeaMicro etc. # Build Options # change yes to no to disable From 33705caa812a17ab1c39f018dde804228e6c32f5 Mon Sep 17 00:00:00 2001 From: Greg Knapp Date: Sat, 11 Sep 2021 22:00:14 +0100 Subject: [PATCH 3/7] Per PR guidelines, remove alternate bootloader --- keyboards/yampad/rules.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/yampad/rules.mk b/keyboards/yampad/rules.mk index 6408a08bfc52..458477102136 100644 --- a/keyboards/yampad/rules.mk +++ b/keyboards/yampad/rules.mk @@ -3,7 +3,6 @@ MCU = atmega32u4 # Bootloader selection BOOTLOADER = caterina # ProMicro -#BOOTLOADER = atmel-dfu # Elite-C, SeaMicro etc. # Build Options # change yes to no to disable From 2b98e5445f6df23b144258467fe35106741873d0 Mon Sep 17 00:00:00 2001 From: Greg Knapp Date: Sat, 11 Sep 2021 22:12:05 +0100 Subject: [PATCH 4/7] Remove bootloader comment --- keyboards/yampad/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/yampad/rules.mk b/keyboards/yampad/rules.mk index 458477102136..ea3175ebe665 100644 --- a/keyboards/yampad/rules.mk +++ b/keyboards/yampad/rules.mk @@ -2,7 +2,7 @@ MCU = atmega32u4 # Bootloader selection -BOOTLOADER = caterina # ProMicro +BOOTLOADER = caterina # Build Options # change yes to no to disable From b2bddd2e9cd72f0538bc5c1bab9bec3b7b40168c Mon Sep 17 00:00:00 2001 From: Greg Knapp Date: Sat, 11 Sep 2021 22:36:24 +0100 Subject: [PATCH 5/7] Add VIA keymap readme --- keyboards/yampad/keymaps/via/readme.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 keyboards/yampad/keymaps/via/readme.md diff --git a/keyboards/yampad/keymaps/via/readme.md b/keyboards/yampad/keymaps/via/readme.md new file mode 100644 index 000000000000..af6c97eb3f81 --- /dev/null +++ b/keyboards/yampad/keymaps/via/readme.md @@ -0,0 +1,9 @@ +![Yampad Layout Image](https://i.imgur.com/QwrufEt.png) + +# VIA Yampad Layout + +This is the layout in the VIA enabled firmware. +Optional 2U zero key to suit your Yampad build. + +Compile: `make yampad:via` +Flash: `make yampad:via:flash` From 88fd84357ccac7d7aa36e8de77565a3f2ba66893 Mon Sep 17 00:00:00 2001 From: Greg Knapp Date: Sat, 11 Sep 2021 22:38:25 +0100 Subject: [PATCH 6/7] Add line break between instructions --- keyboards/yampad/keymaps/via/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/yampad/keymaps/via/readme.md b/keyboards/yampad/keymaps/via/readme.md index af6c97eb3f81..29ea4d3cddfb 100644 --- a/keyboards/yampad/keymaps/via/readme.md +++ b/keyboards/yampad/keymaps/via/readme.md @@ -5,5 +5,5 @@ This is the layout in the VIA enabled firmware. Optional 2U zero key to suit your Yampad build. -Compile: `make yampad:via` +Compile: `make yampad:via` Flash: `make yampad:via:flash` From d40cdcec06a59dae3256734daa2d3d81b0af6b52 Mon Sep 17 00:00:00 2001 From: Greg Knapp Date: Wed, 15 Sep 2021 09:52:53 +0100 Subject: [PATCH 7/7] Remove redundant Bluetooth directive Co-authored-by: Drashna Jaelre --- keyboards/yampad/rules.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/keyboards/yampad/rules.mk b/keyboards/yampad/rules.mk index ea3175ebe665..667620e93b19 100644 --- a/keyboards/yampad/rules.mk +++ b/keyboards/yampad/rules.mk @@ -9,8 +9,7 @@ BOOTLOADER = caterina # AUDIO_ENABLE = no # Audio output BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -BLUETOOTH_ENABLE = no # Enable Bluetooth -BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite COMMAND_ENABLE = no # Commands for debug and configuration CONSOLE_ENABLE = no # Console for debug DEBOUNCE_TYPE = sym_eager_pk