From 7b07ce3fef7481a2a026f54b4d6c4c5762a2c110 Mon Sep 17 00:00:00 2001 From: duoshock <33636898+duoshock@users.noreply.github.com> Date: Wed, 24 Mar 2021 02:00:07 +0000 Subject: [PATCH] Add UC-1 keypad (#11926) Co-authored-by: Ryan Co-authored-by: online <33636898+online@users.noreply.github.com> --- keyboards/merge/uc1/config.h | 47 ++++++++++++++++ keyboards/merge/uc1/info.json | 17 ++++++ keyboards/merge/uc1/keymaps/default/keymap.c | 40 ++++++++++++++ keyboards/merge/uc1/keymaps/default/readme.md | 5 ++ keyboards/merge/uc1/keymaps/via/keymap.c | 53 +++++++++++++++++++ keyboards/merge/uc1/keymaps/via/rules.mk | 2 + keyboards/merge/uc1/readme.md | 14 +++++ keyboards/merge/uc1/rules.mk | 23 ++++++++ keyboards/merge/uc1/uc1.c | 17 ++++++ keyboards/merge/uc1/uc1.h | 27 ++++++++++ 10 files changed, 245 insertions(+) create mode 100644 keyboards/merge/uc1/config.h create mode 100644 keyboards/merge/uc1/info.json create mode 100644 keyboards/merge/uc1/keymaps/default/keymap.c create mode 100644 keyboards/merge/uc1/keymaps/default/readme.md create mode 100644 keyboards/merge/uc1/keymaps/via/keymap.c create mode 100644 keyboards/merge/uc1/keymaps/via/rules.mk create mode 100644 keyboards/merge/uc1/readme.md create mode 100644 keyboards/merge/uc1/rules.mk create mode 100644 keyboards/merge/uc1/uc1.c create mode 100644 keyboards/merge/uc1/uc1.h diff --git a/keyboards/merge/uc1/config.h b/keyboards/merge/uc1/config.h new file mode 100644 index 000000000..f33d7a654 --- /dev/null +++ b/keyboards/merge/uc1/config.h @@ -0,0 +1,47 @@ + /* Copyright 2021 duoshock + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "config_common.h" + +#define VENDOR_ID 0x4D65 +#define PRODUCT_ID 0x5543 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Merge +#define PRODUCT UC-1 + +/* key matrix size */ +#define MATRIX_ROWS 2 +#define MATRIX_COLS 2 + +#define MATRIX_ROW_PINS { B1, B2 } +#define MATRIX_COL_PINS { B3, B4 } +#define UNUSED_PINS + +#define RGB_DI_PIN B5 +#define RGBLED_NUM 12 +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 10 +#define RGBLIGHT_VAL_STEP 10 +#define RGBLIGHT_LIMIT_VAL 255 +#define RGBLIGHT_SLEEP + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +#define ENCODERS_PAD_A { F5 } +#define ENCODERS_PAD_B { F6 } +#define ENCODER_RESOLUTION 4 diff --git a/keyboards/merge/uc1/info.json b/keyboards/merge/uc1/info.json new file mode 100644 index 000000000..b1fbc5935 --- /dev/null +++ b/keyboards/merge/uc1/info.json @@ -0,0 +1,17 @@ +{ + "keyboard_name": "UC-1", + "url": "https://mergedesign.store/products/uc-1", + "maintainer": "duoshock", + "width": 4.25, + "height": 1, + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"0", "x":0, "y":0}, + {"label":"1", "x":1.25, "y":0}, + {"label":"2", "x":2.25, "y":0}, + {"label":"3", "x":3.25, "y":0} + ] + } + } +} diff --git a/keyboards/merge/uc1/keymaps/default/keymap.c b/keyboards/merge/uc1/keymaps/default/keymap.c new file mode 100644 index 000000000..5a19a9de7 --- /dev/null +++ b/keyboards/merge/uc1/keymaps/default/keymap.c @@ -0,0 +1,40 @@ +/* Copyright 2021 duoshock + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* LAYER 0 + * ,---------------------------------. + * | Encoder | 1 | 2 | 3 | + * `---------------------------------' + */ +[0] = LAYOUT( + KC_MUTE, KC_1, KC_2, KC_3 +), +}; + + +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } +} \ No newline at end of file diff --git a/keyboards/merge/uc1/keymaps/default/readme.md b/keyboards/merge/uc1/keymaps/default/readme.md new file mode 100644 index 000000000..38145e2aa --- /dev/null +++ b/keyboards/merge/uc1/keymaps/default/readme.md @@ -0,0 +1,5 @@ +# Default UC-1 Layout + +![UC-1 Layout Image](https://i.imgur.com/TkaZ6jh.jpg) + +This is the default layout that comes flashed on every UC-1. diff --git a/keyboards/merge/uc1/keymaps/via/keymap.c b/keyboards/merge/uc1/keymaps/via/keymap.c new file mode 100644 index 000000000..6bc732e61 --- /dev/null +++ b/keyboards/merge/uc1/keymaps/via/keymap.c @@ -0,0 +1,53 @@ + /* Copyright 2021 duoshock + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* LAYER 0 + * ,---------------------------------. + * | Encoder | 1 | 2 | 3 | + * `---------------------------------' + */ +[0] = LAYOUT( + KC_MUTE, KC_1, KC_2, KC_3 +), + +[1] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[2] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +) + +}; + + +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } +} \ No newline at end of file diff --git a/keyboards/merge/uc1/keymaps/via/rules.mk b/keyboards/merge/uc1/keymaps/via/rules.mk new file mode 100644 index 000000000..43061db1d --- /dev/null +++ b/keyboards/merge/uc1/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes \ No newline at end of file diff --git a/keyboards/merge/uc1/readme.md b/keyboards/merge/uc1/readme.md new file mode 100644 index 000000000..730b97516 --- /dev/null +++ b/keyboards/merge/uc1/readme.md @@ -0,0 +1,14 @@ +# UC-1 + +![UC-1](https://i.imgur.com/rbuySDxl.jpg) + +A 3 keys macro pad with 1 encoders made and sold by Merge. [Product page](https://mergedesign.store/products/uc-1) + +* Keyboard Maintainer: [duoshock](https://github.com/duoshock) +* Hardware Availability: [Merge Store](https://mergedesign.store/products/uc-1) + +Make example for this keyboard (after setting up your build environment): + + make merge/uc1:default + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). \ No newline at end of file diff --git a/keyboards/merge/uc1/rules.mk b/keyboards/merge/uc1/rules.mk new file mode 100644 index 000000000..d1ce4736b --- /dev/null +++ b/keyboards/merge/uc1/rules.mk @@ -0,0 +1,23 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +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 +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # 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 +ENCODER_ENABLE = yes diff --git a/keyboards/merge/uc1/uc1.c b/keyboards/merge/uc1/uc1.c new file mode 100644 index 000000000..d23e7426d --- /dev/null +++ b/keyboards/merge/uc1/uc1.c @@ -0,0 +1,17 @@ + /* Copyright 2021 duoshock + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "uc1.h" diff --git a/keyboards/merge/uc1/uc1.h b/keyboards/merge/uc1/uc1.h new file mode 100644 index 000000000..84e655d1b --- /dev/null +++ b/keyboards/merge/uc1/uc1.h @@ -0,0 +1,27 @@ + /* Copyright 2021 duoshock + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "quantum.h" + +#define LAYOUT( \ + k11, k00, k01, k10 \ +) \ +{ \ + { k00, k01 }, \ + { k10, k11 } \ +}