From 76bc23550857badaa35ae68c62875dd8b1fad0ce Mon Sep 17 00:00:00 2001 From: Keys of Kings Date: Sun, 1 Nov 2020 12:53:17 -0600 Subject: [PATCH] [Keyboard] Add keysofkings folder and twokey keyboard (#10754) * Add keysofkings folder and twokey keyboard * Update readme.md * Update readme.md * Update config.h * Update config.h * Update keymap.c * Update twokey.c * Update twokey.h * Update keyboards/keysofkings/twokey/config.h Co-authored-by: Ryan * Update keyboards/keysofkings/twokey/readme.md Co-authored-by: Ryan * Update keyboards/keysofkings/twokey/rules.mk Co-authored-by: Ryan * Update keyboards/keysofkings/twokey/rules.mk Co-authored-by: Ryan * Update keyboards/keysofkings/twokey/readme.md Co-authored-by: Ryan * Update info.json * Update keymap.c * Update keyboards/keysofkings/twokey/info.json Co-authored-by: Ryan Co-authored-by: Ryan --- keyboards/keysofkings/twokey/config.h | 68 ++++++++++++++++ keyboards/keysofkings/twokey/info.json | 16 ++++ .../twokey/keymaps/default/keymap.c | 79 +++++++++++++++++++ keyboards/keysofkings/twokey/readme.md | 16 ++++ keyboards/keysofkings/twokey/rules.mk | 23 ++++++ keyboards/keysofkings/twokey/twokey.c | 17 ++++ keyboards/keysofkings/twokey/twokey.h | 28 +++++++ 7 files changed, 247 insertions(+) create mode 100755 keyboards/keysofkings/twokey/config.h create mode 100644 keyboards/keysofkings/twokey/info.json create mode 100644 keyboards/keysofkings/twokey/keymaps/default/keymap.c create mode 100644 keyboards/keysofkings/twokey/readme.md create mode 100755 keyboards/keysofkings/twokey/rules.mk create mode 100755 keyboards/keysofkings/twokey/twokey.c create mode 100755 keyboards/keysofkings/twokey/twokey.h diff --git a/keyboards/keysofkings/twokey/config.h b/keyboards/keysofkings/twokey/config.h new file mode 100755 index 00000000000..d7f4c3cf0a6 --- /dev/null +++ b/keyboards/keysofkings/twokey/config.h @@ -0,0 +1,68 @@ + /* Copyright 2020 Keys of Kings + * + * 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 "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0xAE12 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Keys of Kings +#define PRODUCT Twokey + +/* key matrix size */ +#define MATRIX_ROWS 2 +#define MATRIX_COLS 2 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { B4, B5 } +#define MATRIX_COL_PINS { B3, B2 } +#define UNUSED_PINS + + +#define ENCODERS_PAD_A { E6 } +#define ENCODERS_PAD_B { D7 } +#define ENCODER_RESOLUTION 1 +#define ENCODER_DIRECTION_FLIP + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE + +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +#ifdef RGBLIGHT_ENABLE +#define RGB_DI_PIN D3 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 5 +#define RGBLIGHT_HUE_STEP 4 +#define RGBLIGHT_SAT_STEP 4 +#define RGBLIGHT_VAL_STEP 4 +#define B6_AUDIO +#define AUDIO_CLICKY +#endif + +#ifdef AUDIO_ENABLE +#define STARTUP_SONG SONG(MAJOR_SOUND) +#endif diff --git a/keyboards/keysofkings/twokey/info.json b/keyboards/keysofkings/twokey/info.json new file mode 100644 index 00000000000..d7dabbc946e --- /dev/null +++ b/keyboards/keysofkings/twokey/info.json @@ -0,0 +1,16 @@ +{ + "keyboard_name": "Twokey", + "url": "", + "maintainer": "Keys of Kings", + "width": 2, + "height": 2.5, + "layouts": { + "LAYOUT": { + "layout": [ + {"x": 0.5, "y": 0}, + {"x": 0, "y": 1.5}, + {"x": 1, "y": 1.5} + ] + } + } +} diff --git a/keyboards/keysofkings/twokey/keymaps/default/keymap.c b/keyboards/keysofkings/twokey/keymaps/default/keymap.c new file mode 100644 index 00000000000..eaa4f88de5a --- /dev/null +++ b/keyboards/keysofkings/twokey/keymaps/default/keymap.c @@ -0,0 +1,79 @@ + /* Copyright 2020 Keys of Kings + * + * 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] = { + LAYOUT( + LT(1, KC_MUTE), + LT(4, KC_MPLY), LT(7, KC_MNXT)), + + LAYOUT( + KC_TRNS, + TO(2), TO(3)), + + LAYOUT( + TO(0), + RGB_TOG, RGB_MOD), + + LAYOUT( + TO(0), + RGB_VAI, RGB_VAD), + + LAYOUT( + TO(0), + RGB_HUI, RGB_HUD), + + LAYOUT( + TO(5), + KC_TRNS, TO(6)), + + LAYOUT( + TO(0), + RGB_SAI, RGB_SAD), + + LAYOUT( + TO(8), + TO(9), KC_TRNS), + + LAYOUT( + TO(0), + CK_TOGG, MU_TOG), + + LAYOUT( + TO(0), + RESET, EEPROM_RESET), +}; + +void matrix_init_user(void) { + debug_config.matrix = 1; + debug_config.keyboard = 1; + debug_config.enable = 1; +} + +void encoder_update_user(int8_t index, bool clockwise) { + if (index == 0) { + if (clockwise) { + tap_code(KC_VOLD); + } else { + tap_code(KC_VOLU); + } + # ifdef AUDIO_CLICKY + clockwise ? clicky_freq_up() : clicky_freq_down(); +# endif + } +} + diff --git a/keyboards/keysofkings/twokey/readme.md b/keyboards/keysofkings/twokey/readme.md new file mode 100644 index 00000000000..18394f8f80c --- /dev/null +++ b/keyboards/keysofkings/twokey/readme.md @@ -0,0 +1,16 @@ +# TWOKEY + +![Twokey](https://i.imgur.com/UiLwPldl.jpeg) + +A Two Key mini keyboard with Rotary Encoder/Switch along with Backlight keys, RGB Underglow, and Piezo Buzzer. Supports Cherry, Choc, Matias switches. + +* Keyboard Maintainer: Keys of Kings +* Keyboard Designer: King Icewind +* Hardware Supported: Twokey PCB, Pro Micro +* Hardware Availability: www.keysofkings.com + +Make example for this keyboard (after setting up your build environment): + + make keysofkings/twokey: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). diff --git a/keyboards/keysofkings/twokey/rules.mk b/keyboards/keysofkings/twokey/rules.mk new file mode 100755 index 00000000000..d892fd2b7be --- /dev/null +++ b/keyboards/keysofkings/twokey/rules.mk @@ -0,0 +1,23 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +MOUSEKEY_ENABLE = no # 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 # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = yes # Audio output +ENCODER_ENABLE = yes diff --git a/keyboards/keysofkings/twokey/twokey.c b/keyboards/keysofkings/twokey/twokey.c new file mode 100755 index 00000000000..1668092bf4d --- /dev/null +++ b/keyboards/keysofkings/twokey/twokey.c @@ -0,0 +1,17 @@ + /* Copyright 2020 Keys of Kings + * + * 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 "twokey.h" diff --git a/keyboards/keysofkings/twokey/twokey.h b/keyboards/keysofkings/twokey/twokey.h new file mode 100755 index 00000000000..169bc9eb11e --- /dev/null +++ b/keyboards/keysofkings/twokey/twokey.h @@ -0,0 +1,28 @@ + /* Copyright 2020 Keys of Kings + * + * 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( \ + K00, \ + K10, K11 \ +) { \ + { K00, KC_NO }, \ + { K10, K11 } \ +} +